All Templates / Starters
NestJs Generic Template
A fast, scalable, easy to use, extensible monolith backend using NestJs+TS
Postgres
railwayapp-templates/postgres-ssl:latest
Just deployed
/var/lib/postgresql/data
nestjs-generic
allen-n/nestjs-generic
Just deployed
This is a generic nestjs backend that can be used to create a backend for any project - from high performance, multi-tenant APIs to basic B2C apps and any CRUD application in between.
It can be deployed anywhere that you can deploy a docker container, and hooked up to any postgres database provider. It also includes instructions and configuration for easy local debugging.
If you're using vscode, you can use the Start Debug Server
config, which will:
Otherwise, just run docker compose up db adminer
to spin up the database and adminer containers, and then run npm run start:dev
to start the API in dev mode (and docker compose down
to spin down the containers when you're done).
These instructions are cribbed from here.
docker compose up db
To build everything, omit db
, which will spin up the server and adminer db UI, all in the docker container. To include adminer but not turn on the server in the container, add adminer
(i.e. docker compose up db adminer
).
If you need to rebuild a container, run the following command:
docker compose up --build # omit container name to rebuild all
To remove old containers:
docker compose down # removes all containers
docker compose down --volumes # Remove containers and volumes
See best practices from prisma here.
Overview:
prisma/schema.prisma
.npm run prisma:debug
to test the change on the local database (or run npx prisma db push
).prisma:debug
command to test them.git stash
to stash the changes you made to the schema and run prisma:debug
once more go go back to what you had. Then git stash pop
to get the changes back (which you know work, due to your prototyping in steps 1-4).npm run prisma:dev
(or npx prisma migrate --name
) create a migration that creates the changes. You can skip step 5, but that will create drift in the database that will force you to reset it completely.Template Content
nestjs-generic
allen-n/nestjs-genericJWT_ACCESS_SECRET
Random secure secret for generating access JWTs. If changed, will invalidate existing issued access tokens.
JWT_REFRESH_SECRET
Random secure secret for generating refresh JWTs. If changed, will invalidate existing issued refresh tokens.
Details
Created on Sep 27, 2023
194 total projects
81 active projects
64% success on recent deploys
TypeScript, Dockerfile, JavaScript
Starters
More templates in this category
TanStack + React Starter
A barebones TypeScript React starter with TanStack Router & Query setup
Kyle Gill
20