A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
This folder is discover bookings applications api. It will be based on the MVC model
- Nestjs & @nestjs/typeorm
- Graphql-relay
- Typeorm & @nestjs/typeorm
- Graphql
MVC architecture where each folder will be named as per the table e.g. user
- user.resolver.ts - contains graphql queries and mutations for said table e.g. user
- user.service.ts - Contains all the functionalities that will interact with the reposiory folder
- user.module.ts - Our core folder which will be injected to our root app module
The general lib
folder will contain all other functionalities
e.g.
It will contain
- repository - This is the folder that will interact with our DB
- entities - This folder will contain our DB tables, we will use the old tables from
db
folder - migrations - The DB migrations will be created here
- graphql - The graphql schema
- connections - the relay connections
- types - Custom types that are reusable
- utils - Any shared utils
naming conventions will be <modulename>.<foldername>.ts
This backend system will be based on TDD (Test Driven Development) appraoch and its therefore required to write tests for different api's and ensure all tests are passing before being merged
Tests should be written in the test
folder while other codes are written in the src
folder
The configuration for migrations is made in the src/config/datasource.config.ts
Due to the new typeorm features follow below steps to run migrations
- Open the
src/config/datasource.config.ts
- Update the value of
synchronize
totrue
(This will automatically run current migrations) - Afterwards turn this value back to
false
- First ensure that the value
synchronize
insrc/config/datasource.config.ts
isfalse
- Create a new entity table in
src/lib/entities
- Run
yarn migration:generate <migrations directory/migration-name>
e.g.yarn migration:generate src/lib/migrations/create-user-entity
NB: To run the above migration follow the previous step on Running migrations
$ yarn install
# development
$ yarn start
# watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:cov
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.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.