Core Framework
Next.js 16
Full-stack React framework with App Router, Server Components, and API routes
React 19
UI library with hooks, concurrent features, and server components
TypeScript 5.9
Type-safe JavaScript with strict mode enabled
Node.js 20+
JavaScript runtime for server-side code
Database & ORM
PostgreSQL
ThinkEx uses PostgreSQL as its primary database:- Version: 12+
- Features: JSONB, Row-Level Security (RLS), triggers, indexes
- Self-hosted or managed (Supabase, Neon, etc.)
PostgreSQL is required - ThinkEx does not support other databases due to extensive use of Postgres-specific features like RLS and JSONB.
Drizzle ORM
Drizzle ORM 0.45
Type-safe SQL query builder with schema migrations
- TypeScript-first with full type inference
- Zero-cost abstraction over raw SQL
- Simple migrations with
drizzle-kit - Great DX with autocomplete and type safety
src/lib/db/schema.tsMigrations:
drizzle/
Authentication
Better Auth 1.4
Modern authentication library with built-in security and OAuth support
- Email/password authentication
- OAuth providers (Google)
- Session management with secure cookies
- Anonymous users for demo mode
- CSRF protection built-in
src/lib/auth.ts
Why Better Auth over NextAuth?
- Better TypeScript support
- More flexible and modern architecture
- Cleaner API design
- Active development and maintenance
State Management
TanStack Query
TanStack Query 5.90
Powerful data fetching and caching library (formerly React Query)
- Server state caching
- Automatic background refetching
- Optimistic updates
- Infinite scroll and pagination
Zustand
Zustand 5.0
Lightweight state management for UI state
- Canvas UI state (zoom, pan, selection)
- Modal/dialog state
- Temporary UI preferences
- Real-time cursor positions
src/lib/stores/.
Styling & UI Components
Tailwind CSS
Tailwind CSS 4.2
Utility-first CSS framework for rapid UI development
tailwind.config.tsGlobal Styles:
src/app/globals.css
Shadcn UI
Shadcn UI
Customizable component library built on Radix UI primitives
- Dialog, Popover, Dropdown Menu
- Button, Input, Select, Checkbox
- Tabs, Accordion, Collapsible
- Tooltip, Hover Card, Context Menu
- And more…
src/components/ui/
Radix UI
Low-level UI primitives from Radix provide:- Accessibility (ARIA, keyboard navigation)
- Unstyled, customizable components
- Focus management and portal support
@radix-ui/react-dialog@radix-ui/react-dropdown-menu@radix-ui/react-popover@radix-ui/react-tabs@radix-ui/react-tooltip- And more…
AI & LLMs
Vercel AI SDK
Vercel AI SDK 6.0
Unified API for LLM integrations with streaming support
- Streaming text generation
- Tool/function calling
- Multi-provider support
- React hooks for UI integration
AI Providers
Google Gemini
Google Gemini
Primary AI provider via
@ai-sdk/google and @google/genai- Models: Gemini 1.5 Pro, Flash
- Features: Multimodal (text, images, PDFs), function calling
- Use: Chat, document analysis, deep research
Assistant UI
Assistant UI
Specialized UI components for chat interfaces via
@assistant-ui/react- Pre-built message components
- Streaming UI updates
- Built-in markdown rendering
- Developer tools for debugging
src/lib/ai/
Rich-Text Editing
BlockNote
BlockNote 0.47
Notion-style block editor for rich-text notes
- Slash commands for quick formatting
- Drag-and-drop blocks
- Markdown shortcuts
- Code blocks with syntax highlighting
- Math equations with KaTeX
- Customizable styling
@blocknote/core- Core editor logic@blocknote/react- React bindings@blocknote/shadcn- Shadcn UI styling
src/components/editor/
Document Processing
PDF Handling
EmbedPDF 2.6
EmbedPDF 2.6
Comprehensive PDF viewing and annotation library
- Core:
@embedpdf/core,@embedpdf/engines - Plugins: annotation, search, zoom, thumbnails, export, and more
- Features: Native rendering, text selection, highlights, OCR integration
Media Processing
YouTube Integration
oEmbed API for metadata and thumbnail extraction
Audio Transcription
Google Gemini for speech-to-text with speaker diarization
Image Processing
Google Vision API for OCR and image analysis
PDF OCR
Gemini multimodal for PDF text extraction
Layout & Canvas
React Grid Layout
React Grid Layout (Fork)
Draggable and resizable grid layout system (custom fork)
- Drag-and-drop card positioning
- Resize handles
- Responsive breakpoints
- Collision detection
- Custom fork with ThinkEx-specific optimizations
Drag and Drop
dnd-kit 0.3
Modern drag-and-drop toolkit for React
- Drag cards into folders
- Reorder flashcards
- File uploads via drag-and-drop
File Storage
ThinkEx supports two storage backends:Local Storage (Recommended for Self-Hosting)
Local Storage (Recommended for Self-Hosting)
- Files stored in
./uploadsdirectory - No external dependencies
- Full control over data
- Set
STORAGE_TYPE=localin.env
Supabase Storage (Cloud-based)
Supabase Storage (Cloud-based)
- Files stored in Supabase bucket
- CDN-backed for fast delivery
- Scalable for large deployments
- Set
STORAGE_TYPE=supabasein.env - Requires Supabase project credentials
src/lib/uploads/
Real-Time Communication
ThinkEx uses PostgreSQL triggers for real-time event broadcasting:- Events inserted into
workspace_eventstrigger broadcasts - Clients subscribe via WebSocket to
workspace:<id>:eventschannel - Low latency (under 100ms) for local changes to propagate
- No additional infrastructure required (no Redis, no separate WebSocket server)
drizzle/0001_add_realtime_collaboration.sql:37 for trigger definition.
Developer Tools
Build & Dev Tools
pnpm
Fast, disk-efficient package manager
ESLint
Linter for code quality and consistency
Prettier
Opinionated code formatter
TypeScript Compiler
Type checking with
pnpm tcMonitoring & Analytics
PostHog
PostHog
- Product analytics and feature flags
- Self-hosted or cloud
- Packages:
posthog-js,posthog-node - Optional: Set
NEXT_PUBLIC_POSTHOG_KEYin.env
Vercel Speed Insights
Vercel Speed Insights
- Real user monitoring (RUM)
- Core Web Vitals tracking
- Optional: Automatically enabled on Vercel deployments
OpenTelemetry
OpenTelemetry
- Distributed tracing and logging
- Packages:
@opentelemetry/api-logs,@opentelemetry/sdk-logs - Optional: Configure exporter in
src/lib/with-api-logging.ts
Package Manager
pnpm is required. ThinkEx uses pnpm-specific features like workspaces and overrides that are not compatible with npm or yarn.
package.json)
Version Requirements
| Dependency | Minimum Version | Notes |
|---|---|---|
| Node.js | 20+ | Required for Next.js 16 |
| PostgreSQL | 12+ | Required for JSONB and RLS |
| pnpm | 10+ | Required for workspace features |
| Docker | 20+ | Optional, for local Postgres |
Full Dependency List
For the complete list of dependencies with exact versions, see:- Dependencies:
package.jsonlines 29-156 - Dev Dependencies:
package.jsonlines 157-181
- UI: Lucide React (icons), Motion (animations), Geist (font)
- Forms: React Hook Form, Zod (validation)
- Markdown: React Markdown, Remark/Rehype plugins
- Math: KaTeX, MathLive
- Diagrams: Mermaid
- Syntax Highlighting: Shiki, React Shiki
- Utilities: clsx, tailwind-merge, date-fns
Related Documentation
- System Architecture - How ThinkEx is architected
- Contributing Guide - Set up your dev environment
- Self-Hosting Guide - Deploy ThinkEx