Skip to content

thesopan21/express-typescript-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Production Ready Backend Setup (Express and Typescript)

Easily scaffold a production-ready backend application using Express (Node.js) and TypeScript. This tool helps you create a boilerplate project with best practices for scalability, maintainability, and security.

Prerequisites

Ensure you have the following tools installed in your system:

Usage

Scaffold your new Express TypeScript project in seconds

  1. Open your terminal and Run the following command:
    npx create-express-typescript
  2. Navigate to your project directory:
    cd your_app_name
  3. Start the development server:
    npm run dev

Project Structure

your_app_name/
    ├── src/
    │   ├── app.ts                     # Main application file
    │   ├── server.ts                  # Server configuration and entry file
    │   ├── database/
    │   │   └── connectToDatabase.ts   # MongoDB connection logic
    │   ├── routes/
    │   │   └── exampleRoute.ts        # Example route definitions
    │   ├── controllers/
    │   │   └── exampleController.ts   # Example controller logic
    │   ├── models/
    │   │   └── exampleModel.ts        # Example database model
    │   ├── middlewares/
    │   |    ├── errorHandler.ts        # Global error handling middleware
    │   |    └── logger.ts              # Logging middleware
    │   ├── utils/
    │   │   └── processEnvVaribale.ts   # process env varibales with type safety
    │   ├── types/
    │   │   └── envVariableTypes.ts     # env variable types
    |
    ├── tsconfig.json                   # TypeScript configuration
    ├── package.json                    # Project metadata and dependencies
    ├── .env                            # Environment variable configuration

Available Scripts

  • npm run dev: Starts the development server with hot reloading.
  • npm run build: Compiles TypeScript into JavaScript for production.
  • npm start: Runs the compiled JavaScript application.

License

This project is licensed under the MIT License.

Let me know if you'd like to include additional sections like "Contributing" or "FAQs"! 😊