Overview
Gitflare is built as a pnpm workspace monorepo with Turborepo for task orchestration. The project structure is designed to separate concerns between the web application, Git protocol handling, and data storage.Repository layout
Web app structure
Theapps/web directory contains the main TanStack Start application:
Key directories
/src/api
Contains API route handlers for the web application.
/src/components
React components for the web interface. The ui/ subdirectory contains shadcn/ui components.
/src/db
Database layer with Drizzle ORM schema definitions. This is where user data, repository metadata, issues, and pull requests are defined.
/src/do
Cloudflare Durable Objects implementations. Each repository gets its own Durable Object instance with a virtualized file system built on SQLite.
/src/git
Git Smart HTTP protocol implementation, including:
- git-upload-pack (fetch/pull)
- git-receive-pack (push)
- Pkt-line protocol parsing
- Packfile creation and transfer
/src/lib
Utility functions, helpers, and shared code.
/src/routes
TanStack Router routes for both web UI and API endpoints. Routes are file-based, with special prefixes like $ for dynamic parameters and _ for layout routes.
Configuration files
biome.json
Configures Biome linting and formatting using the Ultracite preset. Defines code style rules, ignore patterns, and project-specific overrides.
turbo.json
Defines Turborepo tasks like build, dev, test, and typecheck with caching and dependency configurations.
pnpm-workspace.yaml
Defines the pnpm workspace structure, including apps/* and packages/* (when added).
drizzle.config.ts
Configures Drizzle ORM for database migrations and schema management.
vite.config.ts
Configures Vite for building and bundling the TanStack Start application.
alchemy.run.ts
Entry point for the Alchemy development server, which provides local Cloudflare Workers emulation.
Tech stack
- Monorepo: pnpm workspaces with Turborepo
- Frontend: React 19, TanStack Router, TanStack Query, Vite, Tailwind CSS
- Runtime: Cloudflare Workers
- Data Storage: Cloudflare D1 (metadata), Durable Objects (Git repositories)
- Auth: Better Auth with Cloudflare D1 integration
- Linting: Biome via Ultracite preset
- ORM: Drizzle with Cloudflare D1
- UI Components: shadcn/ui with Radix UI primitives
Architecture
Gitflare uses a serverless architecture:- Cloudflare Workers - Runs the TanStack Start application at the edge
- Durable Objects - Each repository has its own Durable Object with a virtualized file system built on SQLite
- Cloudflare D1 - Stores user accounts, repository metadata, issues, and pull requests
- Better Auth - Handles authentication and authorization
- Git clients connect via HTTPS to the Worker
- The Worker implements the Git Smart HTTP protocol
- Git objects are stored in the repository’s Durable Object
- Metadata updates are written to D1
Next steps
- Review the contribution guidelines to learn the development workflow
- Read the setup guide to configure your development environment
- Explore individual modules in the codebase to understand implementation details