Base Express server template with Prisma ORM (v3), routing-controllers, JWT authentication & TypeScript
- TypeScript
- Prisma ORM
- Routing controllers
- JWT Authentication
- Authorization and roles
- Eslint
- Prettier
- DTO pattern
- Validations
- Global error handler
- Dotenv config
📦src # Main folder of code
┣ 📂controllers # Folder for handlers functions called from routes
┣ 📂dtos # DTO pattern for handling data
┣ 📂exceptions # Global handle error
┣ 📂interfaces # Interfaces for greater abstraction
┣ 📂middleware # Folder for express middlewares
┣ 📂server # Express server instance with routing-controllers config
┣ 📂services # Services for write core code bussiness
┣ 📂utils # Utils for usage in the application
┗ 📜app.ts # Main file
Install required packages with
npm install
or
yarn install
Create an .env
file and setup the variables
cp .env.example .env
Migrate with prisma in order to create the required database tables
npx prisma migrate deploy
or
yarn prisma migrate deploy
While editing your code, you probably want to automatically build your application and watch for changes with nodemon, in order to achieve that, just run npm run dev
and npm run dev:watch
or yarn dev
and yarn dev:watch
Build your application with npm run build
or yarn build
and then run it with node start
or yarn start
David Rodarte
- Website: https://davidrodarte.vercel.app
- Github: @DavidRodarte
MIT