Environment variables
Gitflare uses environment variables to configure authentication, database connections, and deployment settings.Create environment file
Navigate to the web application directory and create a
.env file based on the example:Configure Better Auth
Set the Better Auth secret for handling authentication:The application automatically sets
.env
VITE_BETTER_AUTH_URL based on your deployment environment:- Local:
http://localhost:3000 - Preview: Cloudflare Workers preview URL
- Production: Your custom domain
Configure Cloudflare credentials
For database migrations and remote operations, set your Cloudflare credentials:To find these values:
.env
- Account ID: Found in the Cloudflare dashboard URL or Workers page
- Database ID: Created when you set up your D1 database (see below)
- D1 Token: Generate an API token with D1 permissions in Cloudflare dashboard → API Tokens
Cloudflare services setup
Gitflare uses several Cloudflare services that need to be configured.D1 Database
Gitflare uses Cloudflare D1 for storing user data, repository metadata, and issues.Authenticate with Cloudflare
Authenticate the Wrangler CLI with your Cloudflare account:This opens your browser to authorize Wrangler.
Create D1 database
Create a new D1 database for Gitflare:This command outputs your database ID. Copy this ID to your
.env file as CLOUDFLARE_DATABASE_ID.Durable Objects
Gitflare uses Durable Objects to store Git repository data. These are automatically configured through thealchemy.run.ts file:
alchemy.run.ts
Durable Objects are automatically deployed when you deploy your Worker. No manual setup is required.
Alchemy configuration
Gitflare uses Alchemy for deployment and infrastructure management. The configuration is inapps/web/alchemy.run.ts.
Key configuration options
REPO: Durable Object namespace for repositoriesDB: D1 database connectionLOG_LEVEL: Logging level (debugfor dev,warnfor prod)SITE_URL: Current deployment URLVITE_BETTER_AUTH_URL: Better Auth endpoint URLBETTER_AUTH_SECRET: Authentication secret
Custom domain
To use a custom domain in production, update thePROD_DOMAIN constant in alchemy.run.ts:
alchemy.run.ts
Database schema management
Gitflare uses Drizzle ORM for type-safe database operations.Generate migrations
After modifying database schemas inapps/web/src/db/schema/, generate new migrations:
migrations/ directory.
Configuration
Drizzle is configured indrizzle.config.ts:
drizzle.config.ts
Verify configuration
Before starting development or deploying, verify your configuration:Next steps
Deployment
Deploy your configured Gitflare instance to Cloudflare Workers
Development
Learn about the development workflow and available commands