portal
How portal works

Your architecture, checked on every change.

portal keeps a map of your system and shows where it differs from your plan. Every box and arrow shows where it came from: your plan, the code, or live traffic. Every pull request is checked against it.

One loop

What happens, step by step, on one example system: orders.
1Write down the plan

A file in the repo lists the parts of your system and how they connect.

orders-api writes to the orders database
2A pull request comes in

portal checks the change against the plan, using what it can read from the code and its config.

admin writes to the orders database, but the plan doesn't say so
3Fix it in the same pull request

Either the plan was wrong, so update it, or the code is, so change it.

+ admin writes to the orders database
4The map updates on merge

The system page shows the plan, which parts are built, and which are still planned.

fraud-check · planned · 12 days
5It keeps checking

After merge, the code, its config and live traffic keep being checked against the plan. Anything it doesn't have is flagged, with where it was seen.

orders-api → notifier · seen 3,102 times, not in the plan

Later on the roadmap: back to the spec, as a small PR

Your plan and the checks

Always labelled, never mixed.

Your plan you write it · the spec, architecture/*.c4

What the system should look like: its parts, how they connect, and rules that must hold.

It lives in the repo and changes through pull requests, like code. It can describe something you haven't built yet; the map shows that as planned. Your coding agent can keep it up to date.

The checks portal computes them · no AI

What a pull request changes, and where the code and the plan disagree: a connection the plan doesn't have, a broken rule, docs that weren't updated.

Same pull request, same answer, every time. Each finding points at the file and line, or the live traffic, it comes from. If portal can't tell, it says so instead of guessing.

They also run as a GitHub check, portal facts, so a team can require them before merging.

Optional, for teams without one: an AI review of each pull request. Off by default; turn it on per repo from the system page, or comment /portal review.

Plain LikeC4, a few conventions

No custom language. Any LikeC4 tool still works.
model {
billing = domain 'Billing' {
dispatcher = service 'Webhook Dispatcher' {
metadata {
code 'src/dispatcher/**'
docs 'docs/webhooks.md'
otel_service 'webhook-dispatcher'
}
}
}
dispatcher -[request]-> merchant 'POST invoice event'
}
domain

A column on the map. Nest elements inside it.

kind

The layer, one row each, top to bottom: actor, api, service, event, datastore, infra. A component is a part nested in a service; it shows in a frame under it.

code

Files that implement it. A changed file belongs to the most specific pattern.

docs

Its documentation. Code changed but docs didn't: stale docs.

otel_service

Its OpenTelemetry service.name or host, to match calls seen at runtime. Comma-separate several.

only_writes_from, never_calls

Rules: only these write it; it never connects to these. Checked on every PR against the spec and the code; on the system page against traces too.

resource

The deployed name in the Worker config (a queue, D1 or R2 name, a KV or Hyperdrive binding) or a Compose service name, so what the config wires is compared with the spec.

-[kind]->

What a connection does: request, publishes, consumes, reads, writes. A plain -> gets its type from the element kinds.

Keep the spec in step

Every pull request is checked against the code, whoever wrote the spec. Before pushing, run the same checks locally.
portal check

Prints the checks portal would post, for the working tree, before pushing. Computed, no AI: the same result as the PR comment. Sends file paths and .c4 files only.

By hand

Edit architecture/*.c4 in the same PR as the code, following the conventions. The checks say what's missing.

Optional: your agent

If you use a coding agent, the skill teaches it the conventions so it drafts the .c4 edit with the code. Its edit is checked like anyone's.

Install · run in the repo, then commit
curl -fsSL https://portal.haris-d21.workers.dev/install | sh

Adds the skill and check.mjs to .claude/skills/portal-architecture/, and a short pointer to it in AGENTS.md, plus .github/copilot-instructions.md, GEMINI.md and a Cursor rule when the repo uses them. Run again to update.

Check before pushing · same checks as the PR comment
node .claude/skills/portal-architecture/check.mjs
Read the skill · Read the installer

Get started

  1. 01
    Install the GitHub App

    Install it on your repos; you pick which on GitHub. Pull requests get checks from the first one.

  2. 02
    Add architecture/*.c4

    Start with a few coarse elements. The map appears when it merges.

  3. 03
    Send traces

    Issue the repo's ingest token on its Runtime tab (needs write access), and point your services or an OpenTelemetry Collector at portal with it. The Runtime tab fills in.

Existing systems

  1. 01
    Open its system page

    portal draws the map from the Worker config or Docker Compose, the calls in the code and the traces, with no spec and no AI, and offers a starter spec generated from it.

  2. 02
    Add the intent

    Domains, your names, rules, what you plan to build. Yourself, or your agent proposes it as a pull request; the checks compare it with the code.

  3. 03
    Refine as you go

    Split coarse elements when PRs touch them. Every PR reports coverage, and a PR that lowers it gets a check saying so.

Where it's heading: the vision. What comes next: the roadmap. What portal reads, keeps and sends: your data.