express-mvc-ts Template

A TypeScript backend template following the MVC (Model-View-Controller) pattern with Express.js. Includes structured folders for models, controllers, routes, services, middlewares, and utilities — ideal for organized and scalable backend projects.


When to Use

  • You want an Express server with TypeScript.
  • Prefer a classic MVC architecture for clear separation of concerns.
  • Suitable for medium to large projects with multiple routes, controllers, and models.
  • Ideal for maintainable, organized, and scalable backend development.

Installation

Scaffold the template using Servest:

Loading code snippet…

This will create a new project in the servest-project folder with all required files.

For detailed installation instructions, see the create-servest guide


Run Commands

Start in development mode (auto-reloads on changes using tsx)

Loading code snippet…

Start in production mode

Loading code snippet…

The server will run on the port specified in .env (default: 3000).


Folder Structure

express-mvc-ts

src/app.ts

Loading code snippet…

src/server.ts

Loading code snippet…

src/app/config/index.ts

Loading code snippet…

Pre-installed Packages

PackagePurpose
expressCore server framework
corsEnable Cross-Origin Resource Sharing
dotenvLoad environment variables
express-error-toolkitHandles All Express Errors
http-status-toolkitStandard HTTP status codes
@types/cors (devDependency)Type definitions for CORS
@types/express (devDependency)Type definitions for Express
@types/node (devDependency)Type definitions for Node.js
ts-node (devDependency)Execute TypeScript files directly
tsx (devDependency)Run TypeScript files with modern Node.js
typescript (devDependency)TypeScript compiler and utilities

Try It Online

Click the link to open the template in StackBlitz, edit code, and run the server instantly in your browser:

Open express-mvc-ts on StackBlitz