- Add flake.nix with 4 packages: web, api, mcp, worker Each builds via bun in CI sandbox, packages dist/.next + node_modules into Nix store, wraps with makeBinaryWrapper - Rewrite ci.yml: test (bun typecheck+tests) → build-and-deploy (Nix matrix) nix build → nix copy → nix-env --set + systemctl restart on VPS No tarball+SSH, no VPS builds - Gitignore content/**/*.md (DB is source of truth) - Update AGENTS.md architecture docs
2.5 KiB
This is NOT the Next.js you know
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ (resolved from this file's directory; in monorepos the next package may not be visible from the repo root) before writing any code. Heed deprecation notices.
This block is written and re-added by next dev — verify at node_modules/next/dist/server/lib/generate-agent-files.js. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
MCPedia Agent Instructions
MCPedia is a content-first knowledge base where documents are stored in PostgreSQL as the source of truth (with auto-generated .md backups on disk), indexed into embeddings + search vectors, and accessed via Web UI, tRPC API, and Model Context Protocol (MCP).
- DB-first: Documents are created/updated/deleted via the MCP
create_document/update_document/delete_documenttools (requirex-webhook-secret). Filesystem.mdfiles incontent/are auto-generated backups (gitignored). - Git-sync deploy: CI builds
.nexton GitHub Actions → tarball → SCP to VPS → unpack. VPS never builds. Content changes flow via MCP API to the DB directly.
Architecture Principles
- Single Core Layer (
@mcpedia/core): All business logic (document CRUD, indexing, search, revisions, path classification) resides inpackages/core. Never access the database directly fromapps/web,apps/mcp, orapps/api. - DB as Source of Truth: PostgreSQL stores document body + metadata. Filesystem
.mdfiles incontent/are auto-generated backups (gitignored). Use the MCPcreate_document/update_documenttools to write content. - Multi-Modal Search: Keyword search (Postgres FTS
tsvector+ GIN), Semantic search (cosine similarity over chunked embeddings), and Hybrid search (Reciprocal Rank Fusion / RRF) are unified in@mcpedia/search. - Mutations & Security: State-changing operations (document creation/updates/deletions, reindexing, revision restoration) require authentication (
x-webhook-secretheader or session cookie).
Development Workflow
- Install dependencies:
bun install - Run tests:
bun run test - Typecheck:
bun run typecheck - Build monorepo:
bunx turbo run build - Index content:
bun run index - Start dev servers:
bun run dev