CourtHive is an Open Source / Open Data initiative to develop components to support the emergence of a standards based ecosystem of services for competition.
Lightweight NestJS example server for testing client/server use cases with tods-competition-factory
$ pnpm install
Make sure you have Redis installed
Create an .env
file in the root directory.
APP_STORAGE='fileSystem' # 'levelDB' or 'fileSystem'
APP_NAME='Competition Factory Server'
APP_MODE='development' # 'production'
APP_PORT=8383
JWT_SECRET='Replace this string with a truly random string'
JWT_VALIDITY=2h
TRACKER_CACHE='cache'
REDIS_TTL= 8 * 60 * 60 * 1000
REDIS_HOST='localhost'
REDIS_USERNAME=''
REDIS_PASSWORD=''
REDIS_PORT=6379
DB_HOST=localhost
DB_PORT=3838
DB_USER=admin
DB_PASS=adminpass
MAILGUN_API_KEY='your-mailgun-api-key'
MAILGUN_HOST='api.eu.mailgun.net'
MAILGUN_DOMAIN='m.your.domain'
By default the server will store tournaments in the file system. In order to use levelDB
to persist tournament records, net-level-server
must be running.
$ pnpm hive-db
If you have PM2 installed:
pm2 start ecosystem.config.js
...otherwise...
# development
$ pnpm start
# watch mode
$ pnpm watch
# production mode
$ pnpm start:prod
# unit tests
$ pnpm test controller
$ pnpm test factory
$ pnpm test service
# e2e tests
$ pnpm test e2e
# test coverage
$ pnpm run test:cov
In order for Tournaments to persist, you need to create a user that is backed by a 'provider'.
If running in development, point a TMX frontend instance at your server, use the test user username: [email protected]
password: castle
to login.
Create your provider (top right user icon/dropdown -> Create Provider), then create a user with that provider.
The frontend will copy the invite link to your clipboard in order to complete that user, use that and complete your account.
Logout of [email protected]
and into your newly created account.
Tournaments should now persist on the LevelDB/filesystem.
- Author - Charles Allen
- Website - https://CourtHive.com
The Competition Factory is MIT licensed.