https://github.com/codingwithmanny/nodets-rest-auth-bootstrap
Bootstrap NodeJS TypeScript REST Auth API with Prisma and Postgres implementation. Copy this for your next project.
https://github.com/codingwithmanny/nodets-rest-auth-bootstrap
nodejs postgres postman prisma rest-api typescript
Last synced: 7 months ago
JSON representation
Bootstrap NodeJS TypeScript REST Auth API with Prisma and Postgres implementation. Copy this for your next project.
- Host: GitHub
- URL: https://github.com/codingwithmanny/nodets-rest-auth-bootstrap
- Owner: codingwithmanny
- Created: 2020-07-03T15:50:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-25T09:04:05.000Z (about 3 years ago)
- Last Synced: 2025-08-04T06:55:49.578Z (8 months ago)
- Topics: nodejs, postgres, postman, prisma, rest-api, typescript
- Language: TypeScript
- Homepage: https://github.com/codingwithmanny/nodets-rest-auth-bootstrap
- Size: 110 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](https://github.com/codingwithmanny/nodets-rest-auth-bootstrap/blob/master/package.json)
[](https://github.com/codingwithmanny/nodets-rest-auth-bootstrap/actions/runs/163925691)
[](https://codecov.io/gh/codingwithmanny/nodets-rest-auth-bootstrap)
# NodeTS REST Auth Bootstrap
Original based off the
[NodeTS Bootstrap](https://github.com/codingwithmanny/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.
## Copy This App
```bash
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;
```
## Requirements
- NodeJS 12.18.1 or NVM
- Docker or Postgres Database
- MailGun account for emails
## Local Setup
While in project directory:
**0 - (Optional) NVM Installation**
```bash
nvm install;
```
**1 - Install Depencies**
```bash
yarn install; # npm install;
```
**2 - Start Database**
Using `Docker`
```bash
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
```bash
cp .env.example .env;
```
and configure the correct `DATABASE_URL`
**File:** `./.env`
```bash
DATABASE_URL="postgresql://postgres:secret@localhost:5432/postgres?schema=public"
```
**4 - Export Environment Variables**
```bash
yarn env; # npm run env;
```
**5 - Run Migrations**
```bash
yarn db:migrate; # npm run db:migrate;
```
**6 - Server Start**
`Development:`
```bash
yarn dev; # npm dev;
```
`Production:`
```bash
yarn start; # npm start;
```
**7 - (Optional) Seeding**
```bash
yarn db:seed:all; # npm run db:seed:all
```
## Production Commands
`Build`
```bash
yarn build; # npm run build
```
`Build & Serve`
```bash
yarn start; # npm start
```
## Tests
`All Tests`
```bash
yarn test; # npm run test;
```
`Jest Watch`
```bash
yarn test:jest; # npm run test:jest;
```
`Jest Coverage`
```bash
yarn test:coverage; # npm run test:coverage;
```
`Eslint`
```bash
yarn test:lint; # npm run test:lint
```
## Development
Guidelines for development
### New Migration
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:gen` and modify `NEW.ts` with name
`ModelNameSeed.ts`
- [ ] - Run migrations `yarn db:migrate`
- [ ] - Write tests
Create new models in the `./prisma/schema.prisma` file.
**Criteria:**
- Singular: `User` _NOT_ `Users`
- Camelcase capitalized `MyModel` _NOT_ `myModel`
**Example:**
```prima
model ModelName {
id String @default(uuid()) @id
updated_at DateTime @default(now())
}
```