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/openaiprovide the unified interface for LLM APIs@anthropic-ai/sdk,@google/genai, and@google/generative-aioffer 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-ormanddrizzle-zodhandle type-safe SQL queries and schema validationpgandpostgresprovide 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:
cloudflareandwrangler— Edge runtime and deployment toolinghono-openapiand@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:
zodandzod-openapi— Schema validation and OpenAPI spec generationnanoid— Unique ID generation for resourcesneverthrow— Functional error handlingpino— Structured loggingresend— 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 formattingdrizzle-kit— Database migration managementtypescript(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 componentsstreamdown— Markdown streaming utilities for chat interfaces
UI Framework and Styling
The interface relies on a modern React component architecture:
@radix-ui/*— Accessible, unstyled component primitivestailwindcss,@tailwindcss/typography,clsx,class-variance-authority, andtailwind-merge— Utility-first CSS and class managementlucide-react— Icon librarysonner— Toast notificationsvaul— Drawer component for mobile navigationmotion— Animation library (formerly Framer Motion)
Data Fetching and State Management
Client-side data synchronization uses:
@tanstack/react-queryand@tanstack/react-query-devtools— Server state management and caching@tanstack/react-tableand@tanstack/react-virtual— High-performance tables and virtualized listszustand— 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 formattingslateandslate-react— Alternative rich text editing framework (used in specific components)
Visualization and Media Handling
Interactive memory maps and document rendering require:
recharts(v2) andd3-force— Interactive graph visualizations for memory relationshipsflubber— Shape interpolation animations for transitionshtml-to-image— Canvas-based image generation from DOM nodespdfjs-distandreact-pdf— PDF rendering in the browserreact-dropzone— Drag-and-drop file uploadsidb-keyval— IndexedDB wrapper for client-side storage
Analytics and Observability
Production monitoring is implemented via:
@sentry/nextjs— Error tracking and performance monitoringposthog-js— Product analytics and user event tracking
Workspace Package Dependencies
The packages/* directories contain internal modules referenced as workspace dependencies. Key packages include:
@repo/validation— Shared Zod schemas used by both the API and frontend (see [packages/validation/package.json](https://github.com/supermemoryai/supermemory/blob/main/packages/validation/package.json))@repo/lib— Core business logic and API clients (see [packages/lib/package.json](https://github.com/supermemoryai/supermemory/blob/main/packages/lib/package.json))packages/ui— Shared React componentspackages/memory-graph— Graph visualization logic
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:
-
Monorepo orchestration —
turboruns scripts across apps and packages using the"workspaces"field defined in the rootpackage.json -
API / MCP server — Built on Cloudflare Workers using Hono, Drizzle ORM, and the AI SDKs to provide a type-safe, serverless backend
-
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 -
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →