Original based off the NodeTS Bootstrap repository.
This is a base NodeJS REST Auth TypeScript App built with express and all configurations files included.
This repository is meant to be a base to build on top of for building an API.
git clone https://github.com/codingwithmanny/nodets-rest-auth-bootstrap myproject;
cd myproject;
rm -rf .git;
git init;
git remote add origin https://github.com/your/newrepo;- NodeJS 12.18.1 or NVM
- Docker or Postgres Database
- MailGun account for emails
While in project directory:
0 - (Optional) NVM Installation
nvm install;1 - Install Depencies
yarn install; # npm install;2 - Start Database
Using Docker
docker run -it -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres --name nodetsdb postgres;3 - Setup ENV VARS
NOTE: Make sure to fill them with the correct ENV Variables
cp .env.example .env;and configure the correct DATABASE_URL
File: ./.env
DATABASE_URL="postgresql://postgres:secret@localhost:5432/postgres?schema=public"4 - Export Environment Variables
yarn env; # npm run env;5 - Run Migrations
yarn db:migrate; # npm run db:migrate;6 - Server Start
Development:
yarn dev; # npm dev;Production:
yarn start; # npm start;7 - (Optional) Seeding
yarn db:seed:all; # npm run db:seed:allBuild
yarn build; # npm run buildBuild & Serve
yarn start; # npm startAll Tests
yarn test; # npm run test;Jest Watch
yarn test:jest; # npm run test:jest;Jest Coverage
yarn test:coverage; # npm run test:coverage;Eslint
yarn test:lint; # npm run test:lintGuidelines for development
There is a checklist for creating a new migration:
- - Create new model in
./prisma/schema.prisma - - Double check that it adheres to the criteria
- -
yarn db:save; - -
yarn db:gen; - - Create new sed
yarn db:seed:genand modifyNEW.tswith nameModelNameSeed.ts - - Run migrations
yarn db:migrate - - Write tests
Create new models in the ./prisma/schema.prisma file.
Criteria:
- Singular:
UserNOTUsers - Camelcase capitalized
MyModelNOTmyModel
Example:
model ModelName {
id String @default(uuid()) @id
updated_at DateTime @default(now())
}