π Table of Contents
- β¨ Introduction
- βοΈ Tech Stack
- π Features
- π€Έ Quick Start
- π§ͺ E2E Testing
- ποΈ System Architecture & Flows
- π‘οΈ Security & Reliability
- π Project Structure
β¨ Introduction
OmniArch is an intelligent, real-time collaborative system design workspace tailored for modern engineering teams. It transforms abstract architectural ideation into structured, production-ready system graphs and technical specifications.
Instead of wrestling with static diagramming tools or fragmented whiteboards, engineers describe distributed systems in natural language. Powered by Google Gemini 3.6 Flash and durable Trigger.dev background workflows, the AI Architect dynamically creates, positions, styles, and links components on a synchronized canvas. Simultaneously, collaborators can interact live with real-time multi-user presence, cursors, custom architectural shapes, and starter blueprints powered by Liveblocks and React Flow.
Once the architecture is finalized, OmniArch synthesizes the graph topology and team chat history into an enterprise-grade Markdown Technical Specification document (including data flows, component boundaries, failure modes, and infrastructure recommendations), safely persisted on Vercel Blob with in-app preview and protected downloads.
βοΈ Tech Stack
- Next.js 16 β Full-stack React framework utilizing the App Router, React Server Components, Server Actions, and high-performance API route handlers.
- TypeScript β Strict, end-to-end type safety spanning database models, Zod runtime validation, Liveblocks storage structures, and React Flow nodes.
- Tailwind CSS v4 & shadcn/ui β Modern design system customized with dark-mode CSS tokens, Radix UI primitives, Lucide icons, and responsive layouts.
- Liveblocks β Real-time collaboration infrastructure managing distributed state (CRDTs), live multi-user cursors, presence awareness, and broadcast status feeds.
- React Flow (@xyflow/react) β Interactive canvas engine customized with smooth step paths, midpoint edge labels, custom draggable architectural shapes, and interactive node toolbars.
- Google Gemini 3.6 Flash (
@ai-sdk/google) β State-of-the-art multimodal LLM powering agentic graph tool execution (addNode,moveNode,addEdge, etc.) and structured technical specification synthesis. - Trigger.dev v4 β Resilient background task orchestration engine handling long-running AI design agent tasks, spec generation, and durable exponential-backoff blob cleanup.
- Prisma ORM & PostgreSQL β Multi-file database schema modeling projects, collaborator roles, task executions, and specification metadata with connection caching.
- Clerk β Enterprise-grade authentication and user management with dark theme styling, protected routes, and backend user enrichment.
- Vercel Blob β Secure, private cloud asset storage for serialized canvas autosaves and generated Markdown technical specifications.
- Playwright β Comprehensive end-to-end (E2E) testing framework integrated with
@clerk/testingcovering all UI features, canvas ergonomics, collaboration, and REST contracts.
π Features
π Real-Time Collaborative Canvas: Full-duplex synchronization powered by Liveblocks and React Flow. See teammates' live cursors, participant avatars, selection states, and thinking indicators on a full-bleed dot-grid canvas.
π Natural Language AI Architect: Describe requirements in plain English (e.g., "Design an event-driven payment processing system with Kafka and dead-letter queues"). The AI design agent executes atomic canvas tools to add, position, connect, and style nodes in real time.
π Automated Technical Spec Generation: Convert the visual system architecture and chat context into comprehensive, structured Markdown technical specifications with Overview, Component Architecture, Data Flow, Interfaces, Infrastructure, and NFRs.
π Interactive Shape Palette: Drag-and-drop specialized architecture primitives onto the canvas, including Rectangles, Diamonds, Circles, Pills, Cylinders, and Hexagons with automatic coordinate mapping.
π Node Styling & Edge Routing: Floating swatch toolbar offering 8 curated color pairs for nodes, alongside four-directional handles, smooth step connections, and midpoint edge label editing.
π Prebuilt System Design Templates: Kickstart architecture reviews with one-click blueprints for Microservices, Event-Driven Architectures, CI/CD Pipelines, and more.
π In-App Spec Preview & Protected Download: Inspect generated specs directly inside the AI sidebar using a rich Markdown preview modal with syntax highlighting, or download protected Markdown attachments natively.
π Debounced Canvas Autosave: Canvas graph snapshots are automatically serialized and saved to private Vercel Blob storage in the background with navbar save-status indicators (Saving..., Saved, Error).
π Project & Collaborator Management: Create, rename, delete, and organize project workspaces. Invite teammates by email with Clerk-enriched profiles and owner-guarded permissions.
π Ergonomic Canvas Controls: Built-in zoom in/out, fit-to-view, undo/redo history controls, and keyboard shortcut integrations for a distraction-free workflow.
π€Έ Quick Start
Follow these steps to set up and run OmniArch locally on your machine.
Ensure you have the following installed:
- Node.js (v20.0.0 or higher)
- npm or pnpm
- PostgreSQL database instance
- Accounts with Clerk, Liveblocks, Trigger.dev, Vercel Blob, and Google AI Studio
git clone https://github.com/itsdishant/omniarch.git
cd omniarchnpm installCreate a .env (or .env.local) file in the root directory:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/
# PostgreSQL & Prisma
DATABASE_URL="postgresql://user:password@localhost:5432/omniarch?sslmode=prefer"
# Liveblocks Realtime Engine
LIVEBLOCKS_SECRET_KEY=sk_dev_...
# Vercel Blob Storage
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_...
# Trigger.dev Background Tasks
TRIGGER_PROJECT_REF=proj_...
TRIGGER_SECRET_KEY=tr_dev_...
TRIGGER_API_URL=https://api.trigger.dev
# Google Gemini API
GOOGLE_API_KEY=AIzaSy...Generate the Prisma Client and apply migrations to your PostgreSQL database:
# Generate Prisma Client delegates
npm run prebuild
# Push database schema or run migrations
npx prisma migrate dev --name initStart both the Next.js development server and the Trigger.dev background worker:
# Terminal 1: Next.js dev server
npm run dev
# Terminal 2: Trigger.dev background task runner
npm run dev:triggerOpen http://localhost:3000 in your browser.
| Command | Description |
|---|---|
npm run dev |
Starts the Next.js development server at localhost:3000 |
npm run dev:trigger |
Starts the local Trigger.dev task execution worker |
npm run build |
Builds the Next.js application for production |
npm run prebuild |
Synchronizes and generates the Prisma Client delegates |
npm run lint |
Runs Next.js ESLint verification |
npm run deploy:trigger |
Deploys background tasks to Trigger.dev cloud |
npm run test:e2e |
Runs the complete Playwright E2E test suite (36 tests) |
npm run test:e2e:headed |
Runs Playwright E2E tests in a visible browser window |
π§ͺ E2E Testing
OmniArch includes a modular, full-coverage End-to-End (E2E) test suite powered by Playwright and @clerk/testing. Every application domain is tested in isolation with dedicated test specifications.
# Run the entire E2E test suite (headless)
npm run test:e2e
# Run with interactive Playwright UI mode
npx playwright test --ui
# Run specific domain suites
npx playwright test tests/auth/ tests/routing/
npx playwright test tests/canvas/
npx playwright test tests/editor/
npx playwright test tests/collaboration/
npx playwright test tests/ai/
npx playwright test tests/api/For complete architectural details, directory mapping, and test guidelines, see tests/README.md.
ποΈ System Architecture & Flows
flowchart LR
subgraph Client["Client / Browser"]
UI["OmniArch Workspace UI"]
Canvas["Collaborative Canvas"]
AI["AI Sidebar / Chat"]
end
subgraph App["Next.js Application"]
API["API Routes + Server Actions"]
Auth["Clerk Authentication"]
Project["Project / Spec Services"]
Live["Liveblocks Sync Layer"]
end
subgraph Services["Background & AI Services"]
Trigger["Trigger.dev Workers"]
Gemini["Google Gemini 3.6 Flash"]
Blob["Vercel Blob Storage"]
end
subgraph Data["Persistence & State"]
DB[("PostgreSQL / Prisma")]
Flow[("Liveblocks Room State")]
end
UI --> Canvas
UI --> AI
UI --> API
API --> Auth
API --> Project
Project --> DB
Project --> Live
Live --> Flow
AI --> Trigger
Trigger --> Gemini
Trigger --> Blob
Gemini --> Live
Gemini --> Blob
sequenceDiagram
participant U as User
participant FE as OmniArch Frontend
participant API as Next.js API
participant DB as PostgreSQL / Prisma
participant TD as Trigger.dev
participant GM as Gemini
participant LB as Liveblocks
participant BL as Vercel Blob
U->>FE: Describe system architecture
FE->>API: POST /api/ai/design
API->>DB: Save task metadata
API->>TD: Trigger design-agent task
TD->>GM: Generate node/edge tool plan
GM-->>TD: addNode / moveNode / addEdge
TD->>LB: Apply live canvas mutations
LB-->>FE: Real-time canvas updates
FE-->>U: Architecture appears live on canvas
U->>FE: Generate technical spec
FE->>API: POST /api/ai/spec
API->>TD: Trigger generate-spec task
TD->>LB: Read current graph state
TD->>GM: Generate structured Markdown spec
GM-->>TD: Technical specification
TD->>BL: Upload spec blob
TD->>DB: Save spec metadata
BL-->>FE: Preview/download reference
FE-->>U: Spec is ready in-app
π Project Structure
omniarch/
βββ app/ # Next.js App Router (Pages, Layouts & API routes)
β βββ (auth)/ # Clerk sign-in / sign-up auth flows
β βββ api/ # Authenticated REST endpoints (Projects, Specs, Liveblocks)
β βββ editor/ # Collaborative Editor home & [roomId] workspace
βββ components/ # React UI Component Library
β βββ editor/ # Canvas wrapper, custom shapes, controls & AI sidebar
β βββ ui/ # Reusable shadcn/ui components
βββ hooks/ # Custom React hooks (Liveblocks, Autosave, Realtime runs)
βββ lib/ # Shared server utilities, Prisma client & access control
βββ prisma/ # Multi-file schema definitions (Projects, Specs, TaskRuns)
βββ public/ # Static brand assets (SVG logomark, logo lockup, favicon)
βββ tests/ # Modular Playwright E2E test suite (8 feature domains)
β βββ auth/ & routing/ # Authentication & route guard tests
β βββ canvas/ # Visual architecture canvas & custom shapes tests
β βββ editor/ # Workspace management & navigation tests
β βββ collaboration/ # Live multi-user sharing & collaborator tests
β βββ ai/ # AI Architect prompt & spec generation tests
β βββ api/ # Backend REST API contract tests
βββ trigger/ # Trigger.dev background task definitions
β βββ design-agent.ts # Agentic graph builder via Gemini tool calls
β βββ generate-spec.ts # Markdown technical specification generator
β βββ cleanup-blobs.ts # Durable exponential backoff blob cleanup task
βββ types/ # TypeScript schemas & Zod definitions (Canvas, Specs, Tasks)
- User submits an architecture prompt in the AI Workspace sidebar.
POST /api/ai/designvalidates project access, records aTaskRun, and triggers thedesign-agenttask on Trigger.dev.- The client subscribes to real-time execution via
@trigger.dev/react-hookswith a scoped public token. - Gemini 3.6 Flash evaluates the prompt, invokes atomic tools (
addNode,moveNode,addEdge), and mutates the Liveblocksflowstorage directly. - Ephemeral AI cursor presence and status updates stream to all active room participants.
- User clicks Generate Spec in the Specs tab.
POST /api/ai/specinitiates the durablegenerate-specbackground task.- The worker queries the live canvas graph directly from Liveblocks storage and formats prompt context with token safety bounds.
- Gemini generates a structured, multi-section Markdown specification.
- The generated file is uploaded to private Vercel Blob storage, metadata is recorded in Prisma
ProjectSpec, and collaborators receive instant UI updates to preview or download.
- When a project is deleted, active canvas and spec blob URLs are cataloged before DB cascade deletion.
- The
cleanup-blobsTrigger.dev task executes with exponential backoff (5 retries over 1 hour) to guarantee zero orphaned storage artifacts.
π‘οΈ Security & Reliability
- Bounded LLM Context Limits: Canvas graph serialization enforces strict safety caps (maximum 200 nodes, 300 edges, 200-character labels, and 100k total prompt characters) to prevent context overflows and token cost spikes.
- Race Condition Prevention: Synchronous execution refs (
startingRef) prevent duplicate generation runs from simultaneous user triggers. - Multi-Tenant Access Isolation: Every API endpoint and Liveblocks session token strictly enforces project ownership or collaborator email verification through Prisma before granting read/write capabilities.
- Fault-Tolerant Storage Cleanup: Blob storage cleanups only execute on database failures or post-deletion confirmations, ensuring active production artifacts are never mistakenly deleted.