Full boiler plate of a NestJS, GraphQL and PostgreSQL (with Mikro-ORM) monolithic backend app. It implements:
- Configuration (adds most used config classes):
-
- Cache with Redis
-
- GraphQL with dataloaders, subscriptions and GraphQL through Websockets
-
- MikroORM with SQLite in development and PostgreSQL in production
- Authentication:
-
- JWT Authentication for HTTP
-
- Custom Session Authentication for Websockets (based on Facebook Messenger Design)
-
- Two-Factor authentication with email
- Uploader:
-
- Basic image only uploader with Sharp optimizations for a Linode Bucket (it can be changed for AWS S3)
- Pagination:
-
- Has the generics for Edges and Paginated types
-
- A basic one way cursor pagination function
$ yarn install
# creation
$ yarn migrate:create
# update
$ yarn migrate:update
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
BEFORE EACH TEST:
- Check if NODE_ENV is not production
- Remove the current test.db
- Create a new test.db
# remove test.db
$ rm test.db
# create a new test.db
$ yarn migrate:create
EACH TEST SHOULD BE RUN SEPERATLY
# unit tests
$ yarn run test service-name.service.spec.ts --detectOpenHandles
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Mikro-ORM is a TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. If you like MikroORM, give it a star on GitHub and consider sponsoring its development!
Sharp is a high performance Node.js image processor. If you want to support them.
This template is MIT licensed.