A full-stack web application that lets you upload a CSV dataset and receive an instant, AI-generated markdown analysis powered by Google Gemini. Results are persisted to MongoDB Atlas and displayed in a clean, modern React dashboard.
π Live App: https://ai-powered-csv-cleaner-summarizer.vercel.app
- Overview
- Tech Stack
- Project Structure
- Getting Started
- Environment Variables
- API Reference
- Features
- How It Works
Upload any .csv file through the drag-and-drop interface. The backend reads the file, constructs a prompt, and sends the raw data to the Gemini Flash model. Gemini returns a detailed markdown report covering key trends, anomalies, and strategic recommendations. The report is saved to MongoDB and rendered beautifully in the browser β including formatted tables and bold text.
| Technology | Purpose |
|---|---|
| Node.js + Express | REST API server |
| MongoDB Atlas + Mongoose | Cloud database & ODM |
| Multer | CSV file upload handling |
| Axios | HTTP client for Gemini API calls |
| dotenv | Environment variable management |
| CORS | Cross-origin request support |
| Nodemon | Dev server auto-restart |
| Technology | Purpose |
|---|---|
| React 18 + Vite | UI framework & dev toolchain |
| Tailwind CSS v3 | Utility-first styling |
| react-dropzone | Drag-and-drop file input |
| react-markdown + remark-gfm | Render Gemini's markdown response with tables |
| lucide-react | Icon library |
| Axios | API requests to the backend |
| @tailwindcss/typography | Beautiful prose styling for markdown output |
| Service | Model |
|---|---|
| Google Gemini API | gemini-flash-latest |
CSV file cleaner/
β
βββ backend/
β βββ config/
β β βββ db.js # Mongoose connection
β βββ controllers/
β β βββ aiController.js # Upload handler, Gemini call, DB save
β βββ models/
β β βββ Report.js # Mongoose schema for saved reports
β βββ routes/
β β βββ aiRoutes.js # POST /api/analyze with Multer middleware
β βββ uploads/ # Temporary file storage (auto-cleaned)
β βββ .env # Environment variables (not committed)
β βββ server.js # Express entry point
β βββ package.json
β
βββ frontend/
β βββ src/
β β βββ App.jsx # Main dashboard UI (all components)
β β βββ main.jsx # React root mount
β β βββ index.css # Tailwind directives
β βββ tailwind.config.js # Tailwind + typography plugin config
β βββ postcss.config.js # PostCSS config
β βββ vite.config.js # Vite config (dev port: 3000)
β βββ package.json
β
βββ README.md
- Node.js v18 or higher
- A MongoDB Atlas account with a cluster
- A Google Gemini API key from aistudio.google.com/apikey
# 1. Navigate to the backend directory
cd backend
# 2. Install dependencies
npm install
# 3. Create and populate your .env file (see Environment Variables below)
# 4. Start the development server
npm run devThe backend will start on http://localhost:5000.
# 1. Navigate to the frontend directory
cd frontend
# 2. Install dependencies
npm install
# 3. Start the development server
npm run devThe frontend will start on http://localhost:3000.
Create a .env file inside the backend/ directory with the following keys:
PORT=5000
MONGO_URI="your_mongodb_atlas_connection_string"
GEMINI_API_KEY="your_gemini_api_key"| Variable | Description |
|---|---|
PORT |
Port the Express server listens on (default: 5000) |
MONGO_URI |
Full MongoDB Atlas connection string including DB name |
GEMINI_API_KEY |
API key from Google AI Studio |
β οΈ Never commit.envto version control. Addbackend/.envto your.gitignore.
Accepts a CSV file upload, sends it to Gemini for analysis, saves the result to MongoDB, and returns the full report.
Request
- Content-Type:
multipart/form-data - Field name:
file(.csvfile)
Success Response β 200 OK
{
"success": true,
"report": {
"_id": "...",
"filename": "sales_data.csv",
"rawData": "Date,Product,Price,Quantity\n...",
"aiSummary": "## Executive Summary\n...",
"createdAt": "2026-05-29T16:41:23.122Z",
"__v": 0
}
}Error Responses
| Status | Cause |
|---|---|
400 |
No file attached to the request |
500 |
Gemini API failure or database error |
- Drag & Drop Upload β Drop any
.csvfile directly onto the upload zone, or click to browse. Displays filename and file size on selection. - AI-Powered Analysis β The raw CSV is passed to Gemini with a structured prompt requesting a markdown breakdown of trends, anomalies, and insights.
- Persistent Reports β Every analysis is saved to MongoDB Atlas with filename, raw data, AI summary, and timestamp.
- Markdown Rendering β Gemini's response renders fully: headings, bold text, bullet lists, and data tables all display correctly via
react-markdown+remark-gfm. - Loading State β An animated spinner with "Analyzing dataset with Geminiβ¦" message displays while the request is in flight.
- Error Handling β Network and API errors surface inline without crashing the UI.
- Reset Flow β An "Analyze a new file" button clears state and returns to the upload screen.
- Responsive Design β Works cleanly on mobile, tablet, and desktop screens.
User drops CSV
β
βΌ
React (App.jsx)
ββ axios POST /api/analyze (multipart/form-data)
β
βΌ
Express Server
ββ Multer saves file to uploads/
β
βΌ
aiController.js
ββ fs.readFileSync β rawData string
ββ Build Gemini prompt
ββ axios POST β Gemini Flash API
ββ Extract aiSummary from response
ββ Report.create() β MongoDB Atlas
ββ fs.unlinkSync β temp file deleted
β
βΌ
{ success: true, report: { ... } }
β
βΌ
React renders report.aiSummary
ββ <ReactMarkdown> with remark-gfm
β Tables, headings, bold text all formatted