Skip to content

ngKisor/nestjs-starter

Repository files navigation

NestJs API Starter

Starter application for building APIs with Nest!

Prerequisites


Packages:

Setup

Clone the repository, install the dependencies and get started right away.

$ git clone --depth=1 [email protected]:ngKisor/nestjs-starter.git <application-name>
$ cd <application-name>
$ rm -rf .git
$ pnpm install

Make a copy of .env.example as .env and update your application details and database credentials.

Run the migrations and seed the database.

$ pnpm prisma:migrate
$ pnpm prisma:seed

Running the app

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

Navigate to http://localhost:8080/api/ to verify installation.

Using Docker

Using docker-compose

Use docker-compose to quickly bring up a stack with pre-configured Postgres database container. Data is ephemeral and containers will disappear when stack is removed.

Specific configuration for Docker is in .env.docker

  • 0.0.0.0 as $APP_HOST to expose app on Docker network interface
  • Pre-configured Postgres settings - can be updated to point to another Postgres host

Bring up stack,

$ docker-compose up

Navigate to http://localhost:8848/api-docs/ to verify application is running from docker.

Bring down stack,

$ docker-compose down

Test

# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov

Contributing

For contribution and feature requests, please create an issue first.

License

NestJs-Api-Starter is under MIT License.

About

nestjs starter for API development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published