{"id":23867801,"url":"https://github.com/atyantik/flarekit","last_synced_at":"2025-09-08T16:32:20.679Z","repository":{"id":269686994,"uuid":"908157430","full_name":"Atyantik/flarekit","owner":"Atyantik","description":"Flarekit is a scalable, modular, and developer-friendly monorepo ecosystem designed to build and deploy high-performance web applications leveraging Cloudflare Infrastructure. It provides seamless integration with modern web technologies, enabling rapid development with a focus on speed, modularity, and reliability.","archived":false,"fork":false,"pushed_at":"2025-01-03T06:08:23.000Z","size":519,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-03T07:22:15.652Z","etag":null,"topics":["boilerplate","boilerplate-template","cloudflare","cloudflare-pages","cloudflare-workers","dx","web"],"latest_commit_sha":null,"homepage":"","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/Atyantik.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":["tirthbodawala","Atyantik"]}},"created_at":"2024-12-25T09:45:35.000Z","updated_at":"2025-01-03T06:13:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2af68ac-95b6-4cbb-99ff-9a27e7337336","html_url":"https://github.com/Atyantik/flarekit","commit_stats":null,"previous_names":["atyantik/astroflare","atyantik/flarekit"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atyantik%2Fflarekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atyantik%2Fflarekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atyantik%2Fflarekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atyantik%2Fflarekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Atyantik","download_url":"https://codeload.github.com/Atyantik/flarekit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232327032,"owners_count":18505990,"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":["boilerplate","boilerplate-template","cloudflare","cloudflare-pages","cloudflare-workers","dx","web"],"created_at":"2025-01-03T11:14:20.703Z","updated_at":"2025-09-08T16:32:20.659Z","avatar_url":"https://github.com/Atyantik.png","language":"TypeScript","funding_links":["https://github.com/sponsors/tirthbodawala","https://github.com/sponsors/Atyantik"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cdn.atyantik.com/flarekit-logo-480p.webp\" alt=\"Flarekit\" width=\"200\"\u003e\n\u003c/p\u003e\n\n# Flarekit\n\n![License](https://img.shields.io/github/license/Atyantik/flarekit)\n\nFlarekit is a **scalable and modular monorepo** designed to build modern, **edge-first** web applications using **[Cloudflare Infrastructure](https://developers.cloudflare.com/)**. It provides a unified structure for developing frontend, backend, and shared services, ensuring **code reusability**, **maintainability**, and **performance** across distributed applications.\n\nSupported and sponsored by **[Atyantik Technologies](https://atyantik.com)**. 🚀\n\n---\n\n## Table of Contents\n\n1. [Introduction](#introduction)\n2. [Project Structure](#project-structure)\n3. [Prerequisites](#prerequisites)\n4. [Setup Instructions](#setup-instructions)\n5. [Development](#development)\n6. [Testing](#testing)\n7. [Deployment](#deployment)\n8. [Manual Deployment](#manual-deployment)\n9. [Working with Database Services](#working-with-database-services)\n10. [Contribution Guidelines](#contribution-guidelines)\n11. [License](#license)\n\n---\n\n## Introduction\n\nFlarekit simplifies the complexities of building interconnected apps for **[Cloudflare Infrastructure](https://developers.cloudflare.com/)**. While Cloudflare provides excellent production-ready tools, local development and testing often pose challenges. Flarekit addresses this by providing:\n\n- Predefined commands for managing apps and databases.\n- Integrated developer tools like **[ESLint](https://eslint.org/)**, **[Prettier](https://prettier.io/)**, and examples using **[Astro](https://astro.build/)** (frontend) and **[Hono](https://hono.dev/)** (backend).\n- Shared infrastructure setup supporting **[D1 databases](https://developers.cloudflare.com/d1/)**, **[R2 storage](https://developers.cloudflare.com/r2/)**, and **[Queues](https://developers.cloudflare.com/queues/)** for seamless local and production environments.\n\nBy enabling an edge-first development model, Flarekit ensures developers can create scalable, maintainable, and testable applications for Cloudflare.\n\n---\n\n## Project Structure\n\nThe monorepo is organized as follows:\n\n```\nflarekit/\n├── apps/\n│   ├── backend/   # Backend services\n│   └── web/       # Frontend application\n├── packages/\n│   └── database/  # Shared database layer\n├── scripts/       # Utility scripts\n├── .github/       # GitHub Actions workflows\n├── turbo.json     # TurboRepo configuration\n└── package.json   # Root package manager configuration\n```\n\n- **apps/backend**: Cloudflare Worker API built with **[Hono](https://hono.dev/)**.\n- **apps/web**: Frontend application using **[Astro](https://astro.build/)**.\n- **packages/database**: Centralized database layer with **[D1](https://developers.cloudflare.com/d1/)** and **[Drizzle ORM](https://github.com/drizzle-team/drizzle-orm)**.\n\n---\n\n## Prerequisites\n\nEnsure the following tools are installed:\n\n- **[Node.js](https://nodejs.org/)**: v18 or higher\n- **[npm](https://www.npmjs.com/)**: Latest version\n\n---\n\n## Setup Instructions\n\n1. **Clone the Repository**:\n\n   ```bash\n   git clone https://github.com/Atyantik/flarekit.git\n   cd flarekit\n   ```\n\n2. **Install Dependencies**:\n\n   ```bash\n   npm install\n   ```\n\n3. **Start the Development Environment**:\n\n   ```bash\n   npm run dev\n   ```\n\n   **[TurboRepo](https://turbo.build/)** ensures all apps and services start seamlessly.\n\n---\n\n## Development\n\n### Backend Development\n\n```bash\nnpx flarekit dev --filter=\"@flarekit/backend\"\n```\n\n### Frontend Development\n\n```bash\nnpx flarekit dev --filter=\"@flarekit/web\"\n```\n\n---\n\n## Testing\n\n### Run Unit Tests\n\n```bash\nnpm test\n```\n\n### Run End-to-End Tests (Playwright)\n\n```bash\nnpx playwright install \u0026\u0026 npm run test:e2e\n```\n\n---\n\n## Deployment\n\n### Automated Deployment (GitHub Actions)\n\nFlarekit leverages **[GitHub Actions](https://docs.github.com/en/actions)** for automated deployments:\n\n1. Linting and testing ensure code quality.\n2. Builds separate deployable applications for backend and frontend.\n3. Deploys to Cloudflare environments using **[Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/)**.\n\n### Manual Deployment\n\nIn cases where manual deployment is necessary:\n\n1. Run linting:\n\n   ```bash\n   npm run lint\n   ```\n\n2. Build applications:\n\n   ```bash\n   npm run build\n   ```\n\n3. Run tests:\n\n   ```bash\n   npm test\n   ```\n\n4. Deploy database migrations:\n\n   ```bash\n   CLOUDFLARE_API_TOKEN=\u003ctoken\u003e CLOUDFLARE_ACCOUNT_ID=\u003caccount_id\u003e npx flarekit migrate:d1:production\n   ```\n\n5. Deploy frontend:\n\n   ```bash\n   cd apps/web\n   CLOUDFLARE_API_TOKEN=\u003ctoken\u003e CLOUDFLARE_ACCOUNT_ID=\u003caccount_id\u003e npx wrangler pages deploy ./dist\n   cd ../..\n   ```\n\n6. Deploy backend:\n\n   ```bash\n   cd apps/backend\n   CLOUDFLARE_API_TOKEN=\u003ctoken\u003e CLOUDFLARE_ACCOUNT_ID=\u003caccount_id\u003e npx wrangler deploy\n   cd ../..\n   ```\n\n---\n\n## Working with Database Services\n\nThe database package (`@flarekit/database`) is a lightweight library built with **[Rollup](https://rollupjs.org/)**, ensuring compatibility with all monorepo apps.\n\n### Why Drizzle ORM?\n\n**[Drizzle ORM](https://github.com/drizzle-team/drizzle-orm)** is edge-deployable, making it ideal for Cloudflare’s infrastructure. Avoid non-edge-compatible ORMs.\n\n### Creating a Schema\n\nDefine a schema in `packages/database/src/schema`:\n\n```typescript\nimport { sqliteTable, text } from 'drizzle-orm/sqlite-core';\nimport { sql } from 'drizzle-orm';\n\nexport const userSchema = sqliteTable('users', {\n  id: text('id').primaryKey(),\n  name: text('name').notNull(),\n  email: text('email').notNull(),\n  createdAt: text('created_at').default(sql`(current_timestamp)`),\n});\n```\n\n### Generating Migrations\n\nGenerate migrations:\n\n```bash\nnpx flarekit build:migrations\n```\n\n### Applying Local Migrations\n\nRun migrations locally:\n\n```bash\nnpx flarekit migrate:d1:local\n```\n\n### Joining Tables\n\nThe `BaseService` constructor accepts an optional `relations` array to join\nrelated tables using Drizzle ORM.\n\n```typescript\nimport { eq } from 'drizzle-orm';\nimport { storageSchema, storageInfoSchema } from '@flarekit/database';\n\nconst storageInfoService = new BaseService(storageInfoSchema, ctx, [\n  {\n    schema: storageSchema,\n    on: (info, storage) =\u003e eq(info.storageId, storage.id),\n  },\n]);\n\n// Fetch a record with its related storage entry\nconst result = await storageInfoService.getByIdWithRelations(id);\n```\n\n---\n\n## Contribution Guidelines\n\n1. **Fork the Repository**:\n   Fork the Flarekit repository to your GitHub account and clone it locally:\n\n   ```bash\n   git clone https://github.com/\u003cyour-username\u003e/flarekit.git\n   cd flarekit\n   ```\n\n2. **Create a Feature Branch**:\n   Create a branch for your feature or bug fix:\n\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n\n3. **Implement Changes**:\n\n   - Write your code following the project's style and guidelines.\n   - Pre-commit and pre-push hooks will automatically ensure linting and quality checks. You can also run them manually:\n     ```bash\n     npm run lint\n     ```\n\n4. **Write Tests**:\n   Add unit and integration tests for your changes:\n\n   ```bash\n   npm test\n   ```\n\n5. **Push Your Changes**:\n   Push your feature branch to your forked repository:\n\n   ```bash\n   git push origin feature/your-feature-name\n   ```\n\n6. **Submit a Pull Request**:\n\n   - Open a pull request from your branch to the main Flarekit repository.\n   - Include a clear and detailed description of your changes, linking any relevant issues.\n   - Provide steps for testing your contribution if necessary.\n\nBy following these steps, you contribute to the success and quality of the Flarekit project.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n---\n\nFor further assistance, refer to the **[Cloudflare Developers Documentation](https://developers.cloudflare.com/)** or contact the maintainers.\n\n---\n\n## About Atyantik Technologies\n\nFlarekit is proudly supported and sponsored by **[Atyantik Technologies](https://atyantik.com)**, a leading software development company specializing in scalable web applications, cloud services, and cutting-edge technologies.\n\n### Contact Atyantik\n\n- 🌐 [Website](https://atyantik.com)\n- 💼 [LinkedIn](https://linkedin.com/company/atyantik-technologies/)\n- 🐦 [Twitter](https://twitter.com/atyantik_tech)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cdn.atyantik.com/atyantik-logo.png\" alt=\"Atyantik Technologies\" width=\"200\"\u003e\n\u003c/p\u003e\n\n---\n\n**Flarekit** – Simplifying Edge-First Development with [Cloudflare](https://www.cloudflare.com/) and [Astro](https://astro.build/)! 🌍✨\n\nFor issues or inquiries, please [open an issue](https://github.com/Atyantik/flarekit/issues) or reach out directly. Thank you for contributing and using Flarekit!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatyantik%2Fflarekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatyantik%2Fflarekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatyantik%2Fflarekit/lists"}