The web's most popular back-end framework template for building web api with Express.
- Module based directory structure.
- Example Postman collection.
- Pre-configured with Postgres using Prisma ORM
- Pre-configured with code quality tool: TypeScript.
- Pre-configured with Alias Import
import { ... } from '@module/...'
📜.env # Set Environment Variables here
📜.gitignore # Git ignore file
📂src # Main Project folder / Source folder
┣ 📂api # API folder container all versions of API
┃ ┗ 📂v1 # API version 1
┃ ┃ ┣ 📂config # Config folder configuration files
┃ ┃ ┃ ┣ 📜index.ts # Export all child config files
┃ ┃ ┃ ┗ 📜prisma.config.ts # Prisma Client configuration file
┃ ┃ ┣ 📂controller # Controller folder contain model based controllers.
┃ ┃ ┃ ┗ 📜user.controller.ts # model based controller
┃ ┃ ┣ 📂interfaces # Interfaces folder contain model based interfaces and types.
┃ ┃ ┃ ┣ 📜index.ts # `index.ts` contain global interfaces
┃ ┃ ┃ ┗ 📜user.interface.ts # model based interface
┃ ┃ ┣ 📂middleware # Middleware folder contain model based middleware
┃ ┃ ┣ 📂prisma # Prisma entry point
┃ ┃ ┃ ┗ 📜schema.prisma # Prisma schema declaration file
┃ ┃ ┣ 📂routes # Routes contain model based routes
┃ ┃ ┃ ┣ 📜index.ts # Export root router containing all child routes.
┃ ┃ ┃ ┗ 📜user.route.ts # model based route
┃ ┃ ┗ 📂services # Services contain model based services
┃ ┃ ┃ ┗ 📜user.service.ts # model based service
┃ ┃ ┣ 📂utils # Utils contain utility functions.
┃ ┃ ┗ 📂validators # Validators contain model based validators
┗ 📜app.ts # Entry point of server
📜tsconfig.ts # Typescript configuration file
📜package.json # NPM dependencies listing file
- Clone it, Install project dependencies
-
git clone https://github.com/OmarFaruk-0x01/express-typescript-starter cd ./express-typescript-starter npm install
-
- Update the environment variables found in
.env
,-
PORT=4000 DATABASE_URL=... # Your Database Provider Connection URL
-
- Generate Prisma Client and Create a migration.
-
npm run prisma:gen npm run prisma:migrate
-
- Start hacking...
-
npm run dev
-
The app will become available at http://localhost:4000.
-
# Launches the server in development mode on http://localhost:4000/ npm run dev
-
# Compiles and bundles the app for deployment npm run build
-
# Clear compiled files from `build` folder npm run build:clean
-
# Clear full `build` folder npm run build:cleanAll
-
# Generate Model for Prisma Client npm run prisma:gen
-
# Migrate model with database npm run prisma:migrate
-
# Open Prisma studio npm run prisma:studio