Core concepts
Six ideas explain how an Appbricx app is built, tested and shipped. Knowing them helps you write better prompts, read what your agent reports and fix problems fast.
1. A project is one app, as files
A project is one app: its files, its databases, its sign-in accounts and its addresses. It lives in a workspace (a team, a client, or just you) whose members have roles; collaborators can be added to one project from outside the workspace, for example a client reviewer.
The app itself is plain files: app.config.ts for settings and roles, db/ for the database in SQL, routes/ and components/ for React pages, server/ for typed actions, workflows/ for durable workflows and messages/ for email, SMS and notification templates. See project files.
// app.config.ts
import { defineApp } from "@appbricx/define";
export default defineApp({
brand: { name: "Teamday", tagline: "Team experiences, booked in a minute" },
auth: { signup: { as: ["host", "hr"] } },
roles: {
host: { kind: "consumer", label: "Host", profile: "host_profile" },
hr: { kind: "consumer", label: "Company booker", profile: "hr_profile" },
ops: { kind: "staff", label: "Teamday ops" },
},
});A project can be renamed, archived, duplicated (with or without its dev data) or deleted; deleting takes the site down first and asks you to confirm with the project's name.
2. Dev and prod: two databases, two addresses
Every project has a dev environment, at https://dev-<slug>.apps.appbricx.com, and once you deploy a prod environment at https://<subdomain>.apps.appbricx.com or your own domain. Each has its own Postgres database. Applying changes dev only; deploying publishes what dev runs.
- Changes are additive. New tables, columns, indexes and policies are added and rows are kept. A drop (a column or table
db/no longer declares) waits until you allow it. - Seeds are demo rows.
db/seeds/*.sqlrun in dev on every apply; only seeds marked-- @env prodrun in production. - Sign-in accounts are shared. One account signs in to both dev and prod; each environment has its own rows.
- Your own SQL is kept. An index, view or function you add by hand survives applies and deploys and is reported as drift.
- Previews. A branch can get a preview of its own: a database cloned from dev and its own address.
3. Drafts and versions
Edits go to the project's draft: the files as they will be at the next apply. Your agent's tools, the CLI's push and the console's Code page all write the same draft, with a revision number so two writers can't overwrite each other by accident. Nothing in the draft is live until you apply it.
Every apply makes a version, with its author (a person, or an agent's token). You can diff any two versions (or dev against what production runs) per file, with the database plan, the changed access policies and the bundle sizes; label a version; and restore an earlier one to dev, keeping the rows.
4. Roles and policies, enforced by the database
A role is a kind of user, declared in app.config.ts: consumer roles sign up and act on their own rows, staff roles run the app. A role can have a profile table whose user_id links each signed-in person to their row.
Who may read and change which rows is row-level security in db/access/*.sql, checked by Postgres on every request, whether it comes from a page, an action, your API client or a script. A table with no policy for a role gives that role nothing, and a bug in a page can't leak another user's rows.
-- db/access/booking.sql: a company booker sees and makes its own bookings; ops see all
create policy booking_hr_read on booking for select
using (hr_id = (select ctx.profile_id('hr')));
create policy booking_hr_create on booking for insert
with check (hr_id = (select ctx.profile_id('hr')) and status = 'requested');
create policy booking_ops_all on booking for all using ((select ctx.has_role('ops')));Rules that depend on the data ("not when the slot is full") are triggers in db/schema: a raise exception reaches the caller as its message. Every apply makes one demo sign-in per role, which verify and your agent use to test as each user.
5. Verify: tested as every user
verify checks a release the way a careful tester would: static checks (types, lint, every page reachable), the matrix (signs in as each role and as a signed-out visitor and tries every table with writes that are rolled back), the workflows, and a browser walk of every page as each role. Each failure comes with its evidence and a fix. A deploy runs it first and stops on red.
6. Deploys: a way forward and a way back
- Plan first. A deploy's dry run says what it will do: the host, the SQL it will run, what waits, the workflows it arms.
- Rehearsed. The migration runs on a copy of production and verify runs there; a red report leaves production untouched.
- Snapshot first. Production is snapshotted before every release and before every write an agent makes to it.
- Expand only. Production gets additive steps; drops wait for a hold or your decision.
- Rollback. Going back to an earlier release switches its stored build in, in one call; it can restore the database to its snapshot too.
The loop, end to end
| Step | MCP tool | CLI or HTTP | What happens |
|---|---|---|---|
| Read | code list, project_files read | appbricx pull | The draft's files |
| Write | code, project_files, packages, assets | appbricx push | The draft changes; nothing is live |
| Check | check_contract, code with then: "check" | push --check | Errors at file and line. Nothing changes |
| Apply | apply_contract | push --apply | Builds dev: database, pages, actions, workflows. Lists demo sign-ins |
| Try | call_app, screenshot, workflows dry run | the dev link | The running app as each user |
| Verify | verify | POST …/verify | Every role, table, page and action |
| Deploy | deploy | POST …/deploy | Rehearse, verify, snapshot, publish |
| Undo | deploys rollback, versions restore | POST …/deploys/:did/rollback | An earlier release, or an earlier version in dev |