Upflow
Tracks pull request cycle times from GitHub — coding, pickup, review, and deploy — so teams can see where time is spent and ship faster.
Data is stored in SQLite with a multi-tenant (database-per-org) architecture.
Setup
Prerequisites
1. Install dependencies
pnpm install
2. Create a GitHub App
Upflow uses a GitHub App for OAuth login. This is required regardless of which integration method you choose below.
Create a GitHub App at https://github.com/settings/apps/new:
- Callback URL:
http://localhost:5173/api/auth/callback/github (dev) / https://your-domain/api/auth/callback/github (prod)
- Expire user authorization tokens: ON
- Request user authorization (OAuth) during installation: ON
- Permissions > Account permissions > Email addresses: Read-only
Then copy .env.example and fill in the values:
cp .env.example .env
| Variable |
Description |
UPFLOW_DATA_DIR |
Data directory path (e.g. ./data) |
BETTER_AUTH_SECRET |
Secret for better-auth (min 32 chars) |
BETTER_AUTH_URL |
App URL (e.g. http://localhost:5173) |
GITHUB_CLIENT_ID |
GitHub App client ID |
GITHUB_CLIENT_SECRET |
GitHub App client secret |
3. Choose integration method
Upflow supports two ways to fetch PR data from GitHub.
Method A: PAT (Personal Access Token) — simple self-hosted setup
The quickest way to get started on a single server. Just add a GitHub PAT to .env:
| Variable |
Description |
INTEGRATION_PRIVATE_TOKEN |
GitHub PAT for PR data fetching |
PR data is fetched by an hourly crawl job. For the initial fetch, see Fetching PR Data below.
Method B: GitHub App — organization-wide with realtime updates
For multi-team rollouts where PR data should update instantly on events. This uses the same GitHub App created in Step 2, with additional permissions and configuration.
Add repository permissions
In your GitHub App settings, add the following repository permissions:
- Contents: Read-only (commits)
- Pull requests: Read-only (PRs, reviews, comments)
- Deployments: Read-only (deploy events for cycle time calculation)
- Metadata: Read-only (automatically granted)
Also add this organization permission so Upflow can verify that the person
completing an installation is an active organization owner:
Configure this permission before deploying the GitHub App connection flow.
GitHub marks existing installations as requiring approval after an App gains a
new organization permission; an organization owner must approve that request
before Upflow can verify and connect the installation.
Additional environment variables
Add to .env:
| Variable |
Description |
GITHUB_APP_ID |
GitHub App ID |
GITHUB_APP_PRIVATE_KEY |
GitHub App private key (base64 encoded) |
GITHUB_WEBHOOK_SECRET |
Webhook signature verification secret |
The private key should be base64-encoded from the PEM file (required for platforms like Fly.io where newlines in env vars are problematic).
Install the App to your Organization
- Log in to Upflow and go to Settings > Integration
- Switch the integration method to GitHub App
- Click Install GitHub App — you'll be redirected to GitHub's installation page
- Select the target Organization and configure repository access (All / Selected)
- You'll be redirected back to Upflow once installation is complete
You can verify the connection status in Settings > Integration.
Configure Webhook
Set up the webhook to enable realtime PR data updates.
- In your GitHub App settings, set Webhook to Active
- Webhook URL:
https://your-domain/api/github/webhook
- Generate a Webhook Secret and set the same value in both GitHub App settings and
GITHUB_WEBHOOK_SECRET in .env
- Under Subscribe to events, enable:
- Pull request — triggers realtime crawl on PR changes
- Pull request review — captures review events
- Pull request review comment — captures review comments
4. Initialize database
pnpm db:setup
5. Start development server
pnpm dev
End-to-end tests (Playwright)
First-time browser download:
pnpm exec playwright install chromium
Use the same .env as local dev (BETTER_AUTH_SECRET, GITHUB_*, UPFLOW_DATA_DIR, etc.). The e2e server runs via pnpm run start:e2e (NODE_ENV=test, ENABLE_E2E_LOGIN=1, PORT=8811, BETTER_AUTH_URL=http://localhost:8811).
Playwright uses /test-login?email=admin@example.com, so the shared DB must contain that user. Default seed uses admin@example.com when SEED_ADMIN_EMAIL is unset; if .env sets SEED_ADMIN_EMAIL to something else, point the seed at the default admin for one run before e2e:
SEED_ADMIN_EMAIL=admin@example.com UPFLOW_DATA_DIR=./data pnpm db:setup
UPFLOW_DATA_DIR=./data pnpm test:e2e
(UPFLOW_DATA_DIR can be omitted when already set in .env.)
Playwright writes test/playwright/.auth/admin.json (gitignored). Do not set ENABLE_E2E_LOGIN in production, Docker image builds, or deploy workflows — it can allow bypassing normal GitHub OAuth for the allowlisted e2e admin email.
GitHub API Emulator
For local development and smoke tests, Upflow can point GitHub REST API and
Octokit calls at the emulate GitHub
emulator instead of the real GitHub API.
Create a local emulator config, then start the emulator in one terminal:
cp emulate.config.example.yaml emulate.config.yaml
pnpm emulate:github
Then set GITHUB_API_BASE_URL=http://localhost:4000 when running the app or
tests. .env.emulate.example contains the matching local values:
cp -i .env.emulate.example .env
pnpm dev
If .env already exists, review or back it up before copying the emulate
example over it.
The seeded token test_token_user1 maps to the seeded GitHub user octocat.
To verify the local emulator wiring:
pnpm test:emulate:github
This smoke test exercises the repository owner lookup, repository search, and
Octokit authenticated user call against the emulator. GitHub OAuth authorize and
token exchange still use the configured GitHub OAuth provider; only GitHub REST
API calls are redirected.
Fetching PR Data
Upflow needs to fetch PR data from GitHub to display metrics. After adding a repository in the dashboard, run:
pnpm tsx batch/cli.ts crawl <org-id>
In production, crawl runs automatically every hour. With Method B (GitHub App + Webhook), data also updates in realtime on PR events.
If released_at (or other analyze-derived columns) needs to be repaired after changing release detection logic or fixing an analyze-side bug, re-run analyze over the stored raw data — no GitHub API calls, takes a few minutes:
pnpm tsx batch/cli.ts process <org-id>
Reach for crawl --refresh only when the raw data itself is wrong (missing PRs, schema gaps that need re-fetch). It re-hits the GitHub API for every PR and takes 30+ minutes.
Authentication
- GitHub OAuth only: active Upflow members must remain enabled under Settings > GitHub Users. A GitHub account with no Upflow membership may authenticate only so an external GitHub organization owner can complete a delegated App installation; organization routes still require explicit Upflow membership
- First-user bootstrap: a permanent database marker elects exactly one initial GitHub user as super admin; seeded and upgraded databases record bootstrap as already completed
- Auto-registration: PR authors and reviewers are automatically added as inactive GitHub users during crawl — an admin enables them via Settings > GitHub Users
License
O'Saasy License