The simple project shows how to setup monorepo by Typescript + Docker + Lerna + Eslinter + Prettier.
The project has 3 packages (inside packages directory)
- api_gateway (http server)
- backend (http server)
- base (shared package between
api_gateway
andbackend
)
Note: Each package has its own eslint, tsconfig, preitter config.
- Lerna - A tool for managing JavaScript projects with multiple packages
- TsED - A TypeScript Framework on top of Express
- Docker
- Eslint + Prettier
make install-all
That's it π
Go to root project: cd microservice_nodejs_template
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 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 on all packages
npm run eslint
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
microservice_nodejs_template
βββ packages/
β βββ api_gateway/
β β βββ src/
β β βββ package.json
β β βββ tsconfig.json
β β
β βββ base/
β β βββ src/
β β βββ package.json
β β βββ tsconfig.json
β
β
βββ package.json
βββ lerna.json
microservice_nodejs_template
βββ packages/
β βββ backend/
β β βββ src/
β β βββ package.json
β β βββ tsconfig.json
β β
β βββ base/
β β βββ src/
β β βββ package.json
β β βββ tsconfig.json
β
β
βββ package.json
βββ lerna.json
Contributions, issues and feature requests are welcome.