A boilerplate for building RESTful APIs using Node.js, TypeScript, Express, and Prisma.
- Node version
18.0.0
or above - A PostgreSQL database server running
$ git clone --depth 1 git@github.com:rahimratnani/express-typescript-starter.git
$ cd express-typescript-starter
$ npx rimraf ./.git
$ npm install
$ cp .env.example .env
# open .env and modify the environment variables
Environment variables:
PORT
: Your node server will run on this port. Default is 3000NODE_ENV
: Default isdevelopment
DATABASE_URL
: Connection URL of PostgreSQL
$ npx prisma migrate dev
This command will,
- Create a new PostgreSQL database with
User
andPost
tables that are defined insrc/prisma/schema.prisma
- Trigger seeding. The seed file in
src/prisma/seed.ts
will be executed and the database will be populated with the sample data.
$ npm run dev