tpt-cerebrum
RustFirst-principles, multi-scale computational platform for the central nervous system — unifying electrophysiology, neuroimaging, connectomics, and molecular neurobiology into a single Digital Brain environment.
Languages
tpt-cerebrum
Neuroscience data platform for connectomic, electrophysiological, transcriptomic, simulation, and translational (pathology / neurotechnology) research data.
tpt-cerebrum is a Rust + TypeScript monorepo implementing the full 4-phase
roadmap in spec.txt and tracked in TODO.md. It is
deliberately built on two custom storage engines rather than a consolidated
off-the-shelf database:
tpt-cerebrum-connectome-store— a sparse-graph engine for macro- and micro-scale connectomes (CSR/CSC adjacency, typed nodes/edges, native graph-theory primitives).tpt-cerebrum-tsdb— a high-frequency, columnar, multi-channel time-series engine for electrophysiology (millions of samples/sec across many channels).
Volumetric imaging (NIfTI/DICOM/MINC, Zarr/COG) lives in S3-compatible object
storage (MinIO) via tpt-cerebrum-volumetric. Access control is a custom
capability-token cryptosystem (tpt-cerebrum-capability) plus a hash-chained
audit ledger (tpt-cerebrum-audit); the tpt-cerebrum-zk crate pursues a
genuine ZK-SNARK track as a non-blocking parallel R&D effort.
Architecture at a glance
┌─────────────────────────────────────────┐
Browser / SPA ─────▶ │ tpt-cerebrum-api (single binary) │
(React + deck.gl) │ - axum HTTP router │
│ - capability auth + audit middleware │
│ - domain modules: nexus / chronos / │
│ cytos / simulacrum / praxis / │
│ pathos / symbiosis │
└───────┬───────────────┬──────────┬────────┘
│ │ │
┌────────────▼───┐ ┌────────▼─────┐ ┌─▼──────────────┐
│ connectome-store│ │ tsdb │ │ volumetric │
│ (in-process lib)│ │ (in-process │ │ (MinIO / S3) │
│ │ │ lib) │ │ │
└────────┬────────┘ └──────┬────────┘ └────────────────┘
│ │
▼ ▼
┌────────────────────────────────────┐
│ tpt-cerebrum-core (data access) │
│ - PostgreSQL (relational metadata)│
│ - capability verifier + audit │
└────────────────────────────────────┘
The connectome-store and tsdb engines are in-process libraries embedded
in the API binary — they are not standalone gRPC services. Deploying the
platform means running the single tpt-cerebrum-api process (plus PostgreSQL
and MinIO).
Quickstart (local, Docker Compose)
Prerequisites: Docker + Docker Compose.
# Bring up the full stack: postgres, minio, api, frontend, audit-integrity.
docker compose up -d
# Wait for the api health check to pass.
curl -f http://localhost:8080/health
# Issue a capability token and use it (see "End-to-end example" below).
curl -s -X POST http://localhost:8080/auth/issue \
-H 'Content-Type: application/json' \
-d '{"subject":"demo","resource_class":"eeg_raw","action":"read","expiry_hours":1}'
Tear down:
docker compose down -v
Seeded demo
# One command: bring up the stack *and* seed a demo subject + token.
docker compose --profile demo up -d
The demo profile adds a seed job that issues a token and creates a demo
subject against the running API (see deploy/seed/seed.sh).
Building from source
# Rust workspace (std crates)
cargo build --workspace --exclude tpt-cerebrum-stream
cargo test --workspace --exclude tpt-cerebrum-stream
# no_std edge-ingestion crate (cross-compile, no default features)
cargo build --package tpt-cerebrum-stream --target thumbv7em-none-eabihf --no-default-features
# Frontend
cd frontend && npm ci && npm run build
The API binary is tpt-cerebrum-api:
cargo run -p tpt-cerebrum-api --bin tpt-cerebrum-api
Environment
| Variable | Default | Purpose |
|---|---|---|
API_ADDR | 0.0.0.0:8080 | Bind address |
API_CORS_ORIGINS | http://localhost:3000 | Comma-separated CORS origins |
DATABASE_URL | postgres://postgres:postgres@localhost:5432/cerebrum | PostgreSQL connection string |
AUDIT_DATA_DIR | ./data/audit.db | Hash-chained audit ledger path |
TSDB_DATA_DIR | ./data/tsdb | Time-series chunk directory |
CEREBRUM_ROOT_KEY | (unset → ephemeral dev key per start) | PEM root key for capability tokens |
MINIO_* | minioadmin / localhost:9000 | Volumetric object store |
End-to-end example
Issue a token, create a subject, then query through the capability-gated API:
# 1. Issue a capability token.
TOKEN=$(curl -s -X POST http://localhost:8080/auth/issue \
-H 'Content-Type: application/json' \
-d '{"subject":"researcher_1","resource_class":"eeg_raw","action":"read","expiry_hours":1}' \
| jq -r .token)
# 2. Create a subject (token as bearer credential).
curl -s -X POST http://localhost:8080/subjects \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{"species":"homo_sapiens","sex":"F"}'
# 3. List subjects.
curl -s http://localhost:8080/subjects -H "Authorization: Bearer $TOKEN"
# 4. Verify the access was recorded in the audit ledger.
curl -s http://localhost:8080/audit/integrity -H "Authorization: Bearer $TOKEN"
A copy of this flow is in examples/e2e_smoke.sh.
Deployment
Dual deployment paths are maintained in parity:
- Docker Compose —
deploy/docker-compose.yml(+docker-compose.override.ymlfor local dev). Thedemoprofile seeds data. - Kubernetes / Helm —
deploy/helm/tpt-cerebrum/.helm lint/helm templateare exercised in CI. The chart packages the full ingest+sim stack for on-prem / partner-site federation deploys (Phase 4).
Repository layout
| Crate | Responsibility |
|---|---|
tpt-cerebrum-core | Shared data-access layer (Postgres + stores + security) |
tpt-cerebrum-capability | Ed25519 capability tokens, attenuation, revocation |
tpt-cerebrum-audit | Append-only hash-chained audit ledger |
tpt-cerebrum-connectome-store | Sparse-graph engine (macro + micro connectome) |
tpt-cerebrum-tsdb | High-frequency columnar time-series engine |
tpt-cerebrum-volumetric | MinIO/S3 volumetric (NIfTI/DICOM/Zarr) wrapper |
tpt-cerebrum-stream | no_std, zero-alloc edge ingestion parser |
tpt-cerebrum-dicom | NIfTI/DICOM/MINC parsing + defacing |
tpt-cerebrum-nexus | Macro-structure: tractography + functional connectivity |
tpt-cerebrum-chronos | Temporal dynamics: spike-sorting, LFP, ERP |
tpt-cerebrum-cytos | Single-cell / spatial transcriptomics |
tpt-cerebrum-simulacrum | Biophysical / neural-mass simulation |
tpt-cerebrum-praxis | Behavioral / psychometric + decoding |
tpt-cerebrum-pathos | Translational pathology models |
tpt-cerebrum-symbiosis | BCI decoding / neuromodulation / neuroprosthetics |
tpt-cerebrum-zk | ZK-SNARK proof track (non-blocking R&D) |
tpt-cerebrum-federation | Encrypted weight exchange + audit reconciliation |
tpt-cerebrum-soma | tpt-soma interop client surface |
tpt-cerebrum-api | The single runnable HTTP service + binary |
See docs/adr for the architecture decision records behind the
build-vs-buy and security choices, and CONTRIBUTING.md for
build/test/lint and PR expectations.