AI Software Factory
A modern, self-hostable, multi-tenant collaborative workspace platform inspired by Notion.
AI Software Factory combines document management, a block-based editor, wiki, knowledge base, databases (table / board / calendar / timeline / gallery / chart / form / dashboard views), project and task management, real-time collaboration, AI assistance, automation, forms, public sharing, and a full REST API — delivered as a production-grade, self-hostable SaaS platform.
Four Layers of Instructions
This repository is built to be operated by AI coding agents working phase by phase:
| Layer | File / Directory | Purpose |
|---|---|---|
| 1. Master project | README.md |
What this project is and how to run it |
| 2. Permanent AI rules | AGENTS.md |
Non-negotiable rules for any coding agent working here |
| 3. Product specification | PRODUCT-SPEC.md |
Complete product requirements |
| 4. Technical architecture | ARCHITECTURE.md |
System, frontend, backend, database, realtime, search, AI, security |
| 5. Roadmap | ROADMAP.md |
The 16 development phases and their exit criteria |
| 6. Tasks | docs/tasks/ |
TASK-XXXX spec sheets, one file per phase, worked in order |
Quick Start
Prerequisites: Node.js ≥ 20, pnpm ≥ 9, Docker.
git clone <repo-url> ai-software-factory
cd ai-software-factory
cp .env.example .env # fill in secrets
pnpm install
pnpm docker:up # postgres, redis, minio, opensearch
pnpm db:migrate && pnpm db:seed
pnpm dev # web (3000), api (4000), worker, realtime (4001)
Open http://localhost:3000.
Monorepo Layout
ai-software-factory/
├── docs/ # product, architecture, api, development, ui, security, tasks
├── apps/
│ ├── web/ # Next.js 14 (App Router) + React + Tiptap block editor
│ ├── api/ # NestJS modular-monolith API (REST + auth + domain modules)
│ ├── worker/ # BullMQ worker: automation, files pipeline, webhooks, search indexing
│ └── realtime/ # WebSocket gateway: Yjs CRDT sync, presence, cursors
├── packages/
│ ├── ui/ # design system: shadcn/ui components + theme tokens
│ ├── editor/ # Tiptap-based block editor (extensions, slash, context menus, DnD)
│ ├── database-engine/# properties, views, filters, sort, group, relations, rollups, formulas, buttons
│ ├── auth/ # JWT + refresh rotation, session management, SSO helpers
│ ├── permissions/ # RBAC + resource-level permission engine
│ ├── collaboration/ # Yjs provider, presence, offline sync queue (IndexedDB)
│ ├── search/ # OpenSearch client, indexing, hybrid (keyword + semantic) search
│ ├── ai/ # AI gateway + provider abstraction (OpenAI/Anthropic/Google/oss/custom)
│ ├── storage/ # S3-compatible storage client, upload pipeline, thumbnails
│ ├── shared/ # DTOs, Zod schemas, event contracts, error types, constants
│ └── config/ # shared eslint / prettier / tsconfig presets
├── prisma/ # Prisma schema, migrations, seed
├── infrastructure/ # docker compose, kubernetes, terraform, nginx
├── tests/ # e2e (Playwright), integration, performance
└── .github/ # CI/CD workflows, issue & PR templates
Development Phases
The project is built in 16 sequential phases — never jump between features. See ROADMAP.md:
| Phase | Scope |
|---|---|
| 0 | Foundation: monorepo, CI/CD, Docker, env, lint, test, Postgres, Redis, object storage |
| 1 | Authentication: register, login, logout, refresh, password reset, email verification, profile |
| 2 | Workspace: workspaces, members, roles, invitations, teams, sidebar, settings |
| 3 | Page engine: pages, nesting, page tree, CRUD, trash, favorites, permissions |
| 4 | Block editor: blocks, drag & drop, slash menu, context menus, shortcuts, undo/redo, copy/paste |
| 5 | Database engine: properties, records, table view, filters, sort, group, views (board/calendar/…) |
| 6 | Relations: bidirectional relations, rollups, formula engine, database buttons |
| 7 | Collaboration: WebSockets, Yjs CRDT, presence, cursors, realtime comments, notifications |
| 8 | Search: indexing, full-text, fuzzy, filters, UI, suggestions |
| 9 | Files: object storage, upload, download, preview, thumbnails, metadata, permissions |
| 10 | Forms: builder, questions, validation, public forms, database integration, responses |
| 11 | Automation: triggers, conditions, actions, queue, workers, retries, history, logs |
| 12 | AI: gateway, provider abstraction, chat, page/database AI, RAG search, writing tools |
| 13 | API: public REST API, API keys, OAuth, webhooks, rate limiting, OpenAPI docs |
| 14 | Enterprise: SSO (SAML/OIDC), SCIM, audit logs, org policies, retention, admin console |
| 15 | Production hardening: security audit, load testing, caching, backup/DR, observability |
Technology Stack
- Frontend: Next.js, React, TypeScript, Tailwind CSS, shadcn/ui, Tiptap, dnd-kit, TanStack Query, Zustand, React Hook Form, Zod
- Backend: NestJS, TypeScript, PostgreSQL, Prisma, Redis, BullMQ, WebSocket, S3-compatible storage, OpenSearch
- Testing: Vitest (unit), Jest (API), Playwright (E2E), k6 / Artillery (performance)
- Observability: OpenTelemetry, Prometheus, Grafana, Loki
Documentation
- Product spec · Architecture · Roadmap
- Architecture docs · API docs · Development guide
- Task specs by phase
Operations
- Admin guide — day-2 operations: provisioning, scaling, backup/DR runbook, and the release process (v1.0).
- Support matrix — platform, browser, and dependency support windows for the v1.0 release.
Contributing
Read CONTRIBUTING.md, then AGENTS.md if you are an AI agent.
Security
See SECURITY.md to report vulnerabilities responsibly.