Trestle
An AI system design generator that turns product requirements into an editable architecture diagram, with sourced rationale and cost estimates.
- TypeScript
- React
- React Flow
- Node.js
- Express
- PostgreSQL
- pgvector
- Gemini
- GitHub Actions
- Curated corpus
- 40 entries
- Automated tests
- 166
- Change flow
- Suggest-first
Summary
Trestle turns product requirements into an editable system architecture diagram. Every component comes with sourced rationale, real-world comparisons, and computed traffic and cost estimates.
Problem
System design answers from AI tools sound confident but are often made up: invented citations and generic diagrams that don't fit the requirements. I wanted a tool an engineer could actually trust and edit. It needed to be grounded in real sources, explain its choices, and never silently rewrite your design.
My role
I designed and built it end to end: the product decisions, the frontend, the API, the database and the RAG pipeline.
Architecture
React + React Flow frontend → Node/Express API → PostgreSQL with pgvector for retrieval, with Gemini for generation and embeddings. Auth uses JWT, and data is protected with Row Level Security. CI runs on GitHub Actions.
Key decisions
- I chose retrieval over a curated corpus instead of free generation, to cut hallucination. The corpus has 40 entries, embedded with Gemini and searched in pgvector (HNSW index, cosine distance) with topic filtering. Server-side validation drops any citation that doesn't exist in the corpus.
- I chose a suggest-first change flow instead of auto-applying edits. When you ask for a change, the AI proposes operations, and each one merges only when you approve it. Designs are versioned immutably, so nothing is ever silently overwritten.
- I chose PostgreSQL + pgvector instead of a separate vector database. Relational data and embeddings sit in one store, which means one place to secure (Row Level Security) and back up.
Results
- 166 automated tests running in GitHub Actions CI.
- Fabricated citations are filtered server-side before they reach the user.