Development primarily occurs with yarn. While there are docker containers available, these are meant more for production environments.
You should first clone the repository and perform first-time setup:
cat <<EOT > rctf.d/00-development.yaml
ctfName: rCTF Development
meta:
description: 'Example rCTF instance'
imageUrl: 'https://example.com'
homeContent: 'A description of your CTF. Markdown supported.'
origin: http://127.0.0.1:8080
divisions:
open: Open
tokenKey: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
startTime: 0
endTime: 99999999999999
database:
sql:
host: 127.0.0.1
user: rctf
password: DO_NOT_USE_ME
database: rctf
redis:
host: 127.0.0.1
password: DO_NOT_USE_ME
migrate: before
EOTThen, build all the packages once so that all the required bundles get created:
yarn
yarn workspace @rctf/api-types build
yarn workspace @rctf/server build
yarn workspace @rctf/client buildAfter that, you can start up a local development environment in the future by running the following commands:
docker compose -f docker-compose.development.yml up -d
yarn devThese will automatically watch the filesystem for changes, and restart when needed.
Note that this will start two servers. The API listens on http://localhost:3000 by default while the frontend is served by Preact on http://localhost:8080.
Before committing your changes, please:
- run
yarn lintandyarn lint --fixto fix any linting errors - run
yarn testto ensure there are no regressions
Finally, when it's all done, you can commit with git commit.
Make sure to follow the commit message guidelines.
You should follow the examples below as a guideline for how to name your branches.
feature/brief-description-here
fix/bug-description
refactor/some-component
docs/some-component
rCTF uses Playwright for end-to-end testing. The .env.test file in the repository root contains the test configuration variables. See packages/client/testConfig.ts for the complete list.
- Install Playwright browsers (first time only):
cd packages/client
npx playwright install- Run all E2E tests:
npx playwright test- Run a specific test file:
npx playwright test tests/auth.spec.ts