{"id":31554648,"url":"https://github.com/tab-sama/grenache-template","last_synced_at":"2025-10-04T21:11:58.156Z","repository":{"id":315517661,"uuid":"1059584701","full_name":"tab-sama/grenache-template","owner":"tab-sama","description":"A modern, production-ready template for Grenache microservices projects","archived":false,"fork":false,"pushed_at":"2025-10-02T01:27:17.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-02T03:20:02.000Z","etag":null,"topics":["biome","biomejs","bun","grenache","javascript","microservice","moon","moonrepo","template"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tab-sama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-18T16:36:32.000Z","updated_at":"2025-10-02T01:27:21.000Z","dependencies_parsed_at":"2025-09-19T21:17:24.536Z","dependency_job_id":null,"html_url":"https://github.com/tab-sama/grenache-template","commit_stats":null,"previous_names":["tab-sama/grenache-template"],"tags_count":0,"template":true,"template_full_name":"tab-sama/ts-template","purl":"pkg:github/tab-sama/grenache-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab-sama%2Fgrenache-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab-sama%2Fgrenache-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab-sama%2Fgrenache-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab-sama%2Fgrenache-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tab-sama","download_url":"https://codeload.github.com/tab-sama/grenache-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab-sama%2Fgrenache-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278373518,"owners_count":25976150,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["biome","biomejs","bun","grenache","javascript","microservice","moon","moonrepo","template"],"created_at":"2025-10-04T21:11:54.621Z","updated_at":"2025-10-04T21:11:58.147Z","avatar_url":"https://github.com/tab-sama.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Grenache Microservices Template\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Bun](https://img.shields.io/badge/Bun-1.2-orange.svg)](https://bun.sh/)\n[![Biome](https://img.shields.io/badge/Biome-1.9-green.svg)](https://biomejs.dev/)\n[![Grenache](https://img.shields.io/badge/Grenache-1.0-green.svg)](https://github.com/bitfinexcom/grenache)\n\nA modern, production-ready template for Grenache microservices projects with all the essential tools and configurations\nyou need to get started with distributed microservices quickly! 🎯\n\nBased on the [Bitfinex Grenache tutorial](https://blog.bitfinex.com/tutorial/bitfinex-loves-microservices-grenache/).\n\n## ✨ Features\n\nThis template comes pre-configured with:\n\n- 🔥 **Bun Runtime**: Ultra-fast JavaScript runtime and package manager\n- 🌐 **Grenache Microservices**: Distributed microservice architecture with DHT-based service discovery\n- 🧹 **Biome**: Fast linter and formatter (Prettier + ESLint replacement)\n- 📦 **Monorepo Structure**: Bun workspace with Moonrepo for task management\n- 🔗 **WebSocket Communication**: Server-client communication via Grenache WebSocket transport\n- 🚨 **Git Integration**: Pre-configured with Biome VCS integration\n- 🪝 **Git Hooks**: Lefthook for automated quality checks\n- 📝 **GitHub Templates**: CODE_OF_CONDUCT.md, SECURITY.md, and LICENSE included\n- ⚡ **Proto Tool Manager**: Automated tool management with [moonrepo proto](https://moonrepo.dev/proto)\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- [proto](https://moonrepo.dev/proto) - A multi-language version manager that will manage all required tools\n- Alternatively, you can install tools separately:\n    - [Bun](https://bun.sh/) (latest version)\n    - [Biome](https://biomejs.dev/) (latest version)\n    - [Moon](https://moonrepo.dev/) (latest version)\n\n### Installation\n\n1. **Use this template** by clicking the \"Use this template\" button on GitHub\n2. **Clone your new repository**:\n   ```bash\n   git clone https://github.com/yourusername/your-project-name.git\n   cd your-project-name\n   ```\n3. **Install tools and dependencies**:\n   ```bash\n   # Install all required tools (bun, biome, moon) using proto\n   proto install\n   \n   # Install project dependencies\n   bun install\n   ```\n\n### 🏃‍♂️ Running the Project\n\n**Important**: You must start the components in this specific order:\n\n1. **Start Grape DHT nodes** (required for service discovery):\n   ```bash\n   # Terminal 1: Start first grape node\n   cd apps/grape\n   bun run dev:grape1\n   \n   # Terminal 2: Start second grape node\n   cd apps/grape  \n   bun run dev:grape2\n   ```\n\n2. **Start the server** (after grape nodes are running):\n   ```bash\n   # Terminal 3: Start the microservice server\n   cd apps/server\n   bun run dev\n   ```\n\n3. **Start the client** (after server is running):\n   ```bash\n   # Terminal 4: Start the client\n   cd apps/client\n   bun run dev\n   ```\n\n## 🛠️ Development\n\n### Available Scripts\n\n#### Root Level Scripts\n\n| Script            | Description                |\n|-------------------|----------------------------|\n| `bun run prepare` | Install Lefthook Git hooks |\n\n#### Grape DHT Scripts (apps/grape)\n\n| Script               | Description                              |\n|----------------------|------------------------------------------|\n| `bun run dev:grape1` | Start first grape DHT node (port 20001)  |\n| `bun run dev:grape2` | Start second grape DHT node (port 20002) |\n\n#### Server Scripts (apps/server)\n\n| Script           | Description                                 |\n|------------------|---------------------------------------------|\n| `bun run dev`    | Start development server with file watching |\n| `bun run lint`   | Run Biome linter for server                 |\n| `bun run format` | Format server code with Biome               |\n| `bun run test`   | Run server tests                            |\n\n#### Client Scripts (apps/client)\n\n| Script           | Description                   |\n|------------------|-------------------------------|\n| `bun run dev`    | Start development client      |\n| `bun run lint`   | Run Biome linter for client   |\n| `bun run format` | Format client code with Biome |\n| `bun run test`   | Run client tests              |\n\n### 🧹 Code Quality\n\nThis template uses **Biome** for both linting and formatting:\n\n```bash\n# Check for linting issues\nbun run lint\n\n# Auto-fix linting issues and format code\nbun run format\n```\n\n### 🪝 Git Hooks \u0026 Conventional Commits\n\nThis template includes **Lefthook** for automated Git hooks and **Commitlint** for enforcing Conventional Commits:\n\n#### Automatic Quality Checks\n\nGit hooks will automatically run on:\n\n- **Pre-commit**: Format code, run linter, and type-check\n- **Commit-msg**: Validate commit message format\n- **Pre-push**: Final lint and type checks\n\n#### Conventional Commits\n\nAll commit messages must follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:\n\n```bash\n# ✅ Valid commit messages\ngit commit -m \"feat: add user authentication\"\ngit commit -m \"fix: resolve memory leak in data processing\"\ngit commit -m \"docs: update API documentation\"\ngit commit -m \"refactor: simplify error handling logic\"\n\n# ❌ Invalid commit messages\ngit commit -m \"add feature\"           # Missing type\ngit commit -m \"Fix bug\"              # Wrong case\ngit commit -m \"feat!: breaking change\" # Use BREAKING CHANGE footer instead\n```\n\n**Available commit types:**\n\n- `feat` - New features\n- `fix` - Bug fixes\n- `docs` - Documentation changes\n- `style` - Code style changes (formatting, etc.)\n- `refactor` - Code refactoring\n- `perf` - Performance improvements\n- `test` - Adding or updating tests\n- `build` - Build system changes\n- `ci` - CI configuration changes\n- `chore` - Other changes (maintenance, etc.)\n- `revert` - Reverting previous commits\n\n#### Managing Git Hooks\n\n```bash\n# Install hooks (automatically runs after `bun install`)\nbun run prepare\n\n# Skip hooks for a single commit (use sparingly)\ngit commit -m \"feat: add feature\" --no-verify\n\n# Temporarily disable hooks\nlefthook uninstall\n\n# Re-enable hooks\nlefthook install\n```\n\n### 📁 Project Structure\n\n```\n├── apps/                    # Monorepo applications\n│   ├── grape/              # Grape DHT nodes for service discovery\n│   │   ├── package.json    # Grape app dependencies and scripts\n│   │   └── index.js        # Grape DHT node implementation\n│   ├── server/             # Grenache microservice server\n│   │   ├── package.json    # Server dependencies and scripts\n│   │   └── index.js        # Server implementation\n│   └── client/             # Grenache microservice client\n│       ├── package.json    # Client dependencies and scripts\n│       └── index.js        # Client implementation\n├── libs/                   # Shared libraries\n│   └── biome/              # Shared Biome configuration\n├── .moon/                  # Moonrepo configuration\n├── package.json            # Root workspace configuration\n├── lefthook.yml           # Git hooks configuration\n└── README.md              # You are here! 📍\n```\n\n## 🔧 Configuration\n\n### Biome Configuration\n\nThe `biome.json` includes:\n\n- All recommended rules enabled\n- Tab indentation (configurable)\n- Git integration\n- Import organization\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Run the linter and formatter: `bun run format`\n5. Commit your changes (`git commit -m 'Add some amazing feature'`)\n6. Push to the branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\n## 📋 Customization\n\nTo customize this template for your project:\n\n1. **Update package.json files** with your project details in root and each app\n2. **Modify the microservices** in `apps/server/index.js` and `apps/client/index.js` to fit your needs\n3. **Adjust Biome configs** in `libs/biome/` as needed\n4. **Configure Grape DHT ports** in `apps/grape/package.json` for your network setup\n5. **Update this README** with your project-specific information\n\n## 🔒 Security\n\nPlease see [SECURITY.md](SECURITY.md) for our security policy and how to report security vulnerabilities.\n\n## 📄 License\n\nThis project is licensed under the Apache License—see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- [Bun](https://bun.sh/) for the amazing runtime\n- [Biome](https://biomejs.dev/) for fast linting and formatting\n- [Grenache](https://github.com/bitfinexcom/grenache) for the microservices framework\n- [Bitfinex](https://www.bitfinex.com/) for creating and maintaining Grenache\n- [Moonrepo](https://moonrepo.dev/) for excellent monorepo tooling\n\n---\n\n**Happy coding! 🎉** If you find this template useful, please give it a ⭐️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftab-sama%2Fgrenache-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftab-sama%2Fgrenache-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftab-sama%2Fgrenache-template/lists"}