Documentation Index Fetch the complete documentation index at: https://mintlify.com/wtyler2505/ProtoPulse/llms.txt
Use this file to discover all available pages before exploring further.
All of ProtoPulse’s persistent state lives in PostgreSQL. The schema is defined in shared/schema.ts — a single TypeScript file that drives table structure, API validation (via Zod), and static typing simultaneously. This page documents each table group, its columns, and how the tables relate to one another.
Overview
ORM: Drizzle ORM (drizzle-orm + drizzle-kit)
Schema file: shared/schema.ts (single source of truth)
Zod validators: generated automatically from each table using createInsertSchema() from drizzle-zod
TypeScript types: inferred from the Drizzle schema using $inferSelect and z.infer<>
Soft deletes: projects, architecture_nodes, architecture_edges, and bom_items use a deleted_at timestamp; all other tables use hard deletes
The schema has grown beyond the original 27 tables documented here. As of the 0002 migration (2026-03-08), the core schema covers the 27 tables below. The Unified Parts Catalog (ADR 0010) and Arduino Workbench features introduce additional tables that will be documented in their respective feature guides.
Tables by domain
These tables form the authentication and project ownership foundation. All project-scoped tables cascade on projects.id. usersRegistered accounts. Password hashing uses scrypt. Column Type Notes idserial PKAuto-increment usernametextNOT NULL, UNIQUE password_hashtextNOT NULL — scrypt output created_attimestampDEFAULT NOW
sessionsActive login sessions. Sessions expire after 7 days. Column Type Notes idtext PKUUID — sent as X-Session-Id header user_idinteger FK → users.id CASCADEexpires_attimestampNOT NULL — 7-day TTL created_attimestampDEFAULT NOW
api_keysEncrypted AI provider API keys (Gemini, Anthropic). The key value is never stored in plaintext. Column Type Notes idserial PKuser_idinteger FK → users.id CASCADEprovidertexte.g. gemini, anthropic encrypted_keytextAES-256-GCM ciphertext ivtextInitialization vector (hex) created_attimestampDEFAULT NOW
user_chat_settingsPer-user AI configuration. One row per user (unique on user_id). Column Type Notes idserial PKuser_idinteger FK → users.id CASCADEUNIQUE ai_providertextDEFAULT anthropic ai_modeltextDEFAULT claude-sonnet-4-5-20250514 ai_temperaturerealDEFAULT 0.7 custom_system_prompttextDEFAULT '' routing_strategytextuser | auto | quality | speed | cost; DEFAULT userpreview_ai_changesbooleanDEFAULT true updated_attimestampDEFAULT NOW
projectsTop-level project container. All design data belongs to a project. Column Type Notes idserial PKnametextNOT NULL descriptiontextDEFAULT '' owner_idinteger FK → users.idNULLABLE versionintegerDEFAULT 1 — incremented on update created_attimestampDEFAULT NOW updated_attimestampDEFAULT NOW deleted_attimestampNULLABLE — soft delete marker approved_attimestampNULLABLE — design review approval approved_byinteger FK → users.idNULLABLE
Indexes: idx_projects_owner, idx_projects_owner_deleted
The architecture editor stores block diagrams as nodes and edges in React Flow format. architecture_nodesIndividual blocks on the architecture canvas (MCU, sensor, power, connector, etc.). Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEnode_idtextClient-generated UUID; UNIQUE per project node_typetext1–100 chars; e.g. mcu, sensor, power, comm, connector labeltextNOT NULL — display name position_xrealCanvas X coordinate position_yrealCanvas Y coordinate datajsonbNULLABLE — { description?, componentPartId? } versionintegerDEFAULT 1 updated_attimestampDEFAULT NOW deleted_attimestampNULLABLE — soft delete
Indexes: idx_arch_nodes_project, idx_arch_nodes_project_deleted, unique uq_arch_nodes_project_node, GIN index on data (jsonb_path_ops)architecture_edgesConnections between architecture nodes, carrying signal metadata. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEedge_idtextClient-generated UUID; UNIQUE per project sourcetextSource node_id targettextTarget node_id labeltextNULLABLE — e.g. SPI Bus animatedbooleanDEFAULT false — React Flow animation stylejsonbNULLABLE — { stroke?: string } signal_typetextNULLABLE — SPI, I2C, UART, analog, etc. voltagetextNULLABLE — e.g. 3.3V bus_widthintegerNULLABLE net_nametextNULLABLE — named net reference versionintegerDEFAULT 1 deleted_attimestampNULLABLE — soft delete
Indexes: idx_arch_edges_project, idx_arch_edges_project_deleted, unique uq_arch_edges_project_edge
The circuit domain models schematic, breadboard, and PCB views. A project can have multiple circuit_designs (hierarchical sheets); each design has its own instances, nets, and wires. circuit_designsTop-level circuit schematic. Supports hierarchical sheets via parent_design_id. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEparent_design_idintegerNULLABLE — links to parent sheet for hierarchy nametextDEFAULT Main Circuit descriptiontextNULLABLE settingsjsonbNOT NULL, DEFAULT {} versionintegerDEFAULT 1 created_at / updated_attimestampDEFAULT NOW
circuit_instancesComponent placements within a circuit design. Tracks position across all three views (schematic, breadboard, PCB). Column Type Notes idserial PKcircuit_idinteger FK → circuit_designs.id CASCADEpart_idinteger FK → component_parts.id SET NULLreference_designatortexte.g. R1, U2 schematic_x/yrealDEFAULT 0 schematic_rotationrealDEFAULT 0 breadboard_x/yrealNULLABLE pcb_x/yrealNULLABLE pcb_rotationrealDEFAULT 0 pcb_sidetextDEFAULT front propertiesjsonbNOT NULL, DEFAULT {}
circuit_netsElectrical nets — the logical connections between component pins. Column Type Notes idserial PKcircuit_idinteger FK → circuit_designs.id CASCADEnametextNOT NULL net_typetextsignal | power | ground | bus; DEFAULT signalvoltagetextNULLABLE bus_widthintegerNULLABLE segmentsjsonbDEFAULT [] — connection segments (instance + pin pairs) labelsjsonbDEFAULT [] — net labels with positions stylejsonbDEFAULT {} — visual style
circuit_wiresPhysical wire routing for a net in a specific view. Column Type Notes idserial PKcircuit_idinteger FK → circuit_designs.id CASCADEnet_idinteger FK → circuit_nets.id CASCADEviewtextschematic | breadboard | pcbpointsjsonbNOT NULL, DEFAULT [] — array of {x, y} points layertextDEFAULT front widthrealDEFAULT 1.0 wire_typetextDEFAULT wire provenancetextDEFAULT manual — manual or autorouted
hierarchical_portsInter-sheet connection ports for hierarchical circuit designs. Column Type Notes idserial PKdesign_idinteger FK → circuit_designs.id CASCADEport_nametextNOT NULL directiontextinput | output | bidirectional; DEFAULT bidirectionalnet_nametextNULLABLE position_x/yrealDEFAULT 0
Bill of Materials tracking, point-in-time snapshots for diffing, and component lifecycle / obsolescence monitoring. bom_itemsLine items in a project’s bill of materials. bom_items is a legacy table. New code should use the Unified Parts Catalog (parts + part_stock) introduced in ADR 0010. The bom_items table is kept for compatibility during the Phase 5–7 migration window.
Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEpart_numbertextNOT NULL manufacturertextNOT NULL descriptiontextNOT NULL quantityintegerDEFAULT 1 unit_pricenumeric(10,4)NOT NULL total_pricenumeric(10,4)Computed server-side: qty × unit_price suppliertextNOT NULL stockintegerDEFAULT 0 statustextIn Stock | Low Stock | Out of Stock | On Orderlead_timetextNULLABLE deleted_attimestampNULLABLE — soft delete
bom_snapshotsPoint-in-time BOM captures used for the BOM diff / comparison view. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADElabeltextNOT NULL — human-readable name, e.g. v1.0 release snapshot_datajsonbNOT NULL — serialized BomItem[] at capture time created_attimestampDEFAULT NOW
component_lifecycleObsolescence and lifecycle status tracking per BOM part number. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEbom_item_idintegerNULLABLE — links to bom_items part_numbervarchar(100)NOT NULL manufacturervarchar(200)NULLABLE lifecycle_statusvarchar(50)active | nrnd | eol | discontinued; DEFAULT activelast_checked_attimestampNULLABLE alternate_part_numberstextNULLABLE — comma-separated alternates data_sourcevarchar(100)NULLABLE notestextNULLABLE
Custom component definitions used by the Component Editor and referenced by circuit instances. component_partsProject-scoped custom component definitions. Each part stores its visual representations (breadboard, schematic, PCB) and electrical connectors as JSONB. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEnode_idtextNULLABLE — links to architecture node metajsonbPartMeta — title, family, manufacturer, tags, etc.connectorsjsonbArray of Connector objects (pin definitions) busesjsonbArray of Bus objects viewsjsonbPartViews — breadboard, schematic, PCB shapesconstraintsjsonbArray of Constraint objects (DRC rules) versionintegerDEFAULT 1 — auto-incremented on update
Indexes: GIN indexes on meta and connectors for JSONB path queries.component_libraryGlobal shared component library. Components can be public, forked, and downloaded by other users. Column Type Notes idserial PKtitletextNOT NULL descriptiontextNULLABLE meta / connectors / buses / views / constraintsjsonbSame structure as component_parts tagstext[]NOT NULL, DEFAULT [] categorytextNULLABLE is_publicbooleanDEFAULT false author_idtextNULLABLE forked_from_idintegerNULLABLE — self-reference for forks download_countintegerDEFAULT 0
spice_modelsGlobal SPICE model library. Not project-scoped; seeded with ~20 standard models on first run. Column Type Notes idserial PKnametextNOT NULL — e.g. 2N2222 model_typetextEnum: NPN, PNP, DIODE, ZENER, NMOS, PMOS, OPAMP, TIMER, RESISTOR, CAPACITOR, INDUCTOR, and more spice_directivetextFull .MODEL or .SUBCKT directive parametersjsonbKey model parameters categorytexttransistor | diode | opamp | passive | ic | voltage_regulator | mosfet | jfetdatasheettextNULLABLE — datasheet URL
Tables that record the AI conversation history, user action log, and AI tool execution audit trail. chat_messagesMessages in the AI chat panel. Supports conversation branching. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEroletextuser | assistant | systemcontenttextNOT NULL — message body (may contain Markdown) timestamptimestampDEFAULT NOW modetextDEFAULT chat branch_idtextNULLABLE — conversation branch identifier parent_message_idintegerNULLABLE — parent message for branching metadatatextNULLABLE
Indexes: idx_chat_messages_project, idx_chat_messages_project_ts (for chronological queries), idx_chat_messages_branchhistory_itemsHuman-readable action history shown in the Sidebar history panel. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEactiontextNOT NULL — description of the action usertextNOT NULL — User or AI timestamptimestampDEFAULT NOW
ai_actionsAudit log of every AI tool call — tool name, parameters, and result. Used for replay and debugging. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEchat_message_idtextNULLABLE — links to the triggering chat message tool_nametextNOT NULL — AI tool function name, e.g. addArchitectureNode parametersjsonbNOT NULL, DEFAULT {} — tool call inputs resultjsonbNOT NULL, DEFAULT {} — tool call output statustextDEFAULT completed created_attimestampDEFAULT NOW
DRC/ERC results and SPICE simulation outputs. validation_issuesDesign rule check and electrical rules check results. Populated by the AI’s validation tools and the client-side DRC engine. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEseveritytexterror | warning | infomessagetextNOT NULL — human-readable description component_idtextNULLABLE — references a node label or reference designator suggestiontextNULLABLE — suggested fix
simulation_resultsStored SPICE simulation outputs. Each row is one simulation run. Column Type Notes idserial PKcircuit_idinteger FK → circuit_designs.id CASCADEanalysis_typetextop | tran | ac | dcconfigjsonbSimulation parameters (stop time, step, frequency range, etc.) resultsjsonbNode voltages, branch currents, waveform data statustextcompleted | failed; DEFAULT completedengine_usedtextNULLABLE — simulator engine name elapsed_msintegerNULLABLE — wall-clock time size_bytesintegerNULLABLE — result payload size errortextNULLABLE — error message if status is failed
design_preferencesAI-learned per-project user preferences (component families, routing styles, etc.). Unique per (project_id, category, key). Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEcategorytextPreference category, e.g. component, routing keytextPreference key, e.g. preferred_mcu_family valuetextPreference value sourcetextai | user; DEFAULT aiconfidencerealAI confidence score; DEFAULT 0.8
Unique index: uq_design_prefs_project_cat_key on (project_id, category, key)
Point-in-time captures and threaded code-review-style comments on design elements. design_snapshotsPoint-in-time captures of the architecture diagram (nodes + edges JSON). Used for visual diff and rollback. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEnamevarchar(200)NOT NULL — e.g. Before major refactor descriptiontextNULLABLE nodes_jsonjsonbNOT NULL — serialized node array at capture time edges_jsonjsonbNOT NULL — serialized edge array at capture time created_attimestampDEFAULT NOW
Threaded, spatially-anchored comments for design review. Comments can be attached to nodes, edges, BOM items, or placed at arbitrary canvas coordinates. Column Type Notes idserial PKproject_idinteger FK → projects.id CASCADEuser_idinteger FK → users.idNULLABLE parent_idintegerNULLABLE — self-reference for thread replies target_typetextgeneral | node | edge | bom_item | spatialtarget_idtextNULLABLE — ID of the target element spatial_x/yrealNULLABLE — canvas coordinates for spatial pins spatial_viewtextarchitecture | schematic | pcb | breadboardcontenttextNOT NULL — Markdown supported statustextopen | resolved | blocked | wontfix; DEFAULT openstatus_updated_byinteger FK → users.idNULLABLE status_updated_attimestampNULLABLE
Indexes: idx_design_comments_project, idx_design_comments_project_target, idx_design_comments_parent
Viewing and modifying the schema
Browse the schema interactively
Drizzle Studio provides a web-based database browser:
This opens a local web UI where you can browse tables, run queries, and inspect row data.
Modify the schema
All schema changes start in shared/schema.ts. After editing, sync the changes to your local database:
# Development — fast direct sync (no migration file)
npm run db:push
# Generate a migration file for production deployments
npm run db:generate
Never edit the database directly with ALTER TABLE or psql when using Drizzle. All schema changes must go through shared/schema.ts so that TypeScript types and Zod validators stay in sync. Out-of-band changes will cause type errors and potential runtime failures.
The generated migration files are stored in migrations/ and should be committed to source control. In production deployments, apply them with npm run db:migrate.
Add a new table
Define the table in shared/schema.ts using pgTable()
Add a createInsertSchema() call to generate the Zod validator
Export InsertX and X TypeScript types with z.infer<> and $inferSelect
Add the corresponding IStorage methods to server/storage.ts
Run npm run db:push locally to apply the change
Run npm run check to verify TypeScript is still clean
For related reading, see System Architecture and the API Overview .