Bare & Peer
Definition
A pattern for hosting many small web + database apps on one machine with minimal friction. Each app can later graduate to a managed platform without changing how it is built or who it is.
Most personal or pre-launch apps don't need isolation, orchestration or secrets management. They need to be cheap to add, trivial to deploy, and easy to move later. Bare & Peer removes layers rather than adding tooling. The host's own primitives (users, sockets, a process supervisor, VCS hooks) carry the whole system.
Principles
- One name, one identity. Each app has a single name, and every resource derives from it: the OS user, the database role, the database, the repository, the service unit and the subdomain.
- Identity is the credential. The app authenticates to the database as who it runs as, not with a secret it holds. Locally that is OS identity over a local socket. On a platform it is workload identity.
- Derive, don't assign. Ports, paths and config locations are computed from the name or numeric ID, so there is no registry to maintain.
- Build from the commit. What runs is always a specific commit, built on the target side. Local working state never leaks into a deploy.
- Immutable releases, pointer activation. Each build lands in its own release. Deploy and rollback are both just moving a pointer.
- Serialize the expensive part. A single global lock serializes builds, which keeps resource peaks bounded on a small host.
- Native primitives first. The process supervisor, reverse proxy, database and VCS all come from the host itself. Containers, registries and CI wait until a platform requires them.
Minimal Ingredients
| Role | Requirement |
|---|---|
| Web runtime | Configurable bind address and port |
| Database | Local identity-based auth (e.g. peer or socket auth) |
| Reverse proxy | Automatic TLS; per-app config fragments |
| Process supervisor | Templated units; runs each app as its own user |
| VCS | Server-side hooks on push |
| Runtime version manager | Per-project version pinning |
| Backup | Host-level snapshots or database backups |
Lifecycle
- Add: name the app; one bootstrap step creates every derived resource
- Deploy: push. The hook builds the commit under a lock, then moves the pointer and restarts.
- Rollback: move the pointer back
- Graduate: containerize, build from the commit on the platform, migrate data, swap local identity for workload identity
Trade-offs
- Gains: very few moving parts, near-zero marginal cost per app, no database credentials, commit-exact deploys
- Costs: shared OS and runtime dependencies; builds compete with live apps; a single host is a single point of failure for every app; no environment parity with the target platform until graduation
Fit
Fits many small apps run by one operator or a small trusted team, with low traffic and frequent deploys, where only some apps will move to a managed platform.
Doesn't fit untrusted code on the same host, teams that need per-app access control or deploy approval, or apps that need strong isolation, horizontal scaling or zero-downtime guarantees.
Related
- Twelve-Factor App: build/release/run separation, config in the environment
- Workload identity (GCP, AWS, SPIFFE): where peer auth goes when an app graduates