GithubHelp home page GithubHelp logo

wavezync / nestjs-starter Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 3.0 2.14 MB

Start your NestJS project quickly

License: MIT License

JavaScript 1.35% Dockerfile 1.10% TypeScript 97.36% Procfile 0.18%
nestjs nestjs-backend nestjs-starter-template nestjs-postgres nestjs-boilerplate nestjs-module postgresql jwt jwt-authentication class-validator

nestjs-starter's Introduction

WaveZync NestJS Starter

Description

Nest framework TypeScript starter repository.

In this starter you may find a working application pre configured with the PostgreSQL and JWT Auth.

Please go through Nest Docs before playing with the code.

Installation

To run the application you need to have PostgreSQL installed.

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# debug mode
$ npm run start:debug

# production mode
$ npm run start:prod

Running the app with docker ๐Ÿณ

With Docker you can run it easily. Now port 3000 will be open and 9229 can be connected to debugger as well.

PostgreSQL is exposed via 5432 port.

$ docker-compose up

Project Setup

The project setup follows standard NestJS conventions. Checkout NestJS docs for more.

Directory structure

Directory structure follows module based on features.

src
โ”œโ”€โ”€ @types # type defs goes here
โ”œโ”€โ”€ common # common stuffs
โ”‚   โ”œโ”€โ”€ decorators # custom decorators
โ”‚   โ”œโ”€โ”€ dto # common DTOs
โ”‚   โ”œโ”€โ”€ exceptions # exceptions
โ”‚   โ”œโ”€โ”€ filters # filters for app
โ”‚   โ””โ”€โ”€ guards # guards for app
โ”œโ”€โ”€ config # app config
โ”œโ”€โ”€ database # database module
โ”‚   โ”œโ”€โ”€ migrations # db migrations
โ”‚   โ””โ”€โ”€ stubs # migration/seed stubs
โ””โ”€โ”€ modules # modules of app
    โ”œโ”€โ”€ auth # auth module
    โ”‚   โ””โ”€โ”€ dto
    โ”œโ”€โ”€ health # health module
    โ””โ”€โ”€ user # user module
        โ”œโ”€โ”€ dto
        โ””โ”€โ”€ entities

Database and ORM

For database we have used PostgreSQL. And for ORM we have used Knex.js with ObjectionJS.

Knex is an awesome query builder which is closer to SQL. Objection also a thin wrapper around Knex.

For all database migrations please use snake_case conversion when creating tables or columns. In PostgreSQL it is natural to work with snake_case when writing queries.

Knex will automatically map your snake_case names into camelCase on application side. Dont use snake_case in JS side. Instead always use camelCase. Read more

Please change the database name in docker-compose file and .env

Api Docs

Api docs can be geneated thanks to @nestjs/swagger package. Since we are using cli plugin you can comment your Dtos with JSDocs and the documentation will be done automatically. Please follow conventions mentioned here

Environment variables

Env Variable Description example
SECRET Secret for JWT somesecret
DATABASE_URL PostgreSQL connection string postgres://admin:admin@localhost:5432/wavezync
LOGGER_LEVEL Level of logger info
LOGGER_FORMAT Format for logging pretty or json

VS Code helpers

You can find helpers by pressing CTRL + SHIFT + P in VSCode

nestjs-starter's People

Contributors

imesh7 avatar kasvith avatar samaratungajs avatar

Stargazers

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

Watchers

 avatar  avatar

nestjs-starter's Issues

Add recommended VSCode extensions

{
  "recommendations": [
    "aaron-bond.better-comments",
    "coenraads.bracket-pair-colorizer-2",
    "wmaurer.change-case",
    "oouo-diogo-perdigao.docthis",
    "dbaeumer.vscode-eslint",
    "abhijoybasak.nestjs-files",
    "eg2.vscode-npm-script",
    "christian-kohler.path-intellisense",
    "42crunch.vscode-openapi",
    "esbenp.prettier-vscode",
    "wayou.vscode-todo-highlight",
    "ashinzekene.nestjs",
    "deerawan.vscode-faker"
  ]
}

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.