All Projects โ†’ Saluki โ†’ Nestjs Template

Saluki / Nestjs Template

Licence: mit
Scaffold quickly your next TypeScript API with this opinionated NestJS template crafted for Docker environments

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nestjs Template

Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: โœญ 385 (+110.38%)
Mutual labels:  swagger, template
Express React Boilerplate
๐Ÿš€๐Ÿš€๐Ÿš€ This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: โœญ 32 (-82.51%)
Mutual labels:  jest, template
Koa Rest Api Boilerplate
๐Ÿ’ฏ Boilerplate for Node.js Koa RESTful API application with Docker, Swagger, Jest, CodeCov and CircleCI
Stars: โœญ 420 (+129.51%)
Mutual labels:  swagger, template
nestjs-auth-starter-kit
NestJS Auth Starter Kit (typescript / typeorm / swagger / passport / bcrypt)
Stars: โœญ 37 (-79.78%)
Mutual labels:  swagger, nestjs
Newschool Backend
Plataforma de ensino para pessoas carentes
Stars: โœญ 98 (-46.45%)
Mutual labels:  nestjs, jest
Nestjs Boilerplate
NestJS Boilerplate ๐Ÿ˜ป(Authentication, TypeORM, Configuration, Swagger)
Stars: โœญ 267 (+45.9%)
Mutual labels:  swagger, nestjs
Swagger
OpenAPI (Swagger) module for Nest framework (node.js) ๐ŸŒŽ
Stars: โœญ 734 (+301.09%)
Mutual labels:  swagger, nestjs
aws-nestjs-starter
Serverless, AWS, NestJS, GraphQL and DynamoDB starter
Stars: โœญ 200 (+9.29%)
Mutual labels:  jest, nestjs
React Native Template Typescript
๐Ÿ‘พ Clean and minimalist React Native template for a quick start with TypeScript.
Stars: โœญ 1,148 (+527.32%)
Mutual labels:  jest, template
Nestjs Redoc
๐Ÿ“˜ ReDoc frontend for you NestJS swagger API documentation
Stars: โœญ 54 (-70.49%)
Mutual labels:  swagger, nestjs
ahobsu-node-backend
๐ŸŒˆ MOTI ! Make Own True Identity โญ๏ธ ์œ ๋‹ˆํ์™€ ์œ ์ดˆ์ฝ”ํŒŒ์ด ๋…ธ๋“œ๋กœ ํƒˆ์ฃผํ•˜๋‹ค๐Ÿ˜Ž
Stars: โœญ 16 (-91.26%)
Mutual labels:  jest, swagger
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: โœญ 145 (-20.77%)
Mutual labels:  nestjs, jest
ack-nestjs-mongoose
NestJs Boilerplate. Authentication (OAuth2), Mongoose, MongoDB , Configuration, Multi Languages (i18n), etc. Advance Example ๐Ÿฅถ. NestJs v8 ๐Ÿฅณ๐ŸŽ‰. Production Ready ๐Ÿš€๐Ÿ”ฅ
Stars: โœญ 81 (-55.74%)
Mutual labels:  jest, nestjs
Jianshu
ไปฟ็ฎ€ไนฆnx+nodejs+nestjs6+express+mongodb+angular8+็ˆฌ่™ซ
Stars: โœญ 296 (+61.75%)
Mutual labels:  swagger, nestjs
zeldaPlay
A Single Page Application to help zeldaPlay players to track their characters and progress
Stars: โœญ 95 (-48.09%)
Mutual labels:  jest, nestjs
Nestjs Bff
A full-stack TypeScript solution, and starter project. Includes an API, CLI, and example client webapp. Features include production grade logging, authorization, authentication, MongoDB migrations, and end-to-end testing.
Stars: โœญ 450 (+145.9%)
Mutual labels:  nestjs, template
Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
Stars: โœญ 2,864 (+1465.03%)
Mutual labels:  swagger, template
ng-nest-cnode
Angular 10 Front-End and Nestjs 7 framework Back-End build Fullstack CNode
Stars: โœญ 17 (-90.71%)
Mutual labels:  jest, nestjs
Typescript Node Rest Starter
Simple starter template for building NODE REST API's using TypeScript
Stars: โœญ 50 (-72.68%)
Mutual labels:  swagger, jest
Nest Permissions Seed
A simple application demonstrating the basic usage of permissions with NestJS.
Stars: โœญ 121 (-33.88%)
Mutual labels:  swagger, nestjs

NestJS 7 API project template

License

Scaffold quickly your next NestJS 7 API project with โค๏ธ using this template

  • Crafted for Docker environments (Dockerfile support and environment variables)
  • REST API with TypeORM support
  • Swagger documentation, Joi validation, Winston logger, ...
  • Folder structure, code samples and best practices

1. Getting started

1.1 Requirements

Before starting, make sure you have at least those components on your workstation:

  • An up-to-date release of NodeJS and NPM
  • A database such as MariaDB, MySQL or PostgreSQL. You may use the provided docker-compose file.

Docker may also be useful for advanced testing and image building, although it is not required for development.

1.2 Project configuration

Start by cloning this project on your workstation.

git clone https://github.com/saluki/nestjs-template my-project

The next thing will be to install all the dependencies of the project.

cd ./my-project
npm install

Once the dependencies are installed, you can now configure your project by creating a new .env file containing your environment variables used for development.

cp .env.example .env
vi .env

For a standard development configuration, you can leave the default values for API_PORT, API_PREFIX and API_CORS under the Api configuration section. The SWAGGER_ENABLE rule allows you to control the Swagger documentation module for NestJS. Leave it to 1 when starting this example.

Next comes to the TypeORM configuration: change everything according to your own database setup. It may be also useful to turn TYPEORM_SYNCHRONIZE to true in order to avoid migrations during the development phase. Do not modify the values in the TypeORM internals section, unless you change the folder structure.

Last but not least, define a JWT_SECRET to sign the JWT tokens or leave the default value in a development environment.

1.3 Launch and discover

You are now ready to launch the NestJS application using the command below.

# Perform migrations in your database using TypeORM
npm run migration:run

# Launch the development server with TSNode
npm run dev

You can now head to http://localhost:4000/docs and see your API Swagger docs. The example passenger API is located at the http://localhost:4000/api/v2/passengers endpoint.

2. Project structure

This template was made with a well-defined directory structure.

src/
โ”œโ”€โ”€ migrations/  # TypeORM migrations created using "npm run migration:create"
โ”œโ”€โ”€ modules
โ”‚   โ”œโ”€โ”€ app.module.ts
โ”‚   โ”œโ”€โ”€ common/  # The common module contains pipes, guards, service and provider used in the whole application
โ”‚   โ”œโ”€โ”€ passenger/  # A module example that manages "passenger" resources
โ”‚   โ”‚   โ”œโ”€โ”€ controller/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ passenger.controller.ts
โ”‚   โ”‚   โ”œโ”€โ”€ flow/  # The "flow" directory contains the pipes, interceptors and everything that may change the request or response flow
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ passenger.pipe.ts
โ”‚   โ”‚   โ”œโ”€โ”€ model/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ passenger.data.ts  # The model that will be returned in the response
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ passenger.entity.ts  # The actual TypeORM entity
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ passenger.input.ts  # The model that is used in the request
โ”‚   โ”‚   โ”œโ”€โ”€ passenger.module.ts
โ”‚   โ”‚   โ”œโ”€โ”€ service/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ passenger.service.ts
โ”‚   โ”‚   โ””โ”€โ”€ spec/
โ”‚   โ””โ”€โ”€ tokens.ts
โ””โ”€โ”€ server.ts

3. Default NPM commands

The NPM commands below are already included with this template and can be used to quickly run, build and test your project.

# Start the application using the transpiled NodeJS
npm run start

# Run the application using "ts-node"
npm run dev

# Transpile the TypeScript files
npm run build

# Internal command used during the Docker build stage
npm run build:docker

# Run the project' functional tests
npm run test

# Lint the project files using TSLint
npm run lint

# Create a new migration named MyMigration
npm run migration:create [MyMigration]

# Run the TypeORM migrations
npm run migration:run

# Revert the TypeORM migrations
npm run migration:revert

4. Project goals

The goal of this project is to provide a clean and up-to-date "starter pack" for REST API projects that are built with NestJS.

5. Roadmap

The following improvements are currently in progress :

  • [x] Configuration validation
  • [ ] Dockerfile improvements and better usage of environment variables
  • [x] Project structure documentation
  • [x] TypeORM migration support
  • [ ] Healtcheck support
  • [ ] Better logging configuration with environment variables
  • [ ] Working further on examples for production instructions

6. Contributing

Feel free to suggest an improvement, report a bug, or ask something: https://github.com/saluki/nestjs-template/issues

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].