Want to add a new system? Are the docs not clear enough? We're always accepting contributions so please share any new features, improvements or bug fixes with us.
- Clone the repo and run
npm install
. - Copy
envs/.env.dev
to the project root and rename it to.env
. - Run
npm run up
to spin up the Docker Compose containers. - The backend will be accessible via
http://localhost:3000
.
Run npm run seed
to seed your database with some fake data like users, events, games and players.
The seed command will create two users: admin@trytalo.com
(an admin user) and dev@trytalo.com
(a dev user with less permissions), both can be logged in with using the password password
.
Run npm test
to run the unit tests.
The tests run against your database container. They'll automatically backup and restore the current state of your database before executing the tests.
Your .env
file will be used along with any additional env vars you define in envs/.env.test
.
Please make sure to include tests with all pull requests.
You can create a new service using the npm run service:create
command. You need to pass in the name of the entity you want the service to interact with.
For example, if you are adding a "Global Stats" service, you would run: npm run service:create -- global-stat
(note that the entity name is singular and not a plural).
This will create a policy, entity and REST API for your new entity. If you want to expose API endpoints (so that it can be used by the Unity SDK), add --api
to the end of the command.
To create a migration, use npm run migration:create
. This will create a migration class in the migrations
folder.
Modify the default name of the file from Migration[Timestamp].ts
to [Timestamp][PascalCaseDescriptionOfTheMigration].ts
.
You should also rename the exported class to be [PascalCaseDescriptionOfTheMigration]
.
You will then need to import and add that migration class to the end of the list of migrations inside index.ts
in the same folder.
ClickHouse migrations are created in the src/migrations/clickhouse
folder. These are manually created and should be added to the src/migrations/clickhouse/index.ts
file. The migration script will automatically run the migration if it hasn't already been applied.