Skip to content

A TypeScript-based boilerplate for creating a web application using the Express framework and the Sequelize ORM.

License

Notifications You must be signed in to change notification settings

beerjoa/express-sequelize-ts

Repository files navigation

express-sequelize-ts

ESTS

Version GitHub Actions Status License Github issues GitHub last commit GitHub top language

Node.js TypeScript Express Docker SQLite Sequelize Jest ESLint Prettier

Introduction

ESTS (express-sequelize-ts) is a TypeScript-based boilerplate that enables the creation of web applications using the Express framework and Sequelize ORM.

Technology Stacks

  • 🟦 TypeScript - A strongly typed programming language that builds on JavaScript.
  • 🌐 Node.js - An asynchronous event-driven JavaScript runtime.
  • 🚚 Express - A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
  • 💾 Sequelize - A promise-based Node.js ORM tool for various Relational database.
  • 📚 TypeStack - A decorator-based frameworks and libraries for Node and browser.
  • 🛠 Jest - A delightful JavaScript Testing Framework focusing on simplicity.
  • 🚧 ESLint - An open-source project that helps to find and fix problems with the project's JavaScript code.
  • 🎨 Prettier - An opinionated code formatter supporting the project's code.
  • 🐳 Docker - A platform designed to help developers build, share, and run container applications.

Development Features

  • 🚫 JWT authentication, to ensure secure access to the API.
  • 🎢 A Layered architecture (Controller, Service, Repository, Model).
  • 📦 Dependency injection for better code organization.
  • 📝 Swagger for API documentation and testing.
  • ♻️ Data Transport Object (DTO) to validate request and response data.

Requirements

  • Node 18.12.x
  • Yarn
  • SQLite (or any other database supported by Sequelize)
  • Docker (optional)

Getting Started

Run the following commands to set environment variables and install dependencies:

set environment variables

## set environment variables
#### make .env.{NODE_ENV} file using .env.example file
#### EX) .env.development | .env.test
$ cp .env.example .env.development

install dependencies

## install dependencies
#### using yarn
$ yarn install

#### using Docker
$ yarn docker:build

then, you can run locally in development and test mode:

## run locally in development and test mode
#### using yarn
$ yarn dev | test:integration | test:unit:all | test:unit {path}

#### using Docker
$ yarn docker:dev | docker:test

call test API endpoints:

// http://localhost:3000/api
// Content-Type: application/json
{
  "message": "Hello World"
}

Deploy to production

you can deploy to production using yarn or Docker:

## using yarn
$ yarn build
$ yarn start

## using Docker
$ yarn docker:prod

What's next?

  • Add unit test
  • Add integration test
  • Add docker-compose
  • Add swagger
  • Write more specific documentation
  • Develop a new feature

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A TypeScript-based boilerplate for creating a web application using the Express framework and the Sequelize ORM.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published