Skip to content

csezain/nodejs-express-ts-boilerplate

Repository files navigation

Brinate Car Rental Backend

A TypeScript Express.js backend application for the Brinate Car Rental platform.

Features

  • Express.js - Fast, unopinionated web framework
  • TypeScript - Type-safe JavaScript
  • CORS - Cross-Origin Resource Sharing support
  • Environment Configuration - Zod-validated environment variables
  • Development Tools - ESLint, Prettier, and TypeScript compiler

Prerequisites

  • Node.js (v20 or higher)
  • npm

Installation

  1. Clone the repository

  2. Install dependencies:

    npm install
  3. Copy the example environment file:

    cp .env.example .env
  4. Configure your environment variables in .env:

    NODE_ENV=development
    PORT=3000
    ORIGINS=http://localhost:3000,http://localhost:3001

Environment Variables

Variable Description Default Required
NODE_ENV Environment mode development No
PORT Server port 5000 No
ORIGINS CORS allowed origins (comma-separated) - Yes

Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Build the project for production
  • npm run start - Start production server
  • npm run start:prod - Build and start production server
  • npm run lint - Run ESLint
  • npm run lint:fix - Fix ESLint errors
  • npm run format - Format code with Prettier
  • npm run format:check - Check code formatting
  • npm run clean - Remove build directory
  • npm run type-check - Run TypeScript type checking

Development

Start the development server:

npm run dev

The server will start on the configured port (default: 3000) with hot reload enabled.

Production

Build and start the production server:

npm run start:prod

Project Structure

src/
├── app.ts              # Express app configuration
├── server.ts           # Server entry point
└── config/
    ├── index.ts        # Main config export
    └── env/
        └── index.ts    # Environment variable validation

License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors