Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

JHyeok/jaebook-server

Repository files navigation

❯ JaeBook Server

Using TypeScript and Express.

Frontend : JaeBook Client

Article

Project Features

  • Express with TypeScript
  • Structure Beautiful structure of controller, service, repository, model, middleware.
  • TypeORM highly influenced by other ORMs, such as Hibernate, Doctrine and Entity Framework.
  • TypeDI Dependency Injection for TypeScript.
  • Routing-Controllers Structured, declarative, and beautifully configured class-based controller.
  • Helmet Basic Security Features.
  • JWT JWT security strategy using AccessToken, RefreshToken.
  • Jest, SuperTest Unit Testing and E2E testing.
  • Sentry, Winston Error logging and monitoring.
  • Swagger API endpoint documentation.
  • ESLint Find and fix problems in your TypeScript code.
  • Prettier Prettier is an opinionated code formatter.
  • Docker Docker provides a simple and powerful developer experience, workflows and collaboration for creating applications.

Unit Testing and E2E testing

Test using In-memory Database.

jaebook-unit-e2e-testing

Error logging and monitoring

sentry-error-log

winston-error-log

Swagger

jaebook-swagger-first

jaebook-swagger-second

Coding style automation with ESLint, Prettier and VSCode

By setting options for your team, you can keep your team's coding style consistent.

eslint-prettier

GitHub Action and Codecov

github-action

codecov

Environment Variable Management

APP

Edit from .env.{NODE_ENV}.sample in jaebook-server/config to .env.{NODE_ENV} and replace the content.

# APPLICATION
PORT=3000
API_PREFIX=/api

# MySQL DATABASE
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
DATABASE_USERNAME=development
DATABASE_PASSWORD=development
DATABASE_NAME=development

# TypeORM
TYPEORM_SYNCHRONIZE=true
TYPEORM_LOGGING=true

# JWT
JWT_SECRET_ACCESS_KEY=test!@#$
JWT_SECRET_REFRESH_KEY=retest!@#$

# Swagger
SWAGGER_ROUTE=/api-docs

# Sentry
SENTRY_DSN=

Docker

Edit from .env.sample in the root to .env and replace the content. This is the environment variable setting to be used for Docker.

# Set docker-compose environment
DB_ROOT_PASSWORD=testpass
DB_USER=test
DB_PASSWORD=test
DB_NAME=jaebook

Build Setup

Steps to run this project:

  1. Run yarn install command
  2. Run docker-compose up command

Development

  1. Run yarn install command
  2. Run yarn dev command

Tests

# e2e, unit tests
$ yarn test