Code Monkey home page Code Monkey logo

midoahmed / nestjs-api-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
123.0 1.0 27.0 1.07 MB

Nestjs API Boilerplate ๐Ÿ˜ ๐Ÿ’ช ๐Ÿ”ฅ : Typescript, Postgresql, TypeORM, Swagger for Api documentation, Passport-JWT authentication, Jest, Env configuration, Migrations, Seeds, Docker, Redis, AWS S3, and best application architecture.

JavaScript 1.18% TypeScript 97.00% Dockerfile 0.36% Shell 1.45%
nestjs typescript swagger typeorm seeds docker postgres passport-jwt-authentication jest docker-compose

nestjs-api-boilerplate's Introduction

Logo

NestJS API Boilerplate

Nestjs API Boilerplate: Typescript, Postgresql, TypeORM, Swagger for Api documentation, Passport-JWT authentication, Jest, Env configuration, Migrations, Seeds, Docker, most popular node js libraries, and best application architecture.

This is an a personal effort made with love to setup this architecture and dev environment for new node projects using NestJS.

Getting started (development envioroment) ๐Ÿ‘๐Ÿ‘๐Ÿ‘

# 1. Clone the repository or click on "Use this template" button.
git clone https://github.com/MidoAhmed/nestjs-api-boilerplate nestjs-api-boilerplate

# 2. Enter your newly-cloned folder.
cd nestjs-api-boilerplate

# 3. Install dependencies.
npm i

# 4. fill in default.yml.example and development.yml.example files and rename it to default.yml and development.yml

# 5. Run docker containers
npm run docker:up
# you can verify your DB by opening http://localhost:8080 (Adminer)

# 6. Run development server 
npm run start:dev 
# access swagger api doc by opening http://localhost:3000/docs
๐Ÿฅณ๐Ÿฅณ๐Ÿฅณ

# 7. Read the documentation linked below for "Setup and development" (Sorry ! it is not yet available).

Deploy (production envioroment) ๐Ÿ‘๐Ÿ‘๐Ÿ‘

# 1. fill in .env.example file and rename it to .env 

# 2. Enter your project folder.
cd nestjs-api-boilerplate

# 2. Install dependencies.
sh scripts/deploy.prod.sh 

# 3. Enjoy it ๐Ÿฅณ๐Ÿฅณ๐Ÿฅณ  you have your api up ! ๐Ÿ˜Œ

# NB : ๐Ÿค” to shut down production 
sh scripts/down.prod.sh

Features

Quick scaffolding
Create modules, services, controller - right from the CLI!
Developer friendly
Enjoy the best Developer eXperience.
JWT Authentication
Installed and configured JWT authentication.
Next generation Typescript
Always up to date typescript version.
best application architecture
Empowered with best practices facilitating the development of scalable server-side applications
Environment Configuration
development, staging and production environment configurations
Swagger Api Documentation
Already integrated API documentation. To see all available endpoints visit http://localhost:3000/docs
Seeding Database
Awesome way to seed test data into your database using typeorm-seeding
Migrations
Already provided and configured npm script commands to run our migration process, see 'migrations.doc.txt'
Caching
high performance data access using Redis store
Documentation
Already setup Compodoc
Production grade logging system
Setup an external logger for production grade logging system - winston
AWS S3
AWS SDK used for S3, tested with MinIO Server
Linter
tslint + eslint + prettier = โค๏ธ

WIP/Comming Features

TypeScript source code Documentation
Use a documentation generator for TypeScript projects such as or other alternative - https://typedoc.org/

Documentation [Sorry ! it is not yet available]

This project includes a docs folder with more details on:

  1. Setup and development
  2. Architecture

nestjs-api-boilerplate's People

Contributors

midoahmed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nestjs-api-boilerplate's Issues

Multiple repositories in the same module

Hello,

Thank you for this awesome boilerplate. However I have a question about the architecture of the repositories, right now in this project, there is a UserEntity and to perform actions on it you are using repositories. You have one UserRepository which gives access to the UserEntity in the user modules, but you have an AuthRepository in the auth module which also relies on the UserEntity.

So my question is, how would you do if you need to access other entities in the same module ?

For example, imagine there is a PostEntity, and you'd like to access it in the auth module, I don't know if my concern is clear enough, let me know if I have to provide more details.

Would you just create one repository per entity in each module instead of sharing one between all the modules, is that a good practise ?

Thanks in advance for your answer !

Best regards,
Lucien

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.