a2a36141f08f46c0b899b46e9e5e46dfedca2b42
Implement the full Bill of Materials stack on top of the existing
relationships table and bom_single_level view from migration 001.
API endpoints (6 new routes under /api/items/{partNumber}/bom):
- GET /bom Single-level BOM for an item
- GET /bom/expanded Multi-level BOM via recursive CTE (depth param)
- GET /bom/where-used Reverse lookup: which parents use this item
- POST /bom Add child to BOM with quantity, ref designators
- PUT /bom/{child} Update relationship type, quantity, ref des
- DELETE /bom/{child} Remove child from BOM
Database layer (internal/db/relationships.go):
- RelationshipRepository with full CRUD operations
- Single-level BOM query joining relationships with items
- Multi-level BOM expansion via recursive CTE (max depth 20)
- Where-used reverse lookup query
- Cycle detection at insert time to prevent circular BOMs
- BOMEntry and BOMTreeEntry types for denormalized query results
Server wiring:
- Added RelationshipRepository to Server struct in handlers.go
- Registered BOM routes in routes.go under /{partNumber} subrouter
FreeCAD workbench (pkg/freecad/silo_commands.py):
- 9 new BOM methods on SiloClient (get, expanded, where-used, add,
update, delete)
- Silo_BOM command class with two-tab dialog:
- BOM tab: table of children with Add/Edit/Remove buttons
- Where Used tab: read-only table of parent assemblies
- Add sub-dialog with fields for part number, type, qty, unit, ref des
- Edit sub-dialog pre-populated with current values
- Remove with confirmation prompt
- silo-bom.svg icon matching existing toolbar style
- Command registered in InitGui.py toolbar
No new migrations required - uses existing relationships table and
bom_single_level view from 001_initial.sql.
Kindred Silo
Item database and part management system for Kindred Create.
Overview
Kindred Silo is an R&D-oriented item database with:
- Configurable part number generation via YAML schemas
- FreeCAD integration with git-like commands (checkout, commit, status)
- Revision tracking with append-only history
- BOM management with reference designators and alternates
- Physical inventory tracking with hierarchical locations
Components
silo/
├── cmd/
│ ├── silo/ # CLI tool
│ └── silod/ # API server
├── internal/
│ ├── api/ # HTTP handlers, routes, and templates
│ ├── config/ # Configuration loading
│ ├── db/ # PostgreSQL access
│ ├── migration/ # Property migration utilities
│ ├── partnum/ # Part number generation
│ ├── schema/ # YAML schema parsing
│ └── storage/ # MinIO file storage
├── pkg/
│ └── freecad/ # FreeCAD workbench (Python)
├── migrations/ # Database migration SQL scripts
├── schemas/ # Part numbering schema definitions (YAML)
├── deployments/ # Docker Compose and systemd configs
├── scripts/ # Deployment and setup scripts
└── docs/ # Documentation
Quick Start
# Database setup
psql -h psql.kindred.internal -U silo -d silo -f migrations/001_initial.sql
# Configure
cp config.example.yaml config.yaml
# Edit config.yaml with your settings
# Run server
go run ./cmd/silod
# CLI usage
go run ./cmd/silo register --schema kindred-rd --category F01
Configuration
See config.example.yaml for all options.
Kindred Create Integration
Install the workbench:
ln -s $(pwd)/pkg/freecad ~/.local/share/FreeCAD/Mod/KindredSilo
Then in Kindred Create, use the Silo workbench toolbar commands:
- Pull - Download an item by part number
- Commit - Save current state as a new revision with comment
- Push - Batch upload modified files
- Info - View revision history
License
MIT License - Copyright (c) 2026 Kindred Systems LLC
See LICENSE for details.
Languages
Go
68.5%
TypeScript
25.5%
Shell
2.7%
PLpgSQL
2.4%
Makefile
0.5%
Other
0.3%