Typescript NodeJS Microservices Boilerplate with Generator CLI - Moleculer, GraphQL, REST, OAuth2, Jaeger, Grafana, Prometheus, Ory Hydra, Ory Keto w/ Access Control middleware, Moleculer-DB GraphQL mixin, Pug, Redis, sibling client repo (login, persistance layer, react-native-web, ios, android)
Project Catalyst is a microservices framework which allows you to create and deploy secured base application development tools within 10 minutes.
git submodule update --init --recursive
Note
: If you don't want to use the catalyst client then you can remove the service section from the docker-compose along with it's volume definition.npm i
first to setup any global dev tools which are used. These are defined in the package.json
which is at the root of the project.chmod 600 traefik/acme.json
These can also be viewed by looking at the docker-compose.yaml
file in the project root. Any exposed service is then label within this file for Traefik configuration
Port | Service |
---|---|
3000 | Traefik Main |
3001 | Traefik Admin |
4444 | Hydra Main |
Required Setup Step: .ENV Config Setup
If you have not setup a .env file you must create one at the root of the project.
Example:
HOST_NAME={YOUR_HOSTNAME}
POSTGRES_HOST==#############
POSTGRES_USER==#############
POSTGRES_PORT=5432
POSTGRES_PASSWORD==#############
POSTGRES_DB=postgres
ADMIN_OAUTH2_CLIENT_ID==############# -- !!CHANGE THIS VALUE!!
ADMIN_OAUTH2_CLIENT_SECRET=############# -- !!CHANGE THIS VALUE!!
EMAIL_API_KEY==############# !! mailgun specific, use nodemailer config for help !!
EMAIL_DOMAIN==############# !! mailgun specific, use nodemailer config for help !!
EMAIL_PROVIDER==#############
If you are running the catalyst-client/using the consumer-app.json config to power a app, you'll want to modify/update the callbacks per deployment env
HOST_NAME
: hostname of choice to have the stack run on, if you do this: make sure that LetsEncrypt can do a hostname validation, certbot can be run via nginx if you need it but traefik will auto setup the SSL cert and hold it on a volumes in traefik/acme.json
. You may need to set the permission on this folder to 600
make start-stack
- build and launch all containersmake start-stack-metrics
- build and launch all containers with metrics
make stop-stack
- stop all launched containersmake dbash SVC=SERVICE_NAME
- takes SVC
arg and creates a bash command line inside the running servicemake dlog SVC=SERVICE_NAME
- takes SVC
arg and logs with following and tails the last 400 lines of a servicestart-code-server
- create web served version of VS Code, helpful for working on an iPad (iOS 13 preferrable)npm run hygen
- This is a link to the executable bin/script for the hygen generator library.
npm run hygen generator help
- View generator help
npm run hygen generator new [name]
- Create new generator
npm run hygen generator new-with-prompt [name]
: Create new generator w/ prompt
npm run hygen service new
: Create new servicenpm run dev
- Start development mode (load all services locally with hot-reload & REPL)
npm run build
- Uses typescript to transpile service to javascript
npm start
- Start production mode (set SERVICES
env variable to load certain services) (previous build needed)
npm run cli
: Start a CLI and connect to production. Don't forget to set production namespace with --ns
argument in script
npm run lint
- Run TSLint
npm run ci
- Run continuous test mode with watching
npm test
- Run tests & generate coverage report
npm run dc:up
: Start the stack with Docker Compose
npm run dc:down
: Stop the stack with Docker Compose
1.0 Goals:
1.1 Goals:
1.2 Gaols:
-- Code Generator
: Hygen
-- Router
: Traefik
-- Containers
: Docker
-- Microservice Framework
: Moleculer
-- Message Bus
: NATS
-- Database
: Postgresql
-- Metrics
: Prometheus
-- Tracing
: Jaeger
-- OAuth2
: Hydra
-- GraphQL
: GraphQL
-- PassportJS
: PassportJS
-- Kubernetes Middleware
https://gist.github.com/icebob/c717ae22002b9ecaa4b253a67952da3a