/node-express-prisma-v1-official-app

Official real world application built with Node + Express + Typescript + Prisma

Primary LanguageTypeScriptMIT LicenseMIT

Rails Example App

Official NodeJS codebase that adheres to the RealWorld API spec.

This repo is functionality complete.

Deploy to Heroku

Deploy

Getting started

Clone the repository

run git clone https://github.com/gothinkster/node-express-prisma-v1-official-app.git

Install the dependancies

NodeJS is required

cd node-express-prisma-v1-official-app
npm install

Download pgAdmin for PostgreSQL

PostgreSQL downloads page

Create a server

run pgAdmin
create a server (Object/Create/Server)
required fields:

  • name
  • HOST name/address

Connect the created server

create a .env file at the root of the project
populate it with the url of your database

DATABASE_URL="postgresql://<username>:<password>@<host_name>:<port>/<database_name>?schema=public"

Run the project locally

run npm run dev

Advanced usage

Prisma

Format the Prisma schema

npm run prisma:format

Migrate the SQL schema

prisma migrate dev --name added_job_title

Update the Prisma Client

npm run prisma:generate

with watch option

npm run prisma:generate:watch

Seed the database

npm run prisma:seed

Launch Prisma Studio

npm run prisma:studio

Reset the database

  • Drop the database
  • Create a new database
  • Apply migrations
  • Seed the database with data
npm run prisma:reset