Live Demo: structurify.web.app
Structurify is a production-ready, event-driven B2B SaaS platform that automates the transformation of unstructured, messy spreadsheet data (CSV, XLSX) into a standardized master schema using Google Gemini 2.5 Flash.
Built on a completely decoupled Serverless Fan-Out Architecture on Google Cloud Platform (GCP), Structurify ensures 0% web server blocking, high resilience under burst loads, and highly cost-effective scaling. It utilizes a LangGraph Map-Reduce pipeline to gracefully process files of immense scale by dynamically batching and error-correcting the LLM output.
- Strict Schema Enforcement: Define exactly the JSON/Excel schema you need, and Structurify will enforce strict type-casting and structure.
- Auto-Clean Mode: Don't know the schema? Structurify will automatically infer the schema from the file headers and repair capitalization, trim whitespace, and standardize date formats across the board.
- Email Notifications: Upload a massive dataset (over 5MB), and Structurify will immediately email you a tracking link to watch the live progress, followed by a final success email with your secure download URL.
- Massive Scalability: The backend acts as a lightweight router while heavy data processing is handled by scalable workers via Cloud Pub/Sub, preventing Gateway Timeouts on long jobs.
The architecture utilizes a robust asynchronous data pipeline:
- Next.js Frontend: The user drops a messy spreadsheet and defines a target JSON schema (or leaves it blank for Auto-Clean).
- Direct to GCS: The file is securely uploaded directly from the browser to a Google Cloud Storage bucket via a presigned URL generated by the Backend Gateway.
- API Gateway (FastAPI): Logs the job in Firestore and dispatches a lightweight event to Google Cloud Pub/Sub.
- Cloud Run Worker (FastAPI/Python): A massively scalable, asynchronous worker consumes the Pub/Sub push notification.
- LangGraph Map-Reduce Pipeline:
- Split: The worker chunks the file (e.g. 500 rows at a time).
- Map (LangGraph): Each chunk is pushed to Gemini 2.5 Flash using strict
response_schemaparameters. If Gemini hallucinates or encounters an error, a LangGraph state-machine automatically retries the extraction up to 3 times. - Reduce: A transaction counter monitors the chunks. When all are complete, a final Reducer service compiles them into a pristine Excel (
.xlsx) workbook.
- Real-time UI: The frontend listens to Firestore via
onSnapshotand instantly provides the user with a real-time progress bar and a secure download URL.
- Frontend: Next.js 14, React, TailwindCSS, Firebase Client SDK
- Backend API Gateway: Python, FastAPI, Uvicorn
- Asynchronous Worker: Python, FastAPI, Pandas, LangGraph, Google GenAI SDK (Gemini 2.5 Flash), Tenacity
- Cloud Infrastructure: Google Cloud Platform (Cloud Run, Cloud Storage, Cloud Pub/Sub, Firestore, Artifact Registry, Secret Manager)
- Architecture Standard: Clean Architecture / Domain Driven Design (DDD)
- Testing:
pytest,httpx,jest, React Testing Library
Structurify heavily leverages GCP's serverless ecosystem to achieve massive scalability and low operational overhead. Here is how each service is utilized:
- Cloud Run: Hosts both the FastAPI Gateway (
structurify-backend) and the LangGraph Processing Engine (structurify-worker) as serverless containers. The backend is public-facing, while the worker is private and triggered internally. - Cloud Storage (GCS): Provides highly durable object storage.
raw-uploadsbucket stores incoming, messy spreadsheets.processed-outputsbucket stores the final, clean.xlsxand.csvfiles.
- Cloud Pub/Sub: The backbone of the asynchronous event-driven architecture. The backend publishes events to the
schema-transformation-jobstopic, which then securely pushes the workload to the Cloud Run Worker without holding open synchronous HTTP connections. - Firestore (Datastore): The primary NoSQL database. It logs every job's status, tracking progress in real-time. The frontend subscribes to these Firestore documents via
onSnapshotto render the live loading timeline. - Artifact Registry: Acts as the secure, private container image registry. It stores the Docker images for both the backend and worker before they are deployed to Cloud Run.
- Secret Manager: Securely stores sensitive credentials like the
GEMINI_API_KEY. The Cloud Run worker pulls these directly into environment variables at runtime, ensuring keys are never exposed in plaintext. - Firebase Hosting: Serves the Next.js static frontend application globally with low-latency CDN caching.
The codebase strictly adheres to Clean Architecture principles across all microservices:
Structurify/
├── backend/ # API Gateway Service
│ ├── src/
│ │ ├── api/routers # FastAPI endpoints
│ │ ├── core/ # Environment configs (pydantic-settings)
│ │ ├── models/ # Pydantic request/response schemas
│ │ └── services/ # GCP abstractions (Storage, PubSub, Firestore)
│ └── tests/ # Pytest suites
│
├── worker/ # Asynchronous Processing Engine
│ ├── src/
│ │ ├── api/ # PubSub Push endpoints (Map / Reduce routes)
│ │ └── services/ # LangGraph Chunk Processor, Reducer, File Parser, Email Service
│ └── tests/ # Pytest suites (Mocks GCP & Gemini)
│
├── frontend/ # Next.js Application
│ ├── src/
│ │ ├── app/ # Next.js App Router orchestration
│ │ ├── components/ # Atomic UI (SchemaBuilder, Timeline, UploadZone)
│ │ └── hooks/ # Decoupled business logic (useFileUpload, useJobListener)
│ └── __tests__/ # Jest component & hook tests
│
├── deploy.sh # Fully automated CI/CD to Cloud Run
└── setup_gcp_infrastructure.sh # Automated IaC for entire GCP environment
- Node.js >= 18
- Python >= 3.10
- Google Cloud CLI (
gcloud) installed and authenticated - A Firebase Project (for the frontend client)
Navigate into the respective folders and copy the .env.example to .env (or .env.local for frontend).
Backend (backend/.env)
GOOGLE_CLOUD_PROJECT=your-gcp-project-id
RAW_BUCKET_NAME=raw-uploads-your-gcp-project-id
PUBSUB_TOPIC_ID=schema-transformation-jobsWorker (worker/.env)
GOOGLE_CLOUD_PROJECT=your-gcp-project-id
RAW_BUCKET_NAME=raw-uploads-your-gcp-project-id
PROCESSED_BUCKET_NAME=processed-outputs-your-gcp-project-id
GEMINI_API_KEY=your-gemini-api-key
FRONTEND_URL=http://localhost:3000
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_FROM_EMAIL=your-email@gmail.comFrontend (frontend/.env.local)
NEXT_PUBLIC_FIREBASE_API_KEY=...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=...
NEXT_PUBLIC_FIREBASE_PROJECT_ID=...
# ... other firebase config
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000Start the Backend (Port 8000)
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --port 8000 --reloadStart the Worker (Port 8080)
cd worker
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --port 8080 --reloadStart the Frontend (Port 3000)
cd frontend
npm install
npm run dev- Backend:
cd backend && PYTHONPATH=backend pytest backend/tests/ - Worker:
cd worker && PYTHONPATH=worker pytest worker/tests/ - Frontend:
cd frontend && npm run test
Structurify is designed for seamless, automated deployment to Google Cloud Run.
Run the infrastructure shell script once to provision Artifact Registry, Storage Buckets, Firestore, Secret Manager, Pub/Sub, and IAM rules.
chmod +x setup_gcp_infrastructure.sh
./setup_gcp_infrastructure.sh your-gcp-project-id us-central1 your-gemini-api-keyWhenever you make changes to the code, simply run the deployment script to build the Docker images via Cloud Build and deploy them directly to Cloud Run.
chmod +x deploy.sh
./deploy.sh your-gcp-project-id us-central1(Once deployed, update your frontend/.env.local's NEXT_PUBLIC_BACKEND_URL to point to the live Backend Cloud Run URL).