feat: Phase 1 foundation - schema, auth, realtime, shell

- Rewrote Drizzle schema: 20 tables with enums, relations, indexes
- Generated migration with DROP TABLE records (v1 EAV removal)
- Added passkey auth routes (register/login)
- Added requireWorkspaceAccess helper
- Added seedDefaultData for Personal workspace + welcome note
- Updated SSE endpoint for v2 entities + workspace_id filtering
- Created recordActivity helper (insert + pg_notify)
- Updated sidebar: Graph replaces Reports, removed Analytics
- Updated command palette for v2 entities
- Created AGENTS.md with locked contract
- Created llm-wiki scaffold (5 stubs)
- Added inline AGENT INSTRUCTION comments to all 50 API route files
- Fixed globals.css border-border class conflict
- Updated database.ts stub for v1 compatibility
This commit is contained in:
2026-07-29 05:53:13 -04:00
parent c5e996326c
commit b3ff23a5f0
73 changed files with 3884 additions and 178 deletions
+42
View File
@@ -0,0 +1,42 @@
# Architecture
## System Overview
Project E is a full-stack personal productivity OS with realtime collaboration, AI agent integration, and keyboard-driven UI.
## Three-Layer Architecture
```
Frontend (Next.js React) → Next.js API Routes (business logic) → PostgreSQL (data store)
│ │
│ ├── NOTIFY (on write)
│ │
└── SSE (EventSource) ←────────┘
```
## Data Flow
1. User action → API route → Drizzle write → `pg.notify()` → SSE endpoint → Zustand store → UI update
2. External agent → MCP tool call → API route → Drizzle write → `pg.notify()` → SSE → UI update
3. Worker → webhook delivery / recurring spawn → API route → Drizzle write → `pg.notify()` → SSE → UI update
## Container Layout
- **project-e-web** — Next.js 15 (App Router), frontend + REST API + MCP + SSE
- **project-e-db** — PostgreSQL 16, all data + LISTEN/NOTIFY
- **project-e-worker** — Node.js worker, webhook delivery + recurring spawning + AI dispatch
## Monorepo Structure
```
ProjectE/
├── apps/
│ ├── web/ # Next.js 15 app
│ └── worker/ # Node.js worker process
├── packages/
│ ├── db/ # Drizzle schema + connection
│ └── shared/ # Shared types, schemas, constants
├── docker-compose.yml
├── AGENTS.md
└── llm-wiki/
```