{"id":26179984,"url":"https://github.com/jellydn/moleculer-typescript-template","last_synced_at":"2025-04-14T22:43:27.883Z","repository":{"id":37057218,"uuid":"472636827","full_name":"jellydn/moleculer-typescript-template","owner":"jellydn","description":"This is a Moleculer-based microservices project","archived":false,"fork":false,"pushed_at":"2025-04-10T09:57:00.000Z","size":4797,"stargazers_count":17,"open_issues_count":6,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T10:55:00.546Z","etag":null,"topics":["fly","microservices","moleculer-template","moleculerjs","typescript"],"latest_commit_sha":null,"homepage":"https://moleculer-typescript-template.fly.dev/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jellydn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["jellydn"],"ko_fi":"dunghd","buy_me_a_coffee":"dunghd","polar":"jellydn"}},"created_at":"2022-03-22T06:13:23.000Z","updated_at":"2025-03-10T13:38:40.000Z","dependencies_parsed_at":"2024-01-05T00:21:48.596Z","dependency_job_id":"14f46c4d-e75c-4cba-9654-8db573d63414","html_url":"https://github.com/jellydn/moleculer-typescript-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydn%2Fmoleculer-typescript-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydn%2Fmoleculer-typescript-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydn%2Fmoleculer-typescript-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydn%2Fmoleculer-typescript-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jellydn","download_url":"https://codeload.github.com/jellydn/moleculer-typescript-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975305,"owners_count":21192197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fly","microservices","moleculer-template","moleculerjs","typescript"],"created_at":"2025-03-11T21:54:02.513Z","updated_at":"2025-04-14T22:43:27.864Z","avatar_url":"https://github.com/jellydn.png","language":"TypeScript","funding_links":["https://github.com/sponsors/jellydn","https://ko-fi.com/dunghd","https://buymeacoffee.com/dunghd","https://polar.sh/jellydn","https://paypal.me/dunghd","https://www.buymeacoffee.com/dunghd"],"categories":[],"sub_categories":[],"readme":"# Welcome to moleculer-typescript-template 👋\n\n![Version](https://img.shields.io/badge/version-0.1.1-blue.svg?cacheSeconds=2592000)\n![Prerequisite](https://img.shields.io/badge/node-%3E%3D%2014.x.x-blue.svg)\n[![Twitter: jellydn](https://img.shields.io/twitter/follow/jellydn.svg?style=social)](https://twitter.com/jellydn)\n\n\u003e My Moleculer-based microservices project\n\n[![Moleculer - Progressive microservices framework for Node.js ](https://img.youtube.com/vi/peb2OflRu-4/0.jpg)](https://www.youtube.com/watch?v=peb2OflRu-4)\n\n[![IT Man - Automating API Client Generation with openapi-ts](https://i.ytimg.com/vi/LwfcoOWlyOw/hqdefault.jpg)](https://www.youtube.com/watch?v=LwfcoOWlyOw)\n\n[![IT Man - Logdy Deep Dive: Streamlining Log Management with a Powerful Web UI](https://i.ytimg.com/vi/wO5MTD3Lawg/hqdefault.jpg)](https://www.youtube.com/watch?v=wO5MTD3Lawg)\n\n[![ITMan - Automate API Linting: Spectral Integration with VS Code and GitHub Actions](https://i.ytimg.com/vi/sTjIgGBhfMs/hqdefault.jpg)](https://www.youtube.com/watch?v=sTjIgGBhfMs)\n\n\u003c!-- [![Deploy](https://button.deta.dev/1/svg)](https://go.deta.dev/deploy?repo=https://github.com/jellydn/moleculer-typescript-template) --\u003e\n\n## Prerequisites\n\n- node \u003e= 18.17.x\n\n## Init new project\n\n```sh\nnpx degit jellydn/moleculer-typescript-template [PROJECT-NAME]\n```\n\n## Features\n\n- ⚡️ Progressive microservices framework for Node.js.\n  [Moleculer](https://moleculer.services/) with [Typescript](https://www.typescriptlang.org/) template\n- 📦 [hygen](http://www.hygen.io/) - The scalable code generator that saves you time.\n- 🦾 [pino](https://getpino.io) - super fast, all natural json logger\n- 🔥 [swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc/blob/v6/docs/README.md) - Generates swagger/openapi specification based on jsDoc comments and YAML files.\n- ✨ [moleculer-zod-validator](https://github.com/TheAppleFreak/moleculer-zod-validator) - A validator for the Moleculer microservice framework to allow the use of [Zod](https://zod.dev/).\n- 🔏 [asteasolutions/zod-to-openapi](https://github.com/asteasolutions/zod-to-openapi#defining-schemas) - A library that generates OpenAPI (Swagger) docs from Zod schemas.\n- 🪄 [hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) - Turn your OpenAPI specification into a beautiful TypeScript client.\n\n## Install\n\n```sh\npnpm install\n```\n\n## Usage\n\n```sh\n# Copy env file\ncp .env.example .env\npnpm dev\n```\n\nAfter starting, open the http://localhost:3000/ URL in your browser.\nOn the welcome page you can test the generated services via API Gateway and check the nodes \u0026 services.\n![https://gyazo.com/c8a8c8b05319504d36922458d9807db2.gif](https://gyazo.com/c8a8c8b05319504d36922458d9807db2.gif)\n\n```sh\npnpm cli --ns api\n```\n\n![https://gyazo.com/235f710ab3fd906f80768261e793eb13](https://gyazo.com/235f710ab3fd906f80768261e793eb13.gif)\n\nIn the terminal, try the following commands:\n\n- `nodes` - List all connected nodes.\n- `actions` - List all registered service actions.\n- `call greeter.hello` - Call the `greeter.hello` action.\n- `call greeter.welcome --username dunghd` - Call the `greeter.welcome` action with the `username` parameter.\n\n![https://gyazo.com/3aca1c4e1992ad1c10da8060d7e21a6c.gif](https://gyazo.com/3aca1c4e1992ad1c10da8060d7e21a6c.gif)\n\nThis project uses [hygen](http://www.hygen.io/) to generate code templates, saving you time and ensuring consistency across your codebase.\n\n### Adding a New Service\n\nTo add a new service to your project, use the following command:\n\n```sh\npnpm generate:service [service-name]\n```\n\n### Adding a New Action to a Service\n\nTo add a new action to an existing service, use the following command:\n\n```sh\npnpm generate:action [action-name] --service [service-name]\n```\n\n### Generating CRUD Services\n\nTo generate a service with Create, Read, Update, and Delete (CRUD) operations, use the following command:\n\n```sh\npnpm generate:crud [service-name]\n```\n\n## API Documentation\n\nThis template also reads your [JSDoc-annotated](https://github.com/Surnet/swagger-jsdoc/blob/v6/docs/README.md) source code and generates an OpenAPI (Swagger) specification.\n\nRun the following command to generate the Swagger documentation:\n\n```sh\npnpm generate:swagger\n```\n\nOpen the http://localhost:3000/docs URL in your browser, you will see the Swagger UI as\n\n![https://gyazo.com/a4fe2413414c94dde636a531eee1a4a0.gif](https://gyazo.com/a4fe2413414c94dde636a531eee1a4a0.gif)\n\n## Run tests\n\n```sh\npnpm test\n```\n\n## Deployment\n\nThis template comes with two GitHub Actions that handle automatically deploying your app to production and staging environments.\n\nPrior to your first deployment, you'll need to do a few things:\n\n- [Install Fly](https://fly.io/docs/getting-started/installing-flyctl/)\n\n- Sign up and log in to Fly\n\n    ```sh\n    fly auth signup\n    ```\n\n- Create two apps on Fly, one for staging and one for production:\n\n    ```sh\n    fly create moleculer-typescript\n    fly create moleculer-typescript-staging\n    ```\n\n- Create a new [GitHub Repository](https://repo.new)\n\n- Add a `FLY_API_TOKEN` to your GitHub repo. To do this, go to your user settings on Fly and create a new [token](https://web.fly.io/user/personal_access_tokens/new), then add it to [your repo secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) with the name `FLY_API_TOKEN`.\n\nNow that every is set up you can commit and push your changes to your repo. Every commit to your `main` branch will trigger a deployment to your production environment, and every commit to your `dev` branch will trigger a deployment to your staging environment.\n\n## GitHub Actions\n\nWe use GitHub Actions for continuous integration and deployment. Anything that gets into the `main` branch will be deployed to production after running tests/build/etc. Anything in the `dev` branch will be deployed to staging.\n\n## Useful links\n\n- Moleculer website: https://moleculer.services/\n- Moleculer Documentation: https://moleculer.services/docs/0.14/\n\n## NPM scripts\n\n- `pnpm dev`: Start development mode (load all services locally with hot-reload \u0026 watch)\n- `pnpm start`: Start production mode (set `SERVICES` env variable to load certain services)\n- `pnpm cli`: Start a CLI and connect to production. Don't forget to set production namespace with `--ns` argument in script\n- `pnpm ci`: Run continuous test mode with watching\n- `pnpm test`: Run tests \u0026 generate coverage report\n- `pnpm dc:up`: Start the stack with Docker Compose\n- `pnpm dc:down`: Stop the stack with Docker Compose\n\n## Pre-commit hooks\n\nThis template uses [Pre-commit](https://pre-commit.com/) to run checks before you commit your code. This ensures that your code is formatted correctly and passes all tests before you push it to your repository.\n\n```sh\npre-commit install\n```\n\nTo run the checks manually, use the following command:\n\n```sh\npre-commit run --all-files\n```\n\n## Author\n\n👤 **Dung Huynh**\n\n- Website: https://productsway.com/\n- Twitter: [@jellydn](https://twitter.com/jellydn)\n- Github: [@jellydn](https://github.com/jellydn)\n\n## Show your support\n\n[![Star History Chart](https://api.star-history.com/svg?repos=jellydn/moleculer-typescript-template\u0026type=Date)](https://star-history.com/#jellydn/moleculer-typescript-template)\n\nGive a ⭐️ if this project helped you!\n\n[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge\u0026logo=ko-fi\u0026logoColor=white)](https://ko-fi.com/dunghd)\n[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge\u0026logo=paypal\u0026logoColor=white)](https://paypal.me/dunghd)\n[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge\u0026logo=buy-me-a-coffee\u0026logoColor=black)](https://www.buymeacoffee.com/dunghd)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellydn%2Fmoleculer-typescript-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjellydn%2Fmoleculer-typescript-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellydn%2Fmoleculer-typescript-template/lists"}