Development Workflow
This is how a change goes from your editor to production. If you haven't got Pixelflare running locally yet, start with Local Setup.
flowchart LR
Branch[Branch] --> Code[Code & Test]
Code --> Check[hold-my-beer]
Check --> PR[Pull Request]
PR --> CI[CI Checks]
CI --> Merge[Merge]
Merge --> Deploy[Tag & Deploy]
style Branch fill:#E0E0E0,stroke:#616161,color:#000
style Code fill:#90CAF9,stroke:#1976D2,color:#000
style Check fill:#90CAF9,stroke:#1976D2,color:#000
style PR fill:#CE93D8,stroke:#7B1FA2,color:#000
style CI fill:#CE93D8,stroke:#7B1FA2,color:#000
style Merge fill:#81C784,stroke:#2E7D32,color:#000
style Deploy fill:#81C784,stroke:#2E7D32,color:#0001. Start a Branch
Branch off an up-to-date main, named for what you're doing:
git switch main && git pull
git switch -c fix/upload-timeout2. Make Your Change
Start everything with hot reload:
pnpm devThen work from the layer that owns the change. For the API, that's usually schema, then service, then route. For the web app, it's the API operation, then the component. Architecture explains where everything lives.
A few kinds of change need an extra step:
| If you're changing... | Also do this |
|---|---|
| The database schema | Edit schema.ts, run pnpm --filter @pixflare/database generate to create a migration, then pnpm migrate:d1:local to apply it |
| Text in the web app | Add it to packages/i18n/messages/en.json, then check with pnpm --filter @pixflare/i18n check:all, see Translations |
| An API endpoint | Update its Zod schema, which also updates the API docs, see Validation |
| Config, env vars or CLI | Run pnpm docs:gen to update the generated reference docs |
| A tunable value | Put it in @pixflare/config, rather than inline |
Committed migrations are never edited. If one's wrong, add another that fixes it.
3. Test It
Add or update tests as you go, then run them:
pnpm --filter @pixflare/api testSee Testing for running a single test, and writing new ones.
4. Check Everything
Before you push, run:
pnpm hold-my-beerIt regenerates the docs, then lints, type checks, formats and tests every package. This catches nearly everything CI would, and much sooner.
5. Commit and Open a Pull Request
Keep commits small and focused, with short conventional commit messages, like fix: stop uploads timing out. Then push your branch and open a pull request into main.
CI checks the pull request, only running the jobs that matter for the files you changed. See CI/CD Pipeline for what each one does.
6. Merge and Deploy
Once CI passes and the pull request is reviewed, it's merged into main. If it changed anything that ships, the Tag workflow bumps the version and tags it, and that tag deploys it to production. There's nothing to do by hand.
To deploy your own instance instead, see Deploying with GitHub Actions, or run make deploy.