Dependencies for Supermemory: Complete Guide to the AI-Powered Monorepo Stack

Supermemory relies on a Turbo-powered monorepo architecture with dependencies spanning AI SDKs from OpenAI and Anthropic, Drizzle ORM for PostgreSQL, Better Auth for authentication, Hono for the MCP server, and Next.js with Radix UI and Tiptap for the web frontend.

Supermemory is an open-source "second brain" application that combines a Next.js web interface with a Model-Context-Protocol (MCP) server. Understanding the dependencies for Supermemory is essential for developers contributing to the codebase or deploying self-hosted instances, as the project organizes its dependency tree across a root workspace, application layers, and shared internal packages.

Root-Level Dependencies

The foundation of the Supermemory dependency stack is defined in the root [package.json](https://github.com/supermemoryai/supermemory/blob/main/package.json). Lines 23-55 specify production dependencies, while lines 58-66 define development tooling.

AI Provider SDKs

The repository unifies multiple large language model providers through a comprehensive set of AI SDKs:

  • @ai-sdk/anthropic, @ai-sdk/cerebras, @ai-sdk/google, and @ai-sdk/openai provide the unified interface for LLM APIs
  • @anthropic-ai/sdk, @google/genai, and @google/generative-ai offer direct provider access for advanced features

These packages enable the core "ingest → embed → query" workflow across the serverless backend.

Database and ORM

Supermemory uses PostgreSQL as its primary datastore through type-safe database libraries:

  • drizzle-orm and drizzle-zod handle type-safe SQL queries and schema validation
  • pg and postgres provide native PostgreSQL drivers for Node.js and edge runtimes

As implemented in supermemoryai/supermemory, these dependencies support the vector storage and relational data models used by both the API and MCP server.

Authentication and Security

User identity and organization management rely on:

  • better-auth — Handles user sign-in, organization management, and API-key authentication across the entire stack

Server Runtime and API Layer

The MCP server and API backend run on Cloudflare Workers using:

  • cloudflare and wrangler — Edge runtime and deployment tooling
  • hono-openapi and @hono/zod-validator — Type-safe API routing with OpenAPI generation
  • @scalar/hono-api-reference — Interactive API documentation

Utilities and Helpers

The root workspace includes essential utility libraries:

  • zod and zod-openapi — Schema validation and OpenAPI spec generation
  • nanoid — Unique ID generation for resources
  • neverthrow — Functional error handling
  • pino — Structured logging
  • resend — Email delivery service

Development Tooling

Lines 58-66 of the root package.json specify build and quality tools:

  • turbo — Monorepo task runner and caching
  • @biomejs/biome — Linting and code formatting
  • drizzle-kit — Database migration management
  • typescript (v5.8) — Static type checking across the entire codebase
  • @sentry/cli — Source map uploading for error tracking

Web Application Dependencies

The Next.js frontend in [apps/web/package.json](https://github.com/supermemoryai/supermemory/blob/main/apps/web/package.json) (lines 17-108) layers client-specific libraries on top of the shared workspace packages @repo/lib and @repo/validation.

Client-Side AI Integration

The browser layer accesses AI capabilities through:

  • @ai-sdk/google, @ai-sdk/react, and @ai-sdk/xai — Client-side LLM access and streaming chat UI components
  • streamdown — Markdown streaming utilities for chat interfaces

UI Framework and Styling

The interface relies on a modern React component architecture:

  • @radix-ui/* — Accessible, unstyled component primitives
  • tailwindcss, @tailwindcss/typography, clsx, class-variance-authority, and tailwind-merge — Utility-first CSS and class management
  • lucide-react — Icon library
  • sonner — Toast notifications
  • vaul — Drawer component for mobile navigation
  • motion — Animation library (formerly Framer Motion)

Data Fetching and State Management

Client-side data synchronization uses:

  • @tanstack/react-query and @tanstack/react-query-devtools — Server state management and caching
  • @tanstack/react-table and @tanstack/react-virtual — High-performance tables and virtualized lists
  • zustand — Lightweight global state management for UI state

Content Editing and Rich Text

The knowledge capture interface depends on:

  • @tiptap/* — Full-featured collaborative editor with extensions for markdown, mentions, and semantic formatting
  • slate and slate-react — Alternative rich text editing framework (used in specific components)

Visualization and Media Handling

Interactive memory maps and document rendering require:

  • recharts (v2) and d3-force — Interactive graph visualizations for memory relationships
  • flubber — Shape interpolation animations for transitions
  • html-to-image — Canvas-based image generation from DOM nodes
  • pdfjs-dist and react-pdf — PDF rendering in the browser
  • react-dropzone — Drag-and-drop file uploads
  • idb-keyval — IndexedDB wrapper for client-side storage

Analytics and Observability

Production monitoring is implemented via:

  • @sentry/nextjs — Error tracking and performance monitoring
  • posthog-js — Product analytics and user event tracking

Workspace Package Dependencies

The packages/* directories contain internal modules referenced as workspace dependencies. Key packages include:

These packages re-export shared utilities and maintain their own minimal dependency trees, typically referencing zod, drizzle-orm, and TypeScript configurations.

How Dependencies Fit Together

The dependencies for Supermemory form an integrated architecture across three layers:

  1. Monorepo orchestration — turbo runs scripts across apps and packages using the "workspaces" field defined in the root package.json

  2. API / MCP server — Built on Cloudflare Workers using Hono, Drizzle ORM, and the AI SDKs to provide a type-safe, serverless backend

  3. Web frontend — Next.js 16 with React 19 consumes the internal workspace packages (@repo/lib, @repo/validation) and renders the UI using Radix UI, Tailwind CSS, and Tiptap

  4. Observability pipeline — Sentry captures errors in both workers and Next.js, while PostHog records user interactions

Practical Implementation Examples

Below are common patterns for importing and using key dependencies within the Supermemory codebase.

Using the AI SDK Client-Side

// apps/web/components/chat.tsx
import { useChat } from '@ai-sdk/react';

export function ChatBox() {
  const { messages, input, handleInputChange, handleSubmit } = useChat({
    api: '/api/chat',
    model: 'gpt-4o-mini',
  });

  return (
    <form onSubmit={handleSubmit}>
      <input value={input} onChange={handleInputChange} />
      {messages.map(m => (
        <div key={m.id}>{m.content}</div>
      ))}
    </form>
  );
}

Source: @ai-sdk/react is listed in apps/web/package.json (line 18).

Database Query with Drizzle ORM

// packages/lib/db/queries.ts
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { memories } from '../schema';

const client = postgres(process.env.DATABASE_URL!);
const db = drizzle(client);

export async function getMemoriesByUser(userId: string) {
  return await db.select().from(memories).where(eq(memories.userId, userId));
}

Source: drizzle-orm and postgres are defined in the root package.json (lines 23-55).

Validating API Requests with Zod

// apps/web/app/api/memory/route.ts
import { z } from 'zod';
import { memorySchema } from '@repo/validation';

export async function POST(request: Request) {
  const body = await request.json();
  const parsed = memorySchema.parse(body); // Type-safe validation
  
  // parsed is now typed according to the schema definition
  return Response.json({ success: true, data: parsed });
}

Source: zod is defined in the root package.json; @repo/validation is referenced in apps/web/package.json (line 108).

Summary

  • Root dependencies (lines 23-55 of package.json) provide AI SDKs from Anthropic, Cerebras, Google, and OpenAI, plus Drizzle ORM for PostgreSQL, Better Auth for authentication, and Cloudflare Workers runtime tools
  • Web application dependencies (lines 17-108 of apps/web/package.json) include Next.js, Radix UI components, Tailwind CSS, Tiptap for editing, React Query for data fetching, and Recharts/D3 for visualizations
  • Workspace packages (@repo/lib, @repo/validation) encapsulate shared business logic and Zod schemas, referenced via the monorepo workspace protocol
  • Development tools include Turbo for build orchestration, Biome for linting, Drizzle Kit for migrations, and TypeScript 5.8 for type safety

Frequently Asked Questions

What database does Supermemory use?

Supermemory uses PostgreSQL as its primary database, accessed through Drizzle ORM (drizzle-orm, drizzle-zod) and the postgres driver. This stack provides type-safe SQL queries and schema management across both the MCP server and web application layers.

Which AI providers are supported by Supermemory?

According to the source code in supermemoryai/supermemory, the repository supports Anthropic, Cerebras, Google (Gemini), OpenAI, and xAI through the @ai-sdk/* family of packages and direct SDKs like @anthropic-ai/sdk and @google/genai.

How is authentication implemented in Supermemory?

Authentication is handled by better-auth, a library defined in the root package.json that manages user sign-in, organization management, and API-key authentication. This provides a unified auth layer for both the Next.js frontend and the Hono-based API backend.

What UI library powers the Supermemory interface?

The interface is built on Radix UI primitives (accessible, unstyled components) combined with Tailwind CSS for styling. Rich text editing uses Tiptap, while data tables and lists are rendered using TanStack React Table and TanStack React Virtual for performance.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →