~ portfolio

Satvik Sawhney

software engineer

loading000%
case studybuilding

ArchitectDB.

AI-native database architect · 6 agents · MCP server

Generic AI tools hallucinate SQL because they don't know what your schema looks like, what conventions your team uses, or what changed last week. Schema design needs an agent that lives inside your project.
architectdb · schema+2 fk · 0 missing idx
usersid pkemailcreated_atprojectsid pkowner_id fknameeventsid pkproject_id fktype
postgres · 146 agents online
01the problem

Application engineers ship schema changes through PRs, write migrations they don't fully understand, and debug slow queries from ORM output. The good tooling that does exist lives in silos — a diagrammer here, a migration tool there, a query optimizer somewhere else. Asking ChatGPT to write a migration loses every project-specific convention the moment you hit send. The fix is the opposite of a generic chatbot: domain-scoped agents that share the same schema/migration/context bundle.

02the approach

ArchitectDB consolidates the database lifecycle (design → SQL export → migration → review → query) into one workspace with six specialized agents inside it: Schema Architect, Migration Engineer, Index & Performance, Security & Governance, Schema Reviewer/Linter, and a bounded NL→SQL Query Assistant. Each agent owns one job and shares the same context envelope. Beyond the web app, a TypeScript MCP server exposes the platform to Cursor, Claude Desktop, and Zed — so external AI clients can drive schema design from inside developer workflows.

03decisions i made

The choices that mattered, with the reasoning at the time.

  1. Specialized agents, not monolithic

    A single 'database AI' would have to balance modeling decisions against index recommendations against security review on every prompt. Six focused agents each owning a narrow job stay sharper, are individually testable, and can be invoked separately by tool calls from external clients.

    decision · 01
  2. MCP server as second-class surface, deferred

    The web app is the primary product. The MCP server exists in the repo but is frozen until the web experience is real — shipping both at once means neither would be great. When unfrozen it exposes the same platform behind the Model Context Protocol so the same agents are reachable from any MCP-aware client.

    decision · 02
  3. Application engineers first, DBAs later

    DBAs already have specialist tools. Application engineers writing migrations they don't fully understand are the underserved segment. Initial wedge is Postgres/MySQL architect for app engineers — scale path is document → vector DB → broader architectural decisions.

    decision · 03
04the key insight

One code surface that captures the structural decision.

packages/mcp/src/tools/review_schema.tstypescript
import { z } from "zod";
import { Tool } from "@modelcontextprotocol/sdk/types.js";

export const reviewSchemaTool: Tool = {
  name: "review_schema",
  description: "Run all 6 ArchitectDB review agents over a schema diff",
  inputSchema: z.object({
    dialect: z.enum(["postgres", "mysql"]),
    before: z.string().describe("SQL DDL of current schema"),
    after: z.string().describe("SQL DDL of proposed schema"),
  }),
  handler: async ({ dialect, before, after }) => {
    const diff = await schemaDiff(dialect, before, after);
    const [arch, mig, idx, sec, lint] = await Promise.all([
      schemaArchitect.review(diff),
      migrationEngineer.plan(diff),    // forward + rollback SQL
      indexPerformance.suggest(diff),
      securityGovernance.audit(diff),  // RLS, PII tagging, audit columns
      schemaReviewer.lint(diff),
    ]);
    return { diff, findings: { arch, mig, idx, sec, lint } };
  },
};
05what happened

Backend domain model and auth scaffolding exist. The visual schema designer, SQL codegen, migration engine, and multi-agent layer are the next major surfaces. Apps/api on Flask + SQLAlchemy + Pydantic + Alembic + Redis. Apps/web on Next.js 14 App Router. Packages/mcp on TypeScript MCP SDK (frozen).

specialist agents
6
product surfaces
5
MCP clients
Cursor · Claude Desktop · Zed
06what i’d do differently

I'd ship the visual designer earlier than I planned — even a barebones ER canvas would let me put real users on the platform and learn which agents fire most. The MCP server should also probably ship later than v1, since most early users will be in the web app, not Cursor.

appendixarchitecture
  • apps/api — Flask + SQLAlchemy + Pydantic + Alembic + Redis
  • apps/web — Next.js 14 (App Router) · React · the primary product surface
  • packages/mcp — TypeScript MCP server (frozen until web product is real, then unfrozen)
  • 6 agents: Schema Architect · Migration Engineer · Index & Performance · Security & Governance · Schema Reviewer · NL→SQL
stack
FlaskSQLAlchemyAlembicRedisNext.js 14LangGraphTypeScript MCP