Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Main Server

Main backend server for all our web apps

Based on Nest Typescript Starter and WaveZync Nest Starter.

Installation

To run the application you need to have PostgreSQL installed.

pnpm install

Running the app

# development
$ pnpm start

# watch mode
$ pnpm start:dev

# debug mode
$ pnpm start:debug

# production mode
$ pnpm start:prod

Running the app with docker 🐳

With Docker you can run it easily. Now port 4000 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 the database we use PostgreSQL. For interacting with the database, we now use Kysely, a modern, type-safe SQL query builder for TypeScript.

We now also handle migrations using kysely-ctl, the official CLI tool for Kysely. Migration files are written in TypeScript and reside in the src/database/migrations directory.

Kysely will automatically map your snake_case names into camelCase on application side. Don't 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 generated 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.example

VS Code helpers

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

About

Server for Moonbase Studio

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages