Skip to content

AndreyLebedev345/cloud-data-analyst

Repository files navigation

Cloud Data Analyst

AI-powered data analysis platform using Claude and Modal sandboxes.

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   Next.js       │────▶│   FastAPI       │────▶│   Modal         │
│   Frontend      │     │   Backend       │     │   Sandbox       │
└─────────────────┘     └─────────────────┘     └─────────────────┘
                              │                        │
                              ▼                        ▼
                        ┌─────────────────┐     ┌─────────────────┐
                        │   Claude API    │     │   Modal Volume  │
                        └─────────────────┘     │   (Shared)      │
                                                └─────────────────┘

Setup

Prerequisites

Backend Setup

cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows

# Install dependencies
pip install -r requirements.txt

# Set environment variables
export ANTHROPIC_API_KEY=your-api-key
export MODAL_TOKEN_ID=your-modal-token-id
export MODAL_TOKEN_SECRET=your-modal-token-secret

# Deploy Modal app (first time only)
modal deploy modal_sandbox.py

# Start the backend
uvicorn main:app --reload

Frontend Setup

cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

Usage

  1. Open http://localhost:3000
  2. Upload a CSV file using the drag-drop zone
  3. Ask questions about your data:
    • "What's in this file?"
    • "Show me summary statistics"
    • "Create a histogram of [column]"
    • "What correlations exist between columns?"

Features

  • Secure Execution: Code runs in Modal sandboxes with no network access
  • Data Analysis: pandas, numpy, matplotlib, seaborn pre-installed
  • Streaming Responses: Real-time streaming from Claude
  • Visualization: Matplotlib plots displayed inline

Security

  • 60-second execution timeout
  • Network disabled in sandboxes
  • Path validation prevents directory traversal
  • 10MB file upload limit
  • CSV, JSON, TXT files only
  • 24-hour session expiry

API Endpoints

  • POST /api/sessions - Create new session
  • POST /api/sessions/{id}/upload - Upload file
  • POST /api/sessions/{id}/chat - Chat with Claude (SSE)
  • GET /api/sessions/{id}/files - List files
  • GET /api/sessions/{id}/files/{name} - Download file

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •