An AI-powered business analytics platform (prototype). Upload a CSV or Excel file and get an instant AI-generated executive summary, KPIs, auto-suggested charts, and a chatbot that answers questions about your data.
- Upload a
.csv/.xlsx/.xlsfile from the dashboard. - The backend processes it in the background:
- An LLM detects the header row (even in messy spreadsheets) and the data is cleaned.
- A FAISS vector store is built over the rows for retrieval-augmented Q&A.
- Mistral (via OpenRouter) generates an executive summary, chart suggestions, and KPIs.
- The dashboard shows the AI summary, interactive Recharts visualizations, and a chat panel where you can ask questions like "What caused the revenue dip last quarter?".
├── backend/ # FastAPI backend (port 8006)
│ ├── app/
│ │ ├── main.py # App entry point, routers, CORS
│ │ ├── routes/ # auth, upload, preview, kpis, charts, gpt (/ask), dashboard, admin
│ │ ├── models/ # SQLAlchemy models: User, UploadedFile, ParsedData
│ │ ├── tasks/ # Background file-processing pipeline
│ │ ├── utils/ # JWT auth, embeddings/LLM helpers
│ │ └── custom_models/ # LangChain wrapper for the Mistral chat API
│ ├── .kiro/specs/ # Feature requirement specs
│ ├── requirements.txt # Direct dependencies
│ └── requirements.lock.txt # Pinned versions (pip freeze)
└── frontend/ # React 19 + Tailwind CSS app (port 3000)
└── src/
├── api/ # Axios API layer (JWT attached automatically)
├── pages/ # Home, Login, Register, Dashboard, Admin, ...
├── components/ # Navbar, charts, tables, route guards
└── context/ # Login state
| Layer | Tech |
|---|---|
| Backend | FastAPI, SQLAlchemy, PostgreSQL, Uvicorn |
| AI / ML | LangChain, Mistral (direct + via OpenRouter), FAISS, sentence-transformers |
| Auth | JWT (python-jose), bcrypt (passlib), role-based access (user/admin) |
| Frontend | React 19, React Router 7, Tailwind CSS, Recharts, Chart.js, Framer Motion |
- Python 3.11+
- Node.js 18+
- PostgreSQL (with a database created for the app)
- API keys: Mistral and OpenRouter
cd backend
python -m venv env
env\Scripts\activate # Windows (source env/bin/activate on macOS/Linux)
pip install -r requirements.txt
# Configure secrets
copy .env.example .env # then edit .env with your DB URL and API keys
# Run (tables are created automatically on startup)
uvicorn app.main:app --reload --port 8006API docs are served at http://localhost:8006/docs.
cd frontend
npm install
copy .env.example .env # points at http://localhost:8006 by default
npm startThe app opens at http://localhost:3000.
- Register a normal user from the UI (
/register). - To create an admin, POST to
/api/registerwith"role": "admin"and theadmin_codematchingADMIN_SECRETfrom the backend.env. Admins are redirected to/admin/dashboardafter login, where they can view all users/files and delete files.
All endpoints are prefixed with /api and (except register/login) require a Bearer JWT.
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Create an account (role: admin requires admin_code) |
| POST | /login |
Get JWT + user info |
| POST | /upload |
Upload CSV/Excel, returns file_id, processing runs in background |
| GET | /status/{file_id} |
Poll processing status (pending → processed / failed) |
| GET | /dashboard/{file_id} |
Unified view: summary, charts, KPIs, preview rows |
| GET | /preview/{file_id} |
Sample parsed rows |
| GET | /kpis/{file_id} |
Statistical KPIs (cached; ?refresh=true to regenerate) |
| GET | /charts/{file_id} |
AI-suggested chart configs + data (cached; ?refresh=true) |
| POST | /ask |
RAG Q&A over the uploaded file ({file_id, question}) |
| GET | /admin/users |
List all users (admin only) |
| GET | /admin/files |
List all files (admin only) |
| DELETE | /admin/files/{id} |
Delete a file, its data, and its file on disk (admin only) |
| GET | /admin/files/{id}/preview |
Preview any file's parsed data (admin only) |
Backend (backend/.env): DATABASE_URL, JWT_SECRET_KEY, ADMIN_SECRET, MISTRAL_API_KEY, OPENROUTER_API_KEY — see .env.example.
Frontend (frontend/.env): REACT_APP_SERVER_IP — the backend base URL.
⚠️ Never commit.envfiles. They are excluded by.gitignore; use the.env.exampletemplates.
- Uploaded files (
uploads/), vector stores (vectorstores/), and generated charts (charts/) are runtime data and are git-ignored. - For production, restrict the CORS
allow_originslist inapp/main.pyto your frontend's domain.