# Technology Stack

## Backend

- **Language**: TypeScript (Node.js)
- **Framework**: Fastify
- **Scraping**: Playwright (headless Chromium)
- **Database**: PostgreSQL + TimescaleDB extension
- **ORM**: Prisma or Drizzle
- **Job Scheduling**: Node Scheduler or BullMQ
- **WebSockets**: Native `ws` or Fastify WS plugin
- **Deployment**: Docker containers

## Frontend (Flutter Cross-Platform App)

- **Framework**: Flutter 3.38+
- **Language**: Dart 3.10+
- **State Management**: Provider
- **Charts**: fl_chart
- **Styling**: Material Design 3
- **WebSocket**: web_socket_channel
- **Storage**: shared_preferences + sqflite
- **Notifications**: flutter_local_notifications
- **Window Management**: window_manager (desktop)
- **Platforms**: Windows, macOS, Linux, Android, iOS

## Testing

- **Unit Tests**: Jest
- **E2E Tests**: Playwright
- **API Integration**: Supertest or Pact

## Common Commands

```bash
# Backend
npm run dev          # Start development server
npm run build        # Build TypeScript
npm run test         # Run Jest tests
npm run scrape       # Manual scrape trigger

# Frontend (Flutter)
flutter run -d windows    # Run on Windows
flutter run -d android    # Run on Android
flutter run -d ios        # Run on iOS
flutter build windows     # Build Windows release
flutter build apk         # Build Android APK
flutter pub get           # Install dependencies
flutter doctor            # Check setup

# Database
npm run migrate      # Run database migrations
npm run seed         # Seed initial data
```

## Performance Requirements

- API latency < 50ms for standard queries
- Support 5000+ concurrent WebSocket connections
- Desktop app must handle 50k+ chart datapoints smoothly
- Scraping frequency: every 5 minutes (configurable)
