Flarekit
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.
Install / Use
/learn @Atyantik/FlarekitREADME
Flarekit
Flarekit is a scalable and modular monorepo designed to build modern, edge-first web applications using Cloudflare Infrastructure. It provides a unified structure for developing frontend, backend, and shared services, ensuring code reusability, maintainability, and performance across distributed applications.
Supported and sponsored by Atyantik Technologies. 🚀
Table of Contents
- Introduction
- Project Structure
- Prerequisites
- Setup Instructions
- Development
- Testing
- Deployment
- Manual Deployment
- Working with Database Services
- Contribution Guidelines
- License
Introduction
Flarekit simplifies the complexities of building interconnected apps for Cloudflare Infrastructure. While Cloudflare provides excellent production-ready tools, local development and testing often pose challenges. Flarekit addresses this by providing:
- Predefined commands for managing apps and databases.
- Integrated developer tools like ESLint, Prettier, and examples using Astro (frontend) and Hono (backend).
- Shared infrastructure setup supporting D1 databases, R2 storage, and Queues for seamless local and production environments.
By enabling an edge-first development model, Flarekit ensures developers can create scalable, maintainable, and testable applications for Cloudflare.
Project Structure
The monorepo is organized as follows:
flarekit/
├── apps/
│ ├── backend/ # Backend services
│ └── web/ # Frontend application
├── packages/
│ └── database/ # Shared database layer
├── scripts/ # Utility scripts
├── .github/ # GitHub Actions workflows
├── turbo.json # TurboRepo configuration
└── package.json # Root package manager configuration
- apps/backend: Cloudflare Worker API built with Hono.
- apps/web: Frontend application using Astro.
- packages/database: Centralized database layer with D1 and Drizzle ORM.
Prerequisites
Ensure the following tools are installed:
Setup Instructions
-
Clone the Repository:
git clone https://github.com/Atyantik/flarekit.git cd flarekit -
Install Dependencies:
npm install -
Start the Development Environment:
npm run devTurboRepo ensures all apps and services start seamlessly.
Development
Backend Development
npx flarekit dev --filter="@flarekit/backend"
Frontend Development
npx flarekit dev --filter="@flarekit/web"
Testing
Run Unit Tests
npm test
Run End-to-End Tests (Playwright)
npx playwright install && npm run test:e2e
Deployment
Automated Deployment (GitHub Actions)
Flarekit leverages GitHub Actions for automated deployments:
- Linting and testing ensure code quality.
- Builds separate deployable applications for backend and frontend.
- Deploys to Cloudflare environments using Wrangler.
Manual Deployment
In cases where manual deployment is necessary:
-
Run linting:
npm run lint -
Build applications:
npm run build -
Run tests:
npm test -
Deploy database migrations:
CLOUDFLARE_API_TOKEN=<token> CLOUDFLARE_ACCOUNT_ID=<account_id> npx flarekit migrate:d1:production -
Deploy frontend:
cd apps/web CLOUDFLARE_API_TOKEN=<token> CLOUDFLARE_ACCOUNT_ID=<account_id> npx wrangler pages deploy ./dist cd ../.. -
Deploy backend:
cd apps/backend CLOUDFLARE_API_TOKEN=<token> CLOUDFLARE_ACCOUNT_ID=<account_id> npx wrangler deploy cd ../..
Working with Database Services
The database package (@flarekit/database) is a lightweight library built with Rollup, ensuring compatibility with all monorepo apps.
Why Drizzle ORM?
Drizzle ORM is edge-deployable, making it ideal for Cloudflare’s infrastructure. Avoid non-edge-compatible ORMs.
Creating a Schema
Define a schema in packages/database/src/schema:
import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { sql } from 'drizzle-orm';
export const userSchema = sqliteTable('users', {
id: text('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull(),
createdAt: text('created_at').default(sql`(current_timestamp)`),
});
Generating Migrations
Generate migrations:
npx flarekit build:migrations
Applying Local Migrations
Run migrations locally:
npx flarekit migrate:d1:local
Joining Tables
The BaseService constructor accepts an optional relations array to join
related tables using Drizzle ORM.
import { eq } from 'drizzle-orm';
import { storageSchema, storageInfoSchema } from '@flarekit/database';
const storageInfoService = new BaseService(storageInfoSchema, ctx, [
{
schema: storageSchema,
on: (info, storage) => eq(info.storageId, storage.id),
},
]);
// Fetch a record with its related storage entry
const result = await storageInfoService.getByIdWithRelations(id);
Contribution Guidelines
-
Fork the Repository: Fork the Flarekit repository to your GitHub account and clone it locally:
git clone https://github.com/<your-username>/flarekit.git cd flarekit -
Create a Feature Branch: Create a branch for your feature or bug fix:
git checkout -b feature/your-feature-name -
Implement Changes:
- Write your code following the project's style and guidelines.
- Pre-commit and pre-push hooks will automatically ensure linting and quality checks. You can also run them manually:
npm run lint
-
Write Tests: Add unit and integration tests for your changes:
npm test -
Push Your Changes: Push your feature branch to your forked repository:
git push origin feature/your-feature-name -
Submit a Pull Request:
- Open a pull request from your branch to the main Flarekit repository.
- Include a clear and detailed description of your changes, linking any relevant issues.
- Provide steps for testing your contribution if necessary.
By following these steps, you contribute to the success and quality of the Flarekit project.
License
This project is licensed under the MIT License. See the LICENSE file for details.
For further assistance, refer to the Cloudflare Developers Documentation or contact the maintainers.
About Atyantik Technologies
Flarekit is proudly supported and sponsored by Atyantik Technologies, a leading software development company specializing in scalable web applications, cloud services, and cutting-edge technologies.
Contact Atyantik
<p align="center"> <img src="https://cdn.atyantik.com/atyantik-logo.png" alt="Atyantik Technologies" width="200"> </p>Flarekit – Simplifying Edge-First Development with Cloudflare and Astro! 🌍✨
For issues or inquiries, please open an issue or reach out directly. Thank you for contributing and using Flarekit!
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
