Neo4j (Web App Integration)
Last Updated: 2026-07-07
This page covers how the web app connects to Neo4j and where to find the canonical schema documentation.
Schema documentation
- Canonical graph model: Data Model
- Schema artifacts + generators: Generated Schema Artifacts
Environment variables
The web app expects:
NEO4J_URINEO4J_USERNAMENEO4J_PASSWORD
When any of these are missing the driver helpers return null instead of
throwing, so next build can evaluate modules without a database.
Conventions
- Reads are wrapped in React
cache()for request-scoped deduplication, returnnull/[]when nothing matches, and let infrastructure errors bubble to the caller. - Writes throw when the operation fails.
- Raw nodes are translated through
translation.tsinto validated application types (db-types→translation→application-types, with Zod schemas invalidation.tsenforced in development). - Bulk ingestion writes (.ork design geometry, flight telemetry) happen in the
data-platform lambdas (
ork-processor,flight-processor), not inapps/web. The web app writes interactive data (flight shells, sources, comments, ownership relationships) andRenderJobnodes that track the flight-render pipeline (render-jobs.ts).
File structure
apps/web/src/lib/neo4j.ts- Driver singleton,executeRead/executeWritehelpers, error contractapps/web/src/lib/neo4j/clubs.ts- Club queriesapps/web/src/lib/neo4j/designs.ts- Design queriesapps/web/src/lib/neo4j/flights.ts- Flight queries and interactive flight writesapps/web/src/lib/neo4j/manufacturers.ts- Manufacturer queriesapps/web/src/lib/neo4j/models.ts- Model (build/"my rocket") queries and ownership checksapps/web/src/lib/neo4j/motors.ts- Motor catalog queriesapps/web/src/lib/neo4j/render-jobs.ts-RenderJobnode reads/writes for the flight-render pipelineapps/web/src/lib/neo4j/seed-manufacturers.ts- Manufacturer seeding utilitiesapps/web/src/lib/neo4j/db-types.ts- Database-shaped TypeScript interfaces based on the shared graph schemaapps/web/src/lib/neo4j/application-types.ts- Application-level types (Zod-inferred)apps/web/src/lib/neo4j/translation.ts- Node → application-type translatorsapps/web/src/lib/neo4j/validation.ts- Zod schemas and validation wrappersapps/web/src/types/flight.ts- Flight-specific TypeScript interfaces
Visual schema tools
The schema can be visualized/edited using Arrows.app:
- Import
apps/web/data/neo4j-arrows-schema.jsoninto https://arrows.app - Make changes visually
- Export back to JSON as needed