System Architecture
Meridian is built as a modern full-stack application that combines real-time data processing, AI-powered analytics, and collaborative features. The architecture is designed for scalability, performance, and developer experience.High-Level Architecture
Core Architectural Layers
1. Frontend Layer
Built with React 19 and TanStack Start, the frontend provides a modern, type-safe interface. Key Components:- Dashboard (
src/routes/_authed/dashboard.tsx:55) - File management and overview - Table View (
src/routes/_authed/table.$table.tsx:52) - Interactive data exploration - AI Agent Interface (
src/components/AgentEditor.tsx) - Natural language queries - Real-time Notifications (
src/components/TableNotifications.tsx) - Collaborative updates
- Mantine UI 8.3.6 - Component library with comprehensive features
- TanStack Table 8.21 - Powerful data grid with sorting, filtering, pagination
- Recharts 3.4 - Declarative charting library
- Motion 12.23 - Smooth animations and transitions
2. Backend Layer
Convex serves as the primary backend, providing:Real-time Database
Reactive queries with automatic subscriptions
Server Functions
Type-safe mutations, queries, and actions
Authentication
Built-in auth with @convex-dev/auth
File Storage
Integration with Cloudflare R2
- Schema definition:
convex/schema.ts:9 - File management:
convex/csv.ts:10 - AI agent:
convex/table_agent.ts:436 - Query logging:
convex/queryLog.ts
3. Data Processing Layer
DuckDB handles analytical queries and data transformations:- In-memory analytical processing
- SQL query execution
- CSV/JSON data ingestion
- Statistical analysis
- Integration with MotherDuck for cloud persistence
4. Storage Layer
Cloudflare R2 provides object storage:- Uploaded CSV/Excel files
- Generated JSON datasets
- File metadata in Convex
5. AI Layer
Google Gemini 2.5 Flash powers intelligent features:- Natural language to SQL conversion
- Data analysis and insights
- Statistical interpretation
- Chart recommendations
- Firecrawl - Web scraping and data extraction
- Convex Agent - Structured tool calling and workflow orchestration
Key Architecture Patterns
Server Functions
TanStack Start’s server functions provide type-safe client-server communication:Real-time Subscriptions
Convex provides automatic reactivity:File-based Routing
TanStack Start uses file-system routing:State Management
Combination of:- TanStack Query - Server state and caching
- React State - Local UI state
- Convex Subscriptions - Real-time data
Security Architecture
Authentication Flow
- Session-based authentication via @convex-dev/auth
- User context in all backend operations
- Protected routes with authentication guards
Authorization
Row-level security ensures users only access their data:Performance Optimizations
Pagination
Pagination
Large datasets are paginated client-side with customizable page sizes (50, 100, 200 rows)
Query Caching
Query Caching
TanStack Query caches server responses with configurable invalidation
Streaming Responses
Streaming Responses
AI agent responses stream incrementally for better UX
Column Virtualization
Column Virtualization
Only visible columns are rendered, improving performance with wide tables
Deployment Architecture
Meridian can be deployed to multiple platforms: Recommended Stack:- Frontend + SSR: Netlify, Vercel, or Cloudflare Pages
- Backend: Convex (fully managed)
- Storage: Cloudflare R2
- Database: DuckDB with MotherDuck
Next Steps
Tech Stack Details
Explore detailed information about each technology
Data Flow
Learn how data moves through the system