Code Monkey home page Code Monkey logo

awesome-api's Introduction

TFD Logo

A Nest.js boilerplate by TFD for building scalable API.


NPM Version Package License YouTube Channel Subscribers
ABA TFD Logo

Scalable NestJS v8 Boilerplate Nest Logo

Features

This is a NestJS boilerplate code with preconfigured libraries and packages with the following features:

  • One-click setup with Docker
  • Typeorm for Object–relational mapping, use Postgres DB by default
  • Sample data generation with typeorm-fixture (generate fixture based on .yaml file), visit RobinCK/typeorm-fixtures.
  • Preconfigured Caching Mechanism (Redis Store)
  • Swagger UI (Express)
  • Authentication with JWT
  • Basic RBAC implementation ( You'll have to attach user object to your request manually )
  • Basic request time logger

Setup Guide

Be aware that putting DB_SYNC to true in your production may result in irreversible data lost. DB_SYNC should only be put to true in development to skip the necessity of doing migrations.

Without Docker

  • Create .env file with command cp .env.example .env and replace with your own env variable
  • yarn install
  • yarn start (Your API will be exposed through port 3000)

With Docker

Run the following scripts for UNIX (Mac,Linux)

$ cp .env.example .env
$ docker-compose up -d

DOS(Windows)

$ copy .env.example .env
$ docker-compose up -d

Available Services with Docker Container

Once you managed to run the docker container, the following service will be available:

Migration Guide

New migration with typeorm-cli:

$ docker exec -it tfd-nest yarn migration:create -n {CreateTable}

Migration file will be inside src/migrations. Note that you will have to write migration code inside up and down method on your own. To generate migration for new database or from the changes in database schema(entities) use:

$ docker exec -it tfd-nest yarn migration:generate -n {GenerateTable}

Run Migrations

$ docker exec -it tfd-nest yarn migration:run

Revert Migrations

$ docker exec -it tfd-nest yarn migration:revert

Generate Fixture

Fixture lets you play around with sample data. It's not recommended generating in production since it may erase real data. visit RobinCK/typeorm-fixtures for more info.

Generate Sample Data

Make sure the docker container is running

$ docker exec -it tfd-nest yarn fixture:generate

Donation

Kindly donate to the following bank account (Cambodia) if you want to support our works.

TFD Logo

KHEANG KIM ANG

001 821 043

You can also donate with Visa Direct.

TFD Logo

4026 4503 2163 1102

awesome-api's People

Contributors

tfd-ed avatar

Stargazers

Lim Meng Ty avatar

Watchers

 avatar

Forkers

sopheaktraleng

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.