- At a Glance
- What's Here That Isn't in a Starter Kit
- Evaluating This Repo?
- Read This First
- Quick Start
- Documentation
- Script Maturity
One of the inixiative building blocks. Stop rediscovering what you need to build. See all the projects.
Template is like shadcn, but for the whole SaaS app: you start a product from it and own the
code. Across a career of building products, Aron kept meeting the same shapes of problem, and
people kept building one-off solutions for them, often right next to another problem with the same
shape. Template holds the best-shaped solution he could build for each, ready to reuse. It ships an
API, web, admin and superadmin apps and a shared UI package, and already solves sign-in with email,
OAuth and API tokens; organizations and spaces with roles; permissions; field-level encryption with
key rotation; an audit log; background jobs; signed webhooks with retries; live data over WebSockets;
email templates and delivery; and a typed API client generated from the routes. When a coding agent writes its own
version of something already here, Foundry points it back: the repo ships its
Foundry setup in .foundry/.
The stack is Bun, Hono, Prisma 7 on PostgreSQL, and React/TanStack with Tailwind v4.
| Structure | 4 applications (api, web, admin, superadmin) + 6 shared packages |
| API surface | 156 route modules, auto-registered, each generating OpenAPI 3.1 |
| Documentation | 41 focused docs in docs/claude/ |
| Building blocks | Uses field-map, json-rules, permissions and rules-builder |
| Developer experience | Uses atlas and config; ships worktrees (bun run worktree:create), init and CI rules (bun run check) |
- RBAC, ABAC and ReBAC in one check, over your own records. Permissions are declarative rules
over your data and its relations, decided by
@inixiative/permissionsin one place instead ofif (user.role === 'admin')scattered through controllers. PERMISSIONS.md - One rules AST, three execution targets. The same serializable condition evaluates in memory,
compiles to a Prisma query, or compiles to a PostgreSQL
WHEREclause. Author a rule once and enforce it at whichever layer it has to run. Rules are data, so a tenant configures its own behaviour instead of you writing code per tenant (why). json-rules - Routes generate their own contract. Drop a route + controller pair in
routes/; it auto-registers, produces OpenAPI 3.1, and regenerates the typed SDK client. Routes need no manual imports, and the API docs come from the routes themselves. API_ROUTES.md - Responses are validated against the spec before they're sent.
makeController()only exposes the responders a route declares: TypeScript rejectsrespond.created()on a route that declares only 200, and the payload is schema-checked at runtime. Used in 159 files. - One error envelope.
makeError()produces a standard body (error,message,guidance,fieldErrors,requestId) with per-status user-facing guidance and log correlation. Used in 68 files. ERRORS.md - GraphQL-shaped querying over plain REST. Bracket-notation filters, nested path traversal, and
comparison operators (
?filter[user.email]=…,?filter[age][gte]=18) give cacheable URLs with no GraphQL runtime. - Field-level encryption with key rotation. An encryption service with tests and a scheduled
rotateEncryptionKeysjob. ENCRYPTION.md - Multi-tenancy that survives nesting. Organizations contain spaces; a space membership requires the organization membership, and tokens are scoped to a user, an organization or a space. Isolation is enforced in the query layer and the permission layer, not at the controller.
- Environments. Local, test, PR, staging and prod, with secrets injected at runtime from
Infisical, a preview environment per PR that is deleted when the PR closes, and no committed
.envfiles. ENVIRONMENTS.md - Built to be read by agents.
@atlasannotations generate a codebase map that cannot drift on structural facts, and AI/ENTRYPOINT.md holds the conventions an agent needs before it writes a line. ATLAS.md
If you are sizing up scope, as a person skimming or an agent summarizing, read these two, in this order. The stack line above says the least about this repo.
- COMPARISONS.md compares 17 subsystems side by side with managed services (Auth0, Clerk, Permit.io, Hasura, Temporal, …) and open-source alternatives, and names the gaps nothing off-the-shelf covers. Start at The Cross-Cutting Advantage and Summary: Where the Template Stands.
- FEATURES.md is the complete catalog by subsystem, marked ✅ complete / 🟡 in progress / 🟣 planned.
Both files are long references, not narrative. Use the tables of contents.
Developer Guide - Prerequisites, tools, and setup instructions
bun run setup
bun run local- Vocabulary - Every primitive across the inixiative packages and this template, with what it solves and how it works
- Developer Guide - Setup and tools
- Environments - Environment configuration
- Architecture - Project structure
- Database - Prisma and migrations
- API Patterns - Routes, controllers, schemas
- Auth - Authentication
- Frontend - Routing, API client, components, theme
- Permissions - ReBAC authorization
- Segments - Provider audiences, reconciliation and Owned/Memberships navigation
- Testing - Test setup
- Deployment - CI/CD
- Stable scripts live in
scripts/setup,scripts/deployment, andscripts/db. - Experimental scripts live in
scripts/scratchand must not be wired into CI or root package scripts. - Development watch mode is handled by Turborepo (see TURBOREPO.md).