Coder Social home page Coder Social logo

express-boilerplate's Introduction

Express TypeScript Boilerplate

This project serves as a boilerplate for setting up an Express backend application using TypeScript.

Project Structure

The project structure is organized as follows:

project-root/ │ ├── src/ │ ├── app.ts # Entry point for the application │ ├── config/ # Main configurations for the application │ │ ├── index.ts # Service for accessing configuration values │ │ ├── constants.ts # Where the variables are declared │ │ └── db/ # Logic for setting up the database │ │ └── index.ts # Class for connecting to the database │ │ └── config.ts # Class for configuring the database │ ├── infra/ # Logic for various implementations │ │ ├── database/ # database implementations │ │ └── logger/ # logger service │ ├── routes/ # Endpoint routes │ ├── models/ # Data models │ ├── controllers/ # Request handling logic │ └── services/ # Business logic services

Config

The config folder contains the main configurations for the application. The configService.ts file manages all configuration values, including environment variables. Database setup logic resides in the db subfolder.

Infra

The infra folder holds logic for various implementations. For example, connections to PostgreSQL and MongoDB are defined here. Additionally, infrastructure services like mailer services are placed in this folder.

Routes, Models, Controllers, and Services

  • Routes: Define endpoint paths and connect them to controllers.
  • Controllers: Handle incoming requests, manage request and response objects, and perform body payload validation.
  • Services: Implement business logic for the application.

Getting Started

Installation

  1. Clone this repository:
git clone https://github.com/sreerag-rajan/express-boilerplate.git

Install dependencies:

cd project-root
npm install

Running the Application

npm start

This command will compile the TypeScript code and start the Express server.

Configuration

Environment variables and other configurations can be set in the configService.ts file within the config folder. You can refer to .env.example to see what all env variables are present and need to be configured

express-boilerplate's People

Contributors

sreerag-rajan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.