Skip to content

NestJS server for creating, storing, retrieving and mutating TODS tournaments

Notifications You must be signed in to change notification settings

CourtHive/competition-factory-server

Repository files navigation

CourtHive Logo

CourtHive is an Open Source / Open Data initiative to develop components to support the emergence of a standards based ecosystem of services for competition.

NPM Version Package License NPM Downloads

Description

Lightweight NestJS example server for testing client/server use cases with tods-competition-factory

Installation

$ pnpm install

Redis

Make sure you have Redis installed

.env file

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'

Storage

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

Running the app

If you have PM2 installed:

pm2 start ecosystem.config.js

...otherwise...

# development
$ pnpm start

# watch mode
$ pnpm watch

# production mode
$ pnpm start:prod

Test

# unit tests
$ pnpm test controller
$ pnpm test factory
$ pnpm test service

# e2e tests
$ pnpm test e2e

# test coverage
$ pnpm run test:cov

Development User Creation

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.

Support

License

The Competition Factory is MIT licensed.

About

NestJS server for creating, storing, retrieving and mutating TODS tournaments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •