Building a software factory on Neon
A software factory is an orchestrated agent pipeline that turns Slack threads, GitHub issues and alerts into reviewed PRs through fixed stages (intake, plan, build, verify, ship, measure), with deterministic code rather than a model deciding each next step. Neon runs several of them, keeping orchestrator state in Postgres (a work_items table claimed via FOR UPDATE SKIP LOCKED with leases, plus an append-only events log) and giving each request its own expiring copy-on-write branch of production. Checkpoints use point-in-time branch restore with the failed state preserved on a side branch, reviews get a preview on real data plus a schema diff, planning agents read through a read-only MCP role, and production is snapshotted before migrations. Hard limits, a kill switch and expirations live in code, not prompts.
Related posts
- The Hidden Ops Layer of Agent Platforms
Neon mediumAdept
Anything's Max coding agent gets a dedicated Neon database branch for every session, created in about 200 ms. The agent runs its migrations there and merges back into development atomically through Neon's restore API. Failed migrations go to a separate LLM "Migration Fixer" for up to three retries before rollback, and merges fail if the development schema changed in the meantime. After crashed sessions left 2,847 orphaned branches, the team added a 6-hourly cleanup job plus 24-hour expires_at timestamps on branches. Connection pooling and 0.25–1 CU autoscaling handle bursty workloads of about 30 peak connections.
- Behind Modem.dev’s Product Velocity
Neon mediumAdept
Modem, a startup building an AI agent that centralizes user feedback from Slack, Discord and GitHub, uses Neon Postgres branching as its development workflow. Every PR with a migration gets its own database branch, where the migration is applied and a schema diff is posted to the PR. The process is repeated against a fresh branch at merge time to catch conflicting migrations, and each Vercel preview runs on an ephemeral branch with automatic cleanup. Two practical tips: script branching through the Neon CLI so coding agents can drive it, and tag OAuth refresh tokens with the originating branch so preview environments can't invalidate production tokens.
- Inside a Kylon room, where people and agents build apps on Neon
Neon easyNovice
Kylon, a shared workspace where teams and AI agents build internal apps like CRMs and invoice trackers, maps its product directly onto Neon resources: one Neon project per workspace, one database per app, and one branch per draft. Agents apply schema migrations and changes to a branch copy of real data, a person reviews the preview, and production changes only on publish. Scale-to-zero makes many mostly idle agent-built databases affordable. The Neon API, point-in-time restore and MCP let agents provision, manage and undo changes without anyone opening a console.
- Adopting Neon branching in CI/CD pipelines: a practical story by Shepherd
Neon mediumAdept
Shepherd, an insurtech startup that moved its Alchemist pricing engine from SQLite to Postgres, uses Neon's copy-on-write database branches to give every pull request an ephemeral test database. GitHub Actions call the Neon API to create a branch when a PR opens and delete it on merge. Changes then flow from per-developer and per-PR branches to staging and production, with Render pre-deploy commands applying migrations tracked in a dedicated timestamped table. The team credits branching with removing the cost and effort of keeping test instances synced with production, and notes that scale-to-zero means it no longer pays for idle databases.
- Dispatches from O'Reilly: Inside a software factory
Stack Overflow Blog mediumAdept
A software factory maps coding agents onto the full SDLC: eight stages (triage, brainstorm, plan, implement, review, review-CI, release, monitor) over a shared context layer such as an LLM wiki, with production signals looping back as new work. Humans own brainstorming and planning and return for final merge, while agents run implement/QA and multi-step review loops. Use the strongest model for planning, because a weak plan makes cheaper models retry until they cost more. Build granular, interruptible commands before chaining them into a fully autonomous pipeline, and start small with skills and agents on top of an existing harness rather than overbuilding.