Skip to content

beevk/ts-express-postgres

Repository files navigation

TS-Express-PostgreSQL Boilerplate

Dependency Status devDependency Status Github issues Github Discussions


Express API Boilerplate

A ready-to-use boilerplate for REST API Development with Node.js, Express, TypeScript and PostgreSQL.

typescript typescript typescript

Features

Libraries

This boilerplate uses the following libraries and tools:

Core Dependencies

Dev Dependencies

ToDos

  • Prettier with EsLint
  • Setup test env.
  • Sentry or Datadog for error logs
  • Prisma & Database setup
  • DI
  • Zod
  • Docker
  • Github actions - CI / CD

Directory Structure (todo)

.
├── .husky                      # Github hooks for husky
├── build                       # Built, ready-to-serve app.
├── config                      # Root folder for configurations.
│   └── index.ts                # App configurations.
├── node_modules                # Node Packages.
├── source                      # Source code.
│   ├── bootstrap               # Root folder for bootstrapping the app.
│   │   ├── index.ts            # Sets up basic middleware
│   │   └── db.config.ts        # Sets up DB
│   ├── route                   # Folder for app routes.
│   │   └── index.ts            # Root level routes
│   ├── interface               # Folder for interfaces.
│   │   └── user.interface.ts   # User interface
│   ├── service                 # Folder for services.
│   │   ├── index.ts            # Common place to export other services
│   │   └── auth.service.ts     # Auth service layer
│   └── middleware              # Folder to hold all middleware functions
│       └── logging.ts          # Middleware for logging into console.
├── .dockerignore               # Tells docker which files to ignore.
├── .gitignore                  # Tells git which files to ignore.
├── .prettierignore             # Tells prettier which files to ignore
├── .eslintrc.js                # Eslint configuration
├── .prettierrc                 # Prettier configuration
├── commitlint.config.js        # commitlint configuration for husky
├── Dockerfile                  # Dockerfile.
├── LICENSE                     # License file
├── package.json                # Package configuration.
├── package-lock.json           # Package lock
├── README.md                   # This file
└── tsconfig.json               # TypeScript transpiler configuration.

Installation

You can clone from this repository and use the main branch.

$ git clone https://github.com/beevk/ts-express-postgres.git projectName
$ cd projectName
$ npm i

Usage

All commands default to the development environment. You can set NODE_ENV to production or use the shortcuts below.

# Running

$ npm run dev # This starts the app in development mode

# Starting it with the production build (todo)
$ NODE_ENV=production npm run start # or

# Building (todo)
$ npm run build # This builds the app in development mode

# Commands below builds the production build (todo)
$ NODE_ENV=production npm run build # or
$ npm run build:prod

# Testing (todo)
$ npm run test

# Testing with watch mode(todo)
$ npm run test:watch

# Too check test coverage (todo)
$ npm run coverage

License

This boilerplate is released under the MIT license.


About

Express REST API boilerplate for starting projects quick and easy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published