Local Setup
Guide to setting up Meridian for local development.
Prerequisites
- Node.js 18+
- npm or pnpm
- Supabase account
- OpenRouter API key
Meridian Themes Setup
1. Clone and Install
# Clone the repo
git clone git@github.com:aic-holdings/meridian-themes-prototype.git
cd meridian-themes-prototype/web
# Install dependencies
npm install
2. Environment Configuration
# Copy environment template
cp .env.example .env.local
Configure the following:
# .env.local
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-key
# OpenRouter (for Perplexity research)
OPENROUTER_API_KEY=sk-or-v1-xxx
RESEARCH_MODEL=perplexity/sonar-medium-online
3. Database Setup
Run migrations:
# Apply theme tables
supabase db push
# Or manually run migration
psql $DATABASE_URL < supabase/migrations/001_create_themes_tables.sql
4. Start Development Server
npm run dev
Application runs at http://localhost:3000
Meridian Dashboard Setup
Repository
The Dashboard is part of the main AIC data-science monorepo:
cd aic-holdings/data-science/apps/Meridian
Environment
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
# Bloomberg data is processed via edge functions
# No additional API keys needed for viewing
Project Structure
Meridian Themes
meridian-themes-prototype/
├── web/
│ ├── app/ # Next.js App Router
│ ├── components/ # React components
│ ├── lib/ # Utilities
│ └── types/ # TypeScript types
├── supabase/
│ └── migrations/ # Database schemas
├── docs/ # Documentation
└── PRD.md # Product requirements
Meridian Dashboard
data-science/apps/Meridian/
├── app/ # Next.js application
├── components/ # UI components
├── lib/
│ └── services/ # Data services
│ └── bbg-quarterly-data-service.ts
└── supabase/
└── functions/ # Edge functions
└── process-bbg-quarterly/
Testing
Unit Tests
# Run tests
npm test
# Watch mode
npm test -- --watch
Type Checking
npm run typecheck
Common Issues
Supabase Connection
Error: Invalid API key
- Verify
NEXT_PUBLIC_SUPABASE_URLis correct - Check anon key matches project
OpenRouter Authentication
Error: 401 Unauthorized
- Verify
OPENROUTER_API_KEYis valid - Check API key has credits
Migration Errors
Error: relation "themes" already exists
- Tables may already exist from previous migration
- Check current schema before running migrations