Skip to content

recallwei/express-ts-starter-template

Repository files navigation

EST

English / 简体中文

EST (Express Starter Template) is an opinionated Express/TypeScript/Prisma/PostgreSQL starter template.

Features

  • Based on Express
  • TypeScript, of course
  • Prisma for ORM
  • JWT authentication and role based authorization
  • File service with multer
  • Fully configured logger with [Winston] and [Morgan]
  • Unit, Integration and E2E tests with [Jest] and [Supertest]
  • Linting with ESLint
  • Formatting with Prettier
  • Spelling check with cspell
  • Git commit management with Husky, lint-staged and commitlint
  • Containerised with Docker and Docker Compose
  • Absolute path with @/*

Tech Stack

Getting Started

GitHub Template

EST requires Node version >=14.16.0

Create a repo from this template.

Clone to Local

If you prefer to do it manually for a cleaner Git history, do the following:

npx degit recallwei/est my-est-app
cd my-est-app
pnpm i

Checklist

When using this template, try to update your own information correctly according to the checklist:

  • Clean up README.md
  • Change author name in LICENSE
  • Change project name, description, author, etc. in package.json
  • Modify environment variables in .env and delete the file .env.example which is an example of environment variables
  • Delete the example controller and route information in the src/routes directory

Notice

  • The file service will be saved in the ./storage directory by default, which is added to .gitignore by default. The directory can be reset by FILE_STORAGE_PATH in .env. Don't forget to add the storage directory to .gitignore to prevent the stored files from being uploaded to GitHub.

Usage

Environment

  • Node.js >=16.14.0
  • pnpm
  • PostgreSQL

Config Environment Variables

Config .env file, refer to .env.example.

Install

pnpm i

DB Migration

pnpm prisma:migrate
pnpm prisma:generate
pnpm prisma:seed

Start

pnpm dev

Build

pnpm build

Known Issue

  • chalk v5.x doesn't work with ts-node well, use chalk v4.x instead.
  • Use bcrypt.js instead of bcrypt to avoid dependencies installing.

License

MIT License © 2023 Bruce Song

About

Express TypeScript Starter Template is an opinionated Express/TypeScript/Prisma/PostgreSQL starter template.

Topics

Resources

License

Stars

Watchers

Forks