Skip to content

pyalwin/cortex

Repository files navigation

Cortex

Document intelligence platform. Connects documents from Drive, Notion, and other sources — makes them searchable and AI-ready.

Stack

  • Framework: Next.js 16 (App Router)
  • Database: Supabase (Postgres + Auth + RLS)
  • Background Jobs: Inngest
  • Cache / Rate Limiting: Upstash Redis
  • UI: Tailwind CSS 4, Radix UI, Framer Motion
  • Language: TypeScript (strict)

Getting Started

Prerequisites

  • Node.js 18+
  • Docker (for local Supabase)

Setup

# Install dependencies
npm install

# Start local Supabase
npm run db:start

# Copy env and fill in values (see below)
cp .env.example .env.local

# Apply migrations and seed data
npm run db:reset

# Start dev server
npm run dev

Open http://localhost:3000.

Environment Variables

Copy .env.example to .env.local. The local Supabase keys come from npx supabase status -o env.

Variable Required Source
NEXT_PUBLIC_SUPABASE_URL Yes npx supabase status
NEXT_PUBLIC_SUPABASE_ANON_KEY Yes npx supabase status
SUPABASE_SERVICE_ROLE_KEY Yes npx supabase status
INNGEST_EVENT_KEY Production only Inngest dashboard
INNGEST_SIGNING_KEY Production only Inngest dashboard
UPSTASH_REDIS_REST_URL Production only Upstash console
UPSTASH_REDIS_REST_TOKEN Production only Upstash console

Inngest and Upstash are optional in development — rate limiting is skipped and Inngest uses its local dev server.

Project Structure

src/
├── app/
│   ├── (marketing)/       # Landing pages (public)
│   ├── (app)/              # Authenticated app routes
│   └── api/                # API routes
├── components/
│   ├── landing/            # Landing page components
│   └── ui/                 # Shared UI primitives (Button, Input, Dialog)
├── lib/
│   ├── api/                # API utilities (validation, errors, responses)
│   ├── auth/               # Auth helpers
│   ├── inngest/            # Background job client and event schemas
│   ├── supabase/           # Supabase clients (browser, server, admin) and types
│   └── upstash/            # Redis client and rate limiters
├── middleware.ts            # Auth middleware for protected routes
supabase/
├── migrations/             # SQL migrations
├── seed.sql                # Seed data
└── config.toml             # Local Supabase config

Scripts

Command Description
npm run dev Start dev server
npm run build Production build
npm run typecheck Run TypeScript type checking
npm run lint Run ESLint
npm run format Format with Prettier
npm run db:start Start local Supabase
npm run db:stop Stop local Supabase
npm run db:reset Reset DB (apply all migrations + seed)
npm run db:migrate Push migrations to remote
npm run db:migration:new Create a new migration file
npm run db:gen-types Generate TypeScript types from DB schema

Database

Migrations live in supabase/migrations/. To create a new one:

npm run db:migration:new <name>
# Edit the generated SQL file
npm run db:reset

Tables

Table Purpose
waitlist Early access signups (name, email, unique constraint on email)

About

Document Intelligence

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors