https://github.com/tranbavinhson/microservice_nodejs_template
🦄 Microservice Starter Kit by Nodejs + Typescript + Docker + Lerna + Eslint + Prettier
https://github.com/tranbavinhson/microservice_nodejs_template
docker docker-compose eslint lerna lerna-kit lerna-monorepo lerna-starter lernajs microservice microservices-architecture nodejs prettier prettier-eslint typescript
Last synced: 6 months ago
JSON representation
🦄 Microservice Starter Kit by Nodejs + Typescript + Docker + Lerna + Eslint + Prettier
- Host: GitHub
- URL: https://github.com/tranbavinhson/microservice_nodejs_template
- Owner: TranBaVinhSon
- Created: 2019-11-30T07:33:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T15:30:53.000Z (almost 3 years ago)
- Last Synced: 2025-03-24T08:41:55.345Z (7 months ago)
- Topics: docker, docker-compose, eslint, lerna, lerna-kit, lerna-monorepo, lerna-starter, lernajs, microservice, microservices-architecture, nodejs, prettier, prettier-eslint, typescript
- Language: JavaScript
- Homepage:
- Size: 811 KB
- Stars: 56
- Watchers: 2
- Forks: 14
- Open Issues: 60
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Microservice Nodejs Template
Lerna + Docker + Typescript + EsLint + Prettier# Table of Contents
- [Introduction](#introduction)
- [Techstack](#techstack)
- [Install](#install)
- [Usage](#usage)
- [Project Structure](#project-structure)
- [api_gateway container](#api_gateway-container)
- [backend container](#backend-container)
- [Contributing](#contributing)## Introduction
> The simple project shows how to setup monorepo by Typescript + Docker + Lerna + Eslinter + Prettier.
The project has 3 packages (inside [packages directory](https://github.com/TranBaVinhSon/microservice_nodejs_template/tree/master/packages))
- api_gateway (http server)
- backend (http server)
- base (shared package between `api_gateway` and `backend`)_Note: Each package has its own eslint, tsconfig, preitter config._
## Techstack
- [Lerna](https://github.com/lerna/lerna) - A tool for managing JavaScript projects with multiple packages
- [TsED](https://tsed.io/) - A TypeScript Framework on top of Express
- Docker
- Eslint + Prettier## Install
```sh
make install-all
```That's it 🚀
## Usage
Go to root project: `cd microservice_nodejs_template`
### Running project
```sh
docker-compose up
```That's it 🚀
After run `docker-compose up`, you will see `api_gateway` container runs on `3000` port. and `backend` container runs on `8000` port.
(you can also check the api by make a request to `GET localhost:3000/api/v1/users/`)

### Compile ts to js
- Compile all packages
```
npm run build
```- Compile `api_gateway` package
```
npm run build:api_gateway
```- Compile `backend` package
```
npm run build:backend
```- Compile `base` package
```
npm run build:base
```### Running Eslint
- Running Eslint on all packages
```
npm run eslint
```## Project Structure
Each package under the `packages` folder.
```
microservice_nodejs_template
├── docker/
│ ├── api_gateway/
│ │ └── Dockerfile
│ ├── backend/
│ │ └── Dockerfile
├── packages/
│ ├── api_gateway/
│ │ └── src/
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │
│ ├── backend/
│ │ └── src/
│ │ └── package.json
│ │ ├── tsconfig.json
│ │
│ ├── base/
│ │ └── src/
│ │ └── package.json
│ │ ├── tsconfig.json
│
├── docker-compose.yml
├── package.json
├── lerna.json
├── README.md
```### `api_gateway container` structure
```
microservice_nodejs_template
├── packages/
│ ├── api_gateway/
│ │ └── src/
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │
│ ├── base/
│ │ └── src/
│ │ └── package.json
│ │ ├── tsconfig.json
│
│
├── package.json
├── lerna.json
```### `backend container` structure
```
microservice_nodejs_template
├── packages/
│ ├── backend/
│ │ └── src/
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │
│ ├── base/
│ │ └── src/
│ │ └── package.json
│ │ ├── tsconfig.json
│
│
├── package.json
├── lerna.json
```## Contributing
Contributions, issues and feature requests are welcome.