A full-stack application for uploading, analyzing, and visualizing CSV data with a modern dashboard and comprehensive analytics.
- Tech Stack
- Prerequisites
- Quick Start
- Development
- Production Deployment
- API Documentation
- Testing
- Project Structure
- Assumptions
- π FastAPI - Modern, fast web framework for building APIs
- π PostgreSQL 18 - Robust relational database
- π SQLModel - SQLAlchemy + Pydantic for type-safe ORM
- π Alembic - Database migration management
- πΌ Pandas - Data manipulation and CSV processing
- π§ͺ Pytest - Comprehensive testing framework
- π Python-Jose - JWT authentication with cryptographic signing
- π Bcrypt - Secure password hashing
- π¦ Uvicorn - ASGI web server
- π Vue 3.5 - Progressive JavaScript framework
- β‘ Vite 7 - Next-generation build tool with instant HMR
- π¦ TypeScript 5.9 - Type-safe JavaScript
- π Pinia - State management with Colada for server-state
- π¨ UnoCSS - Atomic CSS engine (Tailwind-like utilities)
- π Radix Vue + Reka UI - Headless, accessible component libraries
- π Unovis Vue - Interactive data visualization library
- π TanStack Vue Table - Headless, feature-rich data table
- π¦ Bun - Fast JavaScript runtime and package manager
- π§ͺ Vitest - Unit testing powered by Vite
- π ESLint - Code quality and linting
- π³ Docker - Containerization
- π Docker Compose - Multi-container orchestration
- π Nginx - Reverse proxy and static file server
- π CORS Middleware - Cross-origin resource sharing
- π Makefile - Development command shortcuts
- π¦ uv - Fast Python package manager
- π Hot Module Replacement (HMR) - Instant code refresh
- π§ Auto imports - Automatic component/utility imports
- π File-based routing - Convention over configuration
Before you begin, ensure you have the following installed:
- Docker and Docker Compose (v2.0+)
- Make (for convenience commands)
- Bun (for frontend development) - Optional, used for development
- Python 3.12+ (for backend development) - Optional, used for development
- A CSV file with sales data
- Example file:
example/sales_data_sample.csv - Expected format: Headers with columns like Order ID, Product, Quantity, Price, etc.
- Example file:
-
Clone the repository
git clone <repository-url> cd csv-data-ingestion
-
Configure environment variables
cp .env.example .env
Edit
.envif needed (default values work for local development) -
Build and start services
docker compose up -d
-
Access the application
- Frontend: http://localhost:8080
- Backend API: http://localhost:8000
- API Swagger Docs: http://localhost:8000/docs
-
Stop services
docker compose down
cd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync
make migrate # Run from rootcd frontend
bun installFrom the root directory:
make devOr run individually:
# Terminal 1: Start database
make db
# Terminal 2: Start backend (FastAPI dev server)
make backend
# Terminal 3: Start frontend (Vite dev server)
make frontendDevelopment URLs:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Swagger: http://localhost:8000/docs
make setup # Initial project setup (install dependencies, setup database)
make dev # Start all dev servers
make db # Start database container
make backend # Start backend dev server
make frontend # Start frontend dev server
make migrate # Run database migrations
make prod # Build and run production containers
make prod-build # Build production Docker images
make prod-stop # Stop production containerscsv-data-ingestion/
βββ backend/ # FastAPI application
β βββ app/
β β βββ main.py # FastAPI application setup
β β βββ routers/ # API route handlers
β β β βββ auth.py # Authentication endpoints
β β β βββ datasets.py # Dataset management endpoints
β β βββ ...
β βββ migrations/ # Alembic database migrations
β βββ tests/ # Backend tests
β βββ pyproject.toml # Python dependencies
βββ frontend/ # Vue 3 + Vite application
β βββ src/
β β βββ pages/ # Page components (file-based routing)
β β βββ components/ # Reusable components
β β βββ stores/ # Pinia state management
β βββ test/ # Frontend tests
β βββ package.json # Node dependencies
βββ example/ # Example CSV data
βββ compose.yaml # Docker Compose configuration
βββ .env.example # Environment variables template
βββ Makefile # Development commands
docker compose -f compose.yaml buildCreate a .env file with production values:
POSTGRES_USER=postgres
POSTGRES_PASSWORD=<secure-password>
POSTGRES_DB=csv_ingestion
SECRET_KEY=<secure-random-key>
PORT=80docker compose up -dThe application will be available at the configured PORT (default: 80).
The backend provides interactive API documentation via Swagger UI at /docs.
Authentication
POST /api/auth/register- Register a new userPOST /api/auth/login- Login and receive JWT tokenPOST /api/auth/refresh- Refresh authentication token
Datasets
GET /api/datasets- List all datasetsPOST /api/datasets/upload- Upload and process CSV fileGET /api/datasets/{dataset_id}- Get dataset detailsGET /api/datasets/{dataset_id}/data- Get dataset recordsGET /api/datasets/{dataset_id}/summary- Get dataset analytics
Health
GET /api/health- Service health check
For detailed request/response schemas, visit the Swagger UI at http://localhost:8000/docs
cd backend
pytest # Run all tests
pytest -v # Run with verbose output
pytest tests/test_api.py # Run specific test file
pytest -k test_name # Run tests matching patterncd frontend
bun test # Run all tests
bun test -- --watch # Run in watch mode
bun test -- --ui # Run with UI-
CSV Format: The uploaded CSV files are expected to have a header row with column names. Data consistency is not validated at upload time - errors may be caught during processing.
-
Authentication: The application uses JWT-based authentication stored in secure httpOnly cookies. Authentication is required for all data operations.
-
Database: PostgreSQL 18 is used as the primary database. The database schema is automatically initialized via Alembic migrations on first run.
-
File Upload Limits: Large CSV files are processed in memory. File size limits may apply depending on server memory availability.
-
CORS: In development, CORS is permissive (
allow_origins=["*"]). For production, update this inbackend/app/main.py. -
Frontend Build: The frontend is served as static files from an Nginx container. The API URL for the frontend is configured during build time.
-
Data Privacy: All data is stored in a local PostgreSQL container. No data is sent to external services. For production, ensure proper backup and security measures are in place.
-
Timezone: All timestamps are stored in UTC. Client-side timezone handling depends on the frontend implementation.
- Ensure PostgreSQL container is healthy:
docker compose ps - Check logs:
docker compose logs db
- Change
PORTin.envfile - Or kill existing process:
lsof -i :8080andkill -9 <PID>
- Check database logs:
docker compose logs migrate - Manually verify database:
docker compose exec db psql -U postgres -d csv_ingestion
- Clear node_modules:
cd frontend && rm -rf node_modules bun.lock && bun install - Clear build cache:
rm -rf frontend/dist
For issues or questions, check the individual README files in the backend/ and frontend/ directories for component-specific details.