Monsters monorepo
  • TypeScript 98.8%
  • JavaScript 0.6%
  • Dockerfile 0.3%
  • Makefile 0.2%
Find a file
Jakub 930380ca7b
Some checks failed
Test / install (push) Has been cancelled
Test / setup-config (push) Has been cancelled
Test / lint (push) Has been cancelled
Test / build (push) Has been cancelled
Test / test (push) Has been cancelled
Test / audit (push) Has been cancelled
Feat: Added swagger, added documentation
2025-11-28 20:05:47 +01:00
.gitea Feat: Added metrics 2025-11-28 18:30:03 +01:00
docs Feat: Added swagger, added documentation 2025-11-28 20:05:47 +01:00
src Feat: Added swagger, added documentation 2025-11-28 20:05:47 +01:00
tests Feat: Added more reobust pipelines for pull requests 2025-11-27 21:50:46 +01:00
.editorconfig Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
.env.sample Feat: Added metrics 2025-11-28 18:30:03 +01:00
.gitignore Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
.prettierrc Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
.swcrc Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
Dockerfile Feat: Added metrics 2025-11-28 18:30:03 +01:00
dockerignore Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
eslint.config.ts Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
LICENSE Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
makefile Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
nest-cli.json Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
package-lock.json Feat: Added swagger, added documentation 2025-11-28 20:05:47 +01:00
package.json Feat: Added swagger, added documentation 2025-11-28 20:05:47 +01:00
README.md Feat: Added swagger, added documentation 2025-11-28 20:05:47 +01:00
start.sh Feat: Added metrics 2025-11-28 18:30:03 +01:00
tsconfig.build.json Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00
tsconfig.json Feat: Rebased this onto my other basic nest.js project 2025-11-26 21:44:48 +01:00

Monorepo

Monorepo for monsters

TLDR:

  1. How to start
  2. How to build
  3. Useful information
  4. Docs
  5. Style

1. How to start

  • Copy .env.sample to .env
cp .env.sample .env

and fill it will your options. You can find out more in How to start

  • Install dependencies
npm install
  • Initialize database
npm run migrate
  • Start
npm run start:dev

Above scripts will let you start this application. You can find more detailed guide in /docs/HowToStart.md

2. How to build

npm run build / yarn build

Important

If you even encounter strange build behavior, tsconfig is set to create build with cache. Set option incremental in tsConfig to false

3. Useful information

3.1 Testing

All test currently are written using jest. You can run all tests or just type specific tests

Available targets

yarn test:e2e = run 'end to end' tests
yarn test:unit = run 'unit' tests

Tip

To run all tests, use makefile script

make test

3.2 Hooks

Instead of adding additional packages like husky, its easier to add hooks manually. If you want your code to check its quality and test itself before committing code, you can add this code to .git/hooks/pre-commit

#!/bin/sh

set -e

echo "Running lint-staged"
npm run lintStaged

echo "Running tsc"
npm run listErrors

echo "Running unit tests"
npm run test:unit

echo "Running e2e tests"
npm run test:e2e

echo "Auditing"
npm audit

Above code will:

  • Lint your staged code
  • Validate if it can be built
  • Test it
  • Audit it

Most of people that I've meet, do not care about auditing their code. If you do not care if packages includes in your app have known vulnerabilities, you can remove last 2 lines from this code. Keep in mind, that pipelines also run the same commands.

Tip

If you are not using windows, you should make above file executable by chmod +x ./git/hooks/pre-commit.

4. Docs

4.1 Environments

This application utilizes NODE_ENV env, which is set in package.json. start command does not include NODE_ENV. This is prepared for docker or any external tools, to manipulate environment.

  • Production - prod env. This is the env you want, if you are planning on running production env. This mode disables debug logs.
  • Development - development settings. If you are working on this application, thats the mode you want.
  • Test - test env, set while running tests. This env will make so mysql connects to testing database.

4.2 Api docs

This project is using swagger docs for api documentation. You can access them by route http://localhost:{port}/docs

4.3 Probes

This application is ready for probing in k8s / other systems. You can find liveness probe in here. Readiness probe should be utilized based on /api/health route. This route will not respond, if server is dead. This will fail only if there is a heavy problem with database connection or application is unable to start, due to problems other problems.

4.4 Sigterm, Sigint

This application uses handlers for sigint and sigterm. Based on those, it will simply close connections, nest application and will exit. Please remember, that there is no proper handler for this yet.

4.5 Tests

This application has tests written in jest. Additional docs:

How to write good tests

4.6 Additional docs

Simplified application startup Pipelines

Additional docs can be found in docs folder

5. Style

This application uses my personal eslint settings. They are EXTREMELY strict and will force you to write specific type of code with unified style across whole project. This is MY config. You may not like it so please, modify it to your heart desire.