Skip to content

About

Full-stack AI app that analyzes CSV datasets using Google Gemini and returns a rich markdown report

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Data Dashboard β€” CSV Analyzer

Live Demo Backend GitHub

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


Table of Contents


Overview

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.


Tech Stack

Backend

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

Frontend

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

AI

Service Model
Google Gemini API gemini-flash-latest

Project Structure

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

Getting Started

Prerequisites


Backend Setup

# 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 dev

The backend will start on http://localhost:5000.


Frontend Setup

# 1. Navigate to the frontend directory
cd frontend

# 2. Install dependencies
npm install

# 3. Start the development server
npm run dev

The frontend will start on http://localhost:3000.


Environment Variables

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 .env to version control. Add backend/.env to your .gitignore.


API Reference

POST /api/analyze

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 (.csv file)

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

Features

  • Drag & Drop Upload β€” Drop any .csv file 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.

How It Works

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

About

Full-stack AI app that analyzes CSV datasets using Google Gemini and returns a rich markdown report

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages