Prerequisites
Before you begin, make sure you have:- Node.js v22 or higher
- pnpm v10.19.0 or higher
- Cloudflare account (free tier works fine)
- Git installed on your machine
Step 1: Set up your account
Install dependencies
Install all required dependencies using pnpm:
Gitflare uses pnpm workspaces to manage the monorepo structure.
Configure environment variables
Navigate to the web app directory and set up your environment:Create a For production deployment, you’ll also need to set these secrets in your Cloudflare dashboard or via wrangler.
.dev.vars file with the following:Set up the database
Initialize the local D1 database:This creates the SQLite database schema for users, repositories, and issues.
Start the development server
Launch the local development server:Open http://localhost:3000 in your browser. You should see the Gitflare homepage!
Step 2: Create your first repository
Navigate to the new repository page
After signing in, click New repository or navigate to the repositories page.
Configure your repository
Fill in the repository details:
Repository names must:
- Be 1-100 characters long
- Contain only letters, numbers, hyphens, and underscores
- Not end with
.git
Step 3: Perform your first Git operations
Now that your repository is created, let’s perform some Git operations!Generate a personal access token
To push to your repository, you need a personal access token (PAT):
- Navigate to Settings > Personal Access Tokens
- Click Generate new token
- Give it a descriptive name like
my-laptop - Copy the token immediately (you won’t see it again!)
Clone your repository
Clone your newly created repository:
For public repositories, you can clone without authentication. Private repositories require a PAT.
Push to Gitflare
Push your changes to Gitflare:When prompted for credentials:
- Username: Your Gitflare username
- Password: Your personal access token
How it works
Here’s what happens during Git operations:git clone / git pull (git-upload-pack)
git clone / git pull (git-upload-pack)
When you clone or pull from a Gitflare repository:
- Discovery: Git sends a request to
/username/repo/info/refs?service=git-upload-pack - Authentication: Gitflare verifies your credentials (from
apps/web/src/lib/git-auth.ts:19-27):- Public repos: Allow anonymous read access
- Private repos: Require valid PAT from repository owner
- Capability advertisement: Gitflare advertises supported Git capabilities
- Negotiation: Git client sends “want” and “have” refs to determine what objects to fetch
- Pack creation: Gitflare’s Durable Object collects the requested objects (from
apps/web/src/git/service.ts:214-295) - Transfer: Objects are packed and sent to the client
git push (git-receive-pack)
git push (git-receive-pack)
When you push to a Gitflare repository:
- Discovery: Git sends a request to
/username/repo/info/refs?service=git-receive-pack - Authentication: Gitflare verifies push permissions (from
apps/web/src/lib/git-auth.ts:58-63):- Push operations always require authentication
- Only the repository owner can push
- Pack reception: Git client sends a packfile with new objects
- Index pack: Gitflare indexes the packfile into the Durable Object storage (from
apps/web/src/git/service.ts:204-212) - Reference updates: Gitflare updates branch references (from
apps/web/src/git/service.ts:599-738):- Validates old OID matches current reference
- Ensures fast-forward updates (no force push)
- Atomically updates all references
Repository storage
Repository storage
Each repository in Gitflare has:
- Durable Object: Stores the actual Git repository data
- Git objects (blobs, trees, commits, tags)
- References (branches, tags)
- Packfiles
- Virtualized file system on Durable Object SQLite
- D1 Record: Stores metadata (from
apps/web/src/api/repos.ts:103-120):- Repository name and description
- Owner information
- Public/private status
- Creation timestamp
Deploy to production
Ready to deploy Gitflare to production?Create a Cloudflare account
If you haven’t already, sign up for a Cloudflare account.
Next steps
Now that you have Gitflare running, explore more features:Managing repositories
Learn about repository settings and access control
Git operations
Deep dive into all supported Git commands
Architecture
Understand how Gitflare works under the hood
Authentication
Set up authentication and personal access tokens