Architecture Document · C4 + Deployment

Everythink Studio
Global System Architecture

A no-code AI operating system that turns an organization — business, government, or community — into a living geospatial network: communities and rooms on the map, AI assistants that answer, sell, and connect people, under your own brand, on web, iOS, and Android. In production since 2016.

Rust 2026 · workspace 17 crates Postgres + Timescale + pgvector Dragonfly (Redis) Next.js 16 · pnpm monorepo HAI engine · 13 question types
Initial version · progressive download This document is the initial version of the architecture and does not contain the complete architecture. The incompleteness is expected and by design: the architecture will be progressively downloaded from the aap-human-agent template — the human-agent interaction patterns package (escalation, delegation, proxy agents, authority boundaries). Agents execute the download; authority remains with the human.

CONFIDENTIAL — Carlos Matias Baglieri 2026 · in production since 2016

Agenda

Six sections, one system

From product vision to real implementation: Rust backend, Next.js frontend, deployment, and roadmap.

1 · Product and vision

Topology · HAI engine · governance

The space is the router; 13 question types; isolation, federation, agentic, proactive.

2 · Backend

Rust 2026 · 17 crates · hexagonal

ZERO-I/O domain, ports & adapters, 3 auth regimes, one Postgres, realtime.

3 · Frontend

Next.js 16 · FSD + MVVM

4 apps, 13 packages, SDK facades, RBAC can(), single sign-in, design system.

4 · Deploy / CI

docker-compose · 2-tier CI

7 services, TLS at the ALB, direct preprod deploys, integrity gate on main.

5 · Roadmap

BYOK · anchoring · self-hosted · DAO

v2 direction, explicitly not implemented.

6 · Closing

Honest accounting

What is production, what is design, what is projected.

Vision · Topology

The space is the router

Every person has their own personal organization and subscribes to n organizations. Every organization — business · government · union · community — contains n networks; each network contains n communities; each community contains n rooms. Every node has its own multipolygon: containment runs inward (fragmented communities inside the network's polygon) or outward (communities outside the polygon). The topology is fractal in the mathematical sense: each level is a self-similar copy of the previous one — S = ⋃ fᵢ(S), the attractor of the Hutchinson operator (Banach fixed-point theorem). Networks interoperate with each other (federation): one network connects to another by sharing only what is public. When a person joins an organization, they gain access to its n communities and n rooms. The work they do in the organization is tracked in the org and mirrored into their personal org: it generates per-person reputation, is distilled into solved problems, and those are copied to their personal network, which tracks them. From the accumulated answers, HAI builds a per-user context layer.

Zoom: 100%
Topology: network → community → room → persona
personal org / organizationnetworkcommunityroom
Vision · Ontology

The four layers of the platform

Each upper layer composes the guarantees of the layers below over typed interfaces. Products (v1 modules): HAI, Matchmaking, Chat, Calendar, Market, Social. On top of the 4 layers, 10 sector instantiations.

Zoom: 100%
Ontology: 4 layers + 10 sector instantiations
Vision · Principles

Three principles that govern the architecture

Each principle is a verifiable guarantee, not a statement of intent. Together they establish the composition rule (end-to-end), the sector-multiplication rule (inheritance without modification), and the honesty rule (implemented and measured = guarantee).

Principle 1 · Layer compositionEnd-to-end composition rule. If each layer L₁…L₄ establishes its guarantee and every inter-layer interface passes only typed and validated values (Zod at the boundary, DTO → domain mapper), then the end-to-end property holds: elicit soundly (layer 3, P-A3) → execute in a bounded, terminal envelope (layer 3, P-A4) → route to the correct destination (layer 1, topology) → deliver exactly once (layer 2, P-A7) → within bounded, auditable, tenant-isolated authority (layer 4, P-A6/P-A8).
Principle 2 · Sector instantiationTension-free multiplication rule. Any sector deployment (P-C1…P-C10) that instantiates layers 1–4 without modifying them inherits their guarantees and adds only sector-specific properties. The platform is one product; sectors are views over the same core. There is no per-sector fork — there is typed composition over stable interfaces.
Principle 3 · Honest accountingHonesty rule. Declared guarantees correspond exactly to the properties implied by the implemented and measured mechanisms. Design/projected capabilities do not count as a guarantee until their mechanism is implemented. Invariant: no metric, no guarantee. If there is a guarantee, there is a dashboard.
Layer 1 · Topology & Engine

HAI engine — 13 question types

In production since 2016. A deliberately narrow, composable premise: an interaction is a workflow of typed questions, and the platform is a geolocated topology so that every answer lands in a well-defined context. In v2 the engine runs on two inference layers: the learned network (deterministic, no LLM) and A2A inference, which fills in the nodes that do not exist and collapses the network.

Zoom: 100%
HAI engine: typed questions → routing → context
Product · v1 → v2 modules

Calendar — sell services and manage the calendar

A seller offers services (type_event) with price, category, and availability; customers book (event) with attendee, date, and location. In white-label mode, any seller in the same network is visible and orderable — "others sell in my network". Payment creates a merchant in the network and looks up products by product_key.

Zoom: 100%
Calendar: sell services in the network
seller · personal orgnetwork = visibility boundarypayments · merchant in the network
Product · v1 → v2 modules

Market — sell products and let others sell in my network

The seller lists products (market_product) with merchant, provider, and price, and attaches offers/coupons to them. The customer builds the cart (market_item) and checks out (merchant_tx) with the network key stamped into json_data. Disputes and ratings on both sides. Merchants are bound to the network by merchant.network — "others sell in my network".

Zoom: 100%
Market: sell products in the network
seller · merchantnetwork key in the txdisputes + ratings
Product · v1 → v2 modules

HAI + matchmaking + chat — each user's personal network

HAI fills each user's personal network by understanding what they are looking for: networks are populated automatically from the business/government/community/union website or doc, question flows are generated, and so are the cross-links between matchings from different rooms (same or different community). Matchmaking automates processes: one user intent → a purchase order in the community's dispatch channel, geolocated in the target room. Real-time chat over socket + FCM. The flows are cross-cutting (they cross rooms) and run on the two inference layers: the learned network + A2A, which fills in and collapses.

Zoom: 100%
HAI + matchmaking + chat: the personal network
HAI · 13 question typesrooms · kitchen · dispatchreal-time chatcross-community
Product · v1 → v2 modules

Social — network promotions and user interaction

The network runs promotions in its space and users interact in a social module: news/stories with likes and comments, categories set by the admin. The social feed lives in the topology — the network publishes, the community fragments, the room receives.

Zoom: 100%
Social: promotions and interaction
network · publishes and promotesnews/stories · like · comment
Product · v1 → v2 modules

Two inference layers — the collapsing neural network

All modules live in rooms of a network and are cross-cutting: a dataflow (HAI) from a guest room with pre-sales connects to one from a customer with technical support. Unlike v1 (static graphs), here there are neural networks: if the subsequent node does not exist, A2A determines the next steps, saves them, and the network collapses. The scope is finite — what one user asks in a network is saved for everyone — and LLM consumption via A2A decreases over time, never grows.

Zoom: 100%
Two inference layers: learned network + A2A, finite collapse
rooms · cross-cutting dataflowslayer 1 · learned network · no LLMlayer 2 · A2A · holes onlyfinite scope · consumption decreases
Layer 2 · Platform

Verifiable multi-tenant isolation

Businesses, governments, NGOs, and communities have shared a single AI substrate since 2016, keeping what is private provably private. Full mediation by the Reference Monitor; the only allowed channel = public scopes.

Zoom: 100%
Multi-tenant isolation
private, never crossespublic, the only channel
Layer 2 · Platform

Federated networks and stable matchmaking

Networks federate over their public projections. Matchmaking operates only on public scopes within a proximity radius; deferred acceptance → stable matching.

Zoom: 100%
Federation: public projections between networks
Layer 3 · Interaction

Typed elicitation — learning in a few questions

The system asks, the user answers, and the answer becomes context. Elicitation is typed (the engine computes without surprises), faithful, and efficient. It runs on layer 1 (learned network, deterministic); when a node does not exist, layer 2 (A2A) determines the steps, persists them, and the network collapses — learning in a few questions, and every new question is saved for everyone.

Zoom: 100%
Typed elicitation
Layer 3 · Interaction

Agentic workflows — the envelope

Some nodes require open-ended work: an LLM agent that interleaves reasoning with tool calls (ReAct-style) until it has an answer of the correct type. This is inference layer 2 (A2A): when the subsequent node does not exist in the learned network, the agent determines the next steps, persists them, and the network collapses — LLM consumption decreases over time, never grows. The envelope bounds the three failure modes.

Zoom: 100%
Agentic node: reasoning + bounded tools

Not guaranteed: the semantic correctness of the value. An agent can finish, stay in scope, and emit a well-typed but wrong answer — this is addressed with evaluation and a human gate, not with the envelope.

Layer 3 · Interaction

Proactive assistance — the value of information

The inverse of a reactive chatbot: it initiates instead of waiting. The hard part is containment — speaking only when the expected net value of acting exceeds the value of staying silent.

Zoom: 100%
Proactive loop: observe → evaluate → act
Layer 4 · Governance

Bounded authority and provenance

An agent that can act — spend money, contact third parties, move data — must be bounded by what the user consented to, use information only for the given purpose, and leave a trail that makes it possible to explain and undo.

Zoom: 100%
Governance stack: consent → capability → log
Layer 4 · Governance

Autonomous networks in the service of human networks

Bounded delegation, contract-net allocation (announce → bid → award), and the honest limit of coordination: liveness only with partial synchrony.

Zoom: 100%
Autonomous network in the service of the human network
Cross-cutting

Security and the evidence protocol

Security

Saltzer–Schroeder principles

Complete mediation, economy of mechanism, fail-safe defaults. Security debt conditions several of the platform's guarantees.

Evidence

Deployment-supported claim

A claim C is supported in deployment iff (i) well-typed, (ii) every premise has validated evidence from the production pipeline, (iii) the premises satisfy the conclusion. Without that, C is a design claim.

Zoom: 100%
Security ontology
Security ontology: perimeters, trust, threats.
Zoom: 100%
Evidence pipeline
Pipeline: instrument → store → validate → audit.
Sectors

Ten sector instantiations

Each sector deployment instantiates layers 1–4 without modifying them and inherits their guarantees.

Sector 1

Multi-site business

Exactly-once delivery, Little's law, non-interference between sites.

Sector 2

Government

Equal treatment, auditability, impossibility of fairness.

Sector 3

Humanitarian

Leximin triage, optimal transport, privacy for the vulnerable.

Sector 4

Communities

Sustained cooperation, reputation, Ostrom's principles.

Sector 5

Healthcare

Care topology with clinical privacy.

Sector 6

Education

Learning paths over the topology.

Sector 7

Finance

Screening pipeline and the power curve.

Sector 8

Logistics

Movement of goods, price fairness.

Sector 9

Defensive

Explicit civil-defensive scope.

Sector 10

Community credit

Reputation and governance over the commons.

Honest accounting

Production / design / projected

Projected state
Projected-state map — self-assessment, not an external audit.
Production since 2016

Topology · engine · platform · elicitation · governance

The core mechanisms have been deployed since 2016.

Design 2026

Agentic · proactive · federation · autonomous

Capabilities largely in 2026 design; autonomous is design across its entire scope.

Projected

All quantitative evaluation

Every quantitative figure is projected, pending measurement on the live platform.

Backend · Rust 2026

17 crates, hexagonal, one Postgres

Composition root (api) → use-cases ×10 → adapters (ledger, a2a, courier) → domain (core, ZERO I/O). A single Postgres (Timescale pg17 + pgvector) for everything: ledger, events, embeddings, jobs/whisper geo-cache. SQL verified at compile time (.sqlx/ offline cache, 107 queries).

Zoom: 100%
Backend: api → use-cases → adapters → core → Postgres
api · composition rootuse-cases ×10adapterscore · ZERO I/OPostgres · Timescale pg17 + pgvector.sqlx/ · 107 queries offline
Backend · Hexagonal

Ports & adapters — domain at the center

The domain (everythink-core) knows no I/O. Adapters implement ports for DB, email, A2A. Use-cases orchestrate. The composition root (everythink-api) wires everything.

Zoom: 100%
Hexagonal: domain at the center
domain (ZERO I/O)adapters (sqlx, Brevo, A2A)use-cases
Backend · 17 crates

Why so many crates — one explicit role per crate

Each crate has a role: composition root (api), client (sdk, cli), use-case ×10, infra-adapter (a2a, courier), ports + persistence (ledger), domain (core).

Zoom: 100%
Crate role taxonomy
Backend · Workspace

17 crates flow into core

everythink-api is the hub; everything depends on core (ZERO I/O). The SDK lives inside the workspace (backend/crates/everythink-sdk) because it is coupled to core.

Zoom: 100%
Dependency graph: 17 crates → core

Note: libs/ holds SDKs in other languages (vendored refs, external code).

Backend · Request flow

From auth to persistence — one full request

Client → api (auth + rate-limit + validate) → loom (run) → ledger (resolve profile via the repo trait) → sisters (fan out) → oracle (merge → normalized Ensemble) → ledger (persist) → 200 OK.

Zoom: 100%
Request lifecycle
Backend · Use-cases

Six use-cases: orchestration, auth, and data

loom — orchestration: persists via the LoomStore port / LoomPersistence adapter. ingest — signal pipeline: processes incoming signals. scry — sentiment: the reference port SentimentReader / PgSentimentReader. eval — regression harness: continuous evaluation. warden — auth: JWT access/refresh, Google OAuth, IP-binding. whisper — HMAC-signed webhooks with exactly-once delivery.

Zoom: 100%
Use-cases: loom · ingest · scry · eval · warden · whisper
Backend · Security

Middleware chain — trace → timeout → CORS → routing

Incoming request → Trace + request_id → Timeout 60s → 408 → CORS + compression → route subtree with 5 branches.

Zoom: 100%
Middleware chain
Backend · Security

Three auth regimes coexist on one router

Public (probes/register/login/refresh) · Eye-Key (HMAC, sliding 60s rate limit) · user-JWT (warden, Console) · Atlas WS (self-auth, per-user caps).

Zoom: 100%
Three auth regimes
Backend · Security

RBAC without inheritance — one function, an explicit matrix

can(role, action) as a const fn: Owner → true; Profile Read/Write Self → true; explicit match on (role, action); the rest → Owner-only. AUTHORIZE in the handler → 403 on denial.

Zoom: 100%
RBAC can(role, action)
Backend · Data

One datastore for everything

timescale/timescaledb-ha:pg17 + pgvector (vector(1024) + HNSW). One pool. Six data domains: Ledger, Simulations, Users, Embeddings, geo_signals, Jobs. Health check: pg_isready in docker-compose (service_healthy).

Zoom: 100%
A single Postgres
Backend · Data

Persistence through a port, never through a concrete

Repository TRAIT · Pg*Repository (all the SQL lives here) · MockRepository (tests without a DB) · AppState: Arc<dyn Repository> · use-cases call the TRAIT.

Zoom: 100%
Trait ↔ adapter contract
Backend · Data

Compile-time-verified SQL, reversible migrations

Edit .up.sql + .down.sql (paired) → just sqlx-prepare → commit .sqlx/*.json (107 queries) → build/CI with SQLX_OFFLINE=true and no live DB.

Zoom: 100%
sqlx offline cache
Backend · Deploy specifics

Health checks + SQLX offline — precise deploys

docker-compose: postgres (pg_isready, 10s/5s/10) → dragonfly (redis-cli ping, 10s/3s/10) → api (service_healthy). app/admin: health check disabled (distroless/static). CI: SQLX_OFFLINE=true with the .sqlx/ cache committed.

Zoom: 100%
Backend deploy: health-check chain + SQLX workflow
postgres · pg_isready · interval 10s / timeout 5s / retries 10dragonfly · redis-cli ping · interval 10s / timeout 3s / retries 10api · depends_on service_healthySQLX_OFFLINE=true · .sqlx/ 107 queries
Backend · Realtime

SSE (Tide) + WebSocket (GeoHub) — per-tile fan-out

TideBroker: SSE with composite topics, broadcast 256, keep-alive 15s, Last-Event-ID reconnect. GeoHub: WS with DashMap[Tile → broadcast 64], viewport steering, gzip opt-in.

Zoom: 100%
Realtime: SSE + WS per-tile
Backend · Use-cases

Six orchestration and data use-cases

loom

Orchestration

Persists via the LoomStore port / LoomPersistence adapter.

ingest

Signal pipeline

Processes incoming signals into the system.

scry

Sentiment

The reference port SentimentReader / PgSentimentReader.

eval

Regression harness

Continuous quality evaluation.

warden

User auth

JWT access/refresh, Google OAuth, IP-binding.

whisper

HMAC webhooks

Durable, exactly-once delivery.

Backend · Use-cases

everythink-warden — user auth

warden

JWT access/refresh

Password hashing (bcrypt), rotating JWT access/refresh, Google OAuth, sessions with IP-binding for anomaly detection.

/api/v1/auth/*

register · login · refresh · me · google · sessions

The user-JWT boundary for Console + Atlas WS. The token is written to localStorage('everythink:auth') after a single sign-in at /auth.

Zoom: 100%
Warden: auth flow
Backend · Use-cases

everythink-whisper — signed webhooks and durable delivery

whisper

HMAC-signed webhooks

Delivery worker with the WhisperStore port / PgWhisperStore adapter. HMAC signature for payload verification at the receiver.

jobs

Durable queue in Postgres

Exponential retries, exactly-once semantics, dead-letter queue for persistent failures.

Zoom: 100%
Whisper: webhook delivery flow
Backend · Adapters

A2A (protocol) and Courier (email)

everythink-a2a

Google A2A protocol

JSON-RPC over HTTP with an agent task envelope, status polling, and result retrieval. Lets a Sister move out-of-process without changing callers.

everythink-courier

Transactional email

Brevo adapter or a logging no-op. Template rendering + delivery tracking for system notifications.

Zoom: 100%
Adapters: A2A + Courier
Backend · Clients

everythink-cli and everythink-sdk

everythink-cli

Operations tool

new-key bootstrap-mints Eye Keys: generates a local Ed25519 pair, fingerprint → Postgres, plaintext shown once in memory, HMAC for auth.

everythink-sdk

In-workspace Rust SDK

backend/crates/everythink-sdk: coupled to everythink-core, depends only on core (ZERO I/O), for domain consumers.

Zoom: 100%
Clients: CLI + SDK
Backend · Invariants

Six invariants that are never violated

1

Normalized probabilities

In exactly one place: everythink-oracle::ensemble. sum(prob) ≈ 1.0, scenarios sorted descending, entropy in nats.

2

Eye-Key plaintext never touches disk

Only the HMAC + fingerprint go to Postgres. The plaintext is shown once, in memory.

3

Sisters never write to Postgres

They return SisterOutput; the Loom persists. A clear separation between generation and storage.

4

Reversible migrations

Every .up.sql has its .down.sql. just migrate-add NAME creates both.

5

AppState repositories Arc<dyn Trait>

Tests use mocks. Depend on the trait, never on the concrete adapter.

6

Persistence through a port

Never a concrete Pg* outside its adapter. Slice-owned ports for private tables.

Zoom: 100%
Six invariants
Frontend · Next.js 16

4 apps, 13 packages, one identity

web (:3000) · app (:3001) · admin (:3002) · mobile (Expo). Packages: types, sdk-core + facades, domain, ui, auth, api-client, telemetry, config.

Zoom: 100%
Frontend: 4 apps + 13 packages
apps · Next.js 16 + Expotypes · domain · configsdk-core + facadesui · auth · api-client · telemetry
Frontend · C4 level 1

Four surfaces, one backend, three actors

Actors: end user (guest → authenticated) · developer (Eye-Key) · admin/operator (staff). Surfaces: web/app/admin/mobile. Backend API (REST + SSE under /api/v1).

Zoom: 100%
C4 context
Frontend · C4 level 2

Containers — the full monorepo

4 apps + SDK layer (6 facades) + services (4) + design system + tooling + types (leaf). Use the zoom to explore.

Zoom: 100%
C4 containers: full monorepo
Frontend · Apps

web, app, admin, mobile — one per audience

Zoom: 100%
The 4 apps
Frontend · SDK

Six facades, one core, zero endpoints in the core

sdk-core (HttpClient, consumeSSE, TokenProvider) · sdk-guest · sdk-auth · sdk-atlas · sdk-eye · sdk-admin.

Zoom: 100%
SDK layer: trust-scoped facades
Frontend · Packages

Application services, UI, and build-time

domain (mappers) · telemetry (outbox) · api-client (legacy) · auth (NextAuth v5 + RBAC) · ui (kit + tokens) · config (eslint presets) · types (Zod, leaf).

Zoom: 100%
Services + design + tooling
Frontend · SDK

sdk-core knows HOW, never WHAT

Endpoints live ONLY in the facades; sdk-core validates every response with Zod against @everythink/types; an SdkError tree with ContractViolation on drift.

Zoom: 100%
SDK facades: endpoints only in facades
Frontend · FSD + MVVM

Feature-Sliced Design + MVVM — imports flow downward

Screen (View) → View-model hook → feature.repository.ts (THE only door to the SDK). ESLint boundary no-restricted-imports (INV-1). FSD layers: shared → entities → features → widgets → app.

Zoom: 100%
FSD + MVVM repository boundary
Frontend · Identity

One login, one origin, four surfaces

apps/web /auth (one origin) → httpOnly cookie 'everythink_at' → token in memory + localStorage seed → EverythinkAuthGuard + resolveMe (GET /api/v1/auth/me) → role-based gate.

Zoom: 100%
Shared sign-in
Frontend · Identity

can(role, action) — explicit matrix, no inheritance

3 layers: (1) per-app auth.ts allowedRoles → (2) middleware → (3) can() in the UI + server actions. Mirrors everythink_core::rbac from the backend.

Zoom: 100%
Frontend RBAC
Frontend · UI

One stylesheet, semantic tokens, Tailwind v4

A single source of truth for design: CSS tokens in :root, semantic mapping via @theme (Tailwind v4), and NativeWind for mobile with mirrored tokens. The apps consume semantic components (bg-accent, text-foreground, font-display/mono), never raw hexes. Cosmic-purple palette: --gold: #d9ab5c, --violet: #9d7df5, --emerald: #10B981.

Zoom: 100%
UI/theme architecture: tokens → Tailwind → components
:root · CSS custom properties@theme · semantic Tailwind v4@everythink/ui · component kitMobile · mirrored NativeWind
Frontend · Types

Zod at the network boundary — a single contract

Wire types are defined once in @everythink/types with Zod. The SDK validates every backend response (z.parse(response)); an invalid payload throws ApiError, never a crash. Components never see raw JSON: *.repository.ts parses, @everythink/domain maps DTO → model, and the view-model exposes typed state to the View.

Zoom: 100%
Zod validation boundary: API → SDK → repository → domain → view-model
Backend API · JSONsdk-core · validates with Zod*.repository.ts · the only boundaryApiError · typed, never a crash
Frontend · Mobile

apps/mobile — Expo, expo-router, NativeWind

React Native with expo-router (file-based routing) and NativeWind (Tailwind for RN). The theme system mirrors the web design-system tokens (tailwind.config.js + src/theme/index.ts). It consumes sdk-guest, sdk-auth, sdk-atlas, domain, and telemetry. Excluded from web CI: --filter=!@everythink/mobile.

Zoom: 100%
Mobile app structure: Expo + NativeWind + theme
expo-router · file-based routingNativeWind · Tailwind RNsrc/theme · mirrored tokensCI · excluded from web turbo
Frontend · Rules

Four mechanically enforced rules

Rules verifiable by ESLint + TypeScript, not conventions: (1) INV-1: only *.repository.ts imports an SDK (no-restricted-imports); (2) FSD layers: imports flow DOWN (shared → entities → features → widgets → app), cross-feature only through the public barrel; (3) Shared sign-in: web + app share localStorage('everythink:auth') + resolveMe(); (4) 3-layer RBAC: auth.ts allowedRoles → middleware → can(role, action) in the UI + server actions.

Zoom: 100%
FSD layers + INV-1 + sign-in + RBAC
INV-1 · only repository.ts imports an SDKFSD · imports DOWNSign-in · localStorage + resolveMeRBAC · 3 layers, no inheritance
Deploy · docker-compose.prod.yml

7 services, TLS at the ALB, secrets in .env

ALB → nginx :80 → api/web/app/admin + postgres + dragonfly. A single Postgres for everything (TimescaleDB pg17 + pgvector). Dragonfly for cache, jobs, and SSE fan-out.

TLS at the AWS ALB preprod direct deploy CI/CD 2-tier
api · migrations on startupweb · Next.js standalonepostgres · pg17 + pgvectorapp/admin · static distroless
Deploy · Stack

docker-compose.prod.yml — the full stack

ALB (TLS) → nginx :80 → api (:18081, migrations on startup) · web (Next standalone) · app/admin (static distroless) · postgres (timescale/timescaledb-ha:pg17 + pgvector) · dragonfly (Redis-compatible). 7 services: postgres · dragonfly · api · web · app · admin · nginx.

Zoom: 100%
Production stack · 7 services
postgres · timescaledb-ha:pg17 + pgvectordragonfly · Redis-compatibleapi · migrations on startupweb · Next.js standaloneapp/admin · static distroless
Deploy · Network

nginx as the single entry point

nginx :80 is the only internal entry point. It routes /api/v1/* → api:18081, / → web:3000, /app/* → static, /admin/* → static. web talks to api via EVERYTHINK_API_INTERNAL_URL (http://api:18081). api depends on postgres and dragonfly with condition: service_healthy.

Zoom: 100%
nginx routing diagram
nginx · single entry pointweb → api · INTERNAL_URLhealth checks · service_healthy
Deploy · Secrets

backend/.env — the only place for secrets

docker-compose.prod.yml mounts backend/.env via env_file on the api and web services. api holds all the secrets (JWT_SECRET, EYE_KEY_HMAC_SECRET, GOOGLE_CLIENT_ID, BREVO_API_KEY). web only receives NEXT_PUBLIC_* variables — it never holds BREVO_API_KEY. app/admin are static distroless with no secrets in the build.

Zoom: 100%
Secrets boundary diagram
api · all the secretsweb · NEXT_PUBLIC_* onlyrule · web does NOT hold Brevo
Deploy · Flow

Direct preprod vs the CI/CD gate

Two deploy paths: preprod deploys directly from the working tree (without going through main); prod requires a merge to main and the integrity gate. The rule is critical: do NOT use the deploy workflow for preprod, because it pulls :latest from main and overwrites the direct deploy.

Zoom: 100%
Preprod vs Prod deploy flow
preprod · working tree → scriptprod · main → :latest → workflowrule · NO deploy workflow for preprod
CI/CD · GitHub Actions

affected on PRs, integrity on main

A 2-tier pipeline: the PR tier runs only what is affected (backend: ci-affected-crates.sh; frontend: turbo --affected), the main tier runs full integrity (complete backend + frontend/mobile + E2E + security). main stays green and deployable.

Zoom: 100%
CI/CD 2-tier pipeline
just ci · fmt · lint · check · testpnpm ci · turbo lint · typecheck · buildmain integrity · full + E2E + security
Roadmap · 🔵 Not implemented

Federated self-hosted nodes · BYOK · per-network DAO

Roadmap direction for v2. None of the following is an existing capability. Flow: the operator generates a local Ed25519 pair → only the fingerprint goes to the controller (BYOK) → self-hosted node → ledger anchoring → federation over public projections only → network DAO.

Zoom: 100%
Roadmap v2: self-hosted · BYOK · DAO
Roadmap · Phases

Five phases toward v2

PhaseItemDepends onDeliverable
1BYOKcrate everythink-byok · table node_keys · Ed25519 identity + webhooks · controller holds fingerprints only
2Ledger anchoringPhase 1crate everythink-anchor · table anchor_commitments · notarization job · chain = operator decision
3Federated self-hosted nodesPhases 1–2node Docker image (postgres, dragonfly, api, web, app, admin, nginx) · federation protocol
4Per-network DAOPhase 2crate everythink-dao · network_proposals/network_votes/provenance_log append-only
5Wallet + governancecrate everythink-wallet · wallets/network_memberships · employee/entrepreneur/self-employed personas

Each phase: a .up.sql + .down.sql migration, an offline .sqlx cache refresh, TDD (80%+), green just ci. The organization-type structure is implemented (5-value OrgKind, DB CHECK, onboarding of 7 legal structures).

Roadmap · Anchoring

Reference architecture of the candidate chain

Architecture reference for notarizing Postgres ledger hash commitments: Solana v0.8.13 (Yakovenko) — PoH as a cryptographic clock, PoS consensus with bonds/slashing, PoRep for storage. Chain selection is an explicit operator decision; this is a reference, not an implementation.

Zoom: 100%
Candidate chain engines
PoH · verifiable time stepPoS · bonds · slashing · ⅔ super-majorityPoRep · streaming · storageLeader → Verifiers · confirmations = votes~710k TPS · sub-second finalityCAP: consistency over availability
Closing

Everythink Studio — complete architecture

From vision to implementation: topology and the HAI engine (production since 2016), a Rust backend with 17 hexagonal crates, a Next.js 16 frontend with FSD/MVVM, Postgres + pgvector, 2-tier CI/CD, deployment. Boundary note: the forecasting engine (sisters/oracle/loom) is another product by the same author, in-workspace.

Rust 2026 · 17 crates Postgres + pgvector · sqlx Next.js 16 · pnpm · FSD 3 auth regimes · RBAC can() World Monitor · geo-signals CI/CD 2-tier · preprod direct
Initial version · progressive download This document is the initial version of the architecture and does not contain the complete architecture. The incompleteness is expected and by design: the architecture will be progressively downloaded from the aap-human-agent template — the human-agent interaction patterns package (escalation, delegation, proxy agents, authority boundaries). Agents execute the download; authority remains with the human.

Everythink Studio · Carlos Matias Baglieri 2026 · docs/architecture.md · backend/README.md · frontend/README.md · COLLABORATION.md · cto.md

Everythink Studio · Architecture
1 / 64 ← →