DEV Community

Sameer Shah
Sameer Shah

Posted on

Building an AI-Powered Event Feedback System: Gemini 2.5 + FastAPI + Supabase + Automated PDF Reports

After running an event, the feedback collection process is almost always broken. You get a spreadsheet of raw responses, manually tally the ratings, write a summary email to the organizer, and hope you didn't miss anything important. It's tedious, slow, and doesn't scale.

I built a full-stack AI-powered event feedback system that automates this entire pipeline end-to-end — from the moment an attendee submits feedback to a branded PDF report landing in the organizer's inbox, complete with AI-generated sentiment analysis and improvement suggestions.

What the System Does

Every feedback submission triggers a fully automated chain:

  1. Form data is cleaned and validated by the FastAPI backend
  2. Gemini 2.5 analyzes the text for sentiment, urgency, highlights, and suggestions
  3. A branded HTML report is generated and converted to PDF
  4. The PDF is emailed to the event organizer via Gmail SMTP
  5. All data (including AI output) is persisted to a Supabase PostgreSQL database
  6. The analytics dashboard reflects the new submission in real time

System Architecture

Form Submission
      │
      ▼
Data Cleaning & Normalization
      │
      ▼
Gemini 2.5 AI Analysis
      │
      ▼
HTML Report Generation (Branded)
      │
      ▼
PDF Conversion
      │
      ├──▶ SMTP Email to Organizer
      │
      └──▶ Supabase Database Storage
                │
                ▼
      Dashboard & Analytics
                │
                ▼
      Date-Range Bulk Report (PDF + Email)
Enter fullscreen mode Exit fullscreen mode

Tech Stack

Layer Technology
Frontend Next.js + Tailwind CSS
Backend FastAPI (Python)
AI Analysis Google Gemini 2.5
Email Gmail SMTP (TLS, Port 587)
PDF Generation HTML-to-PDF conversion
Database Supabase (PostgreSQL)

The AI Analysis Layer: Gemini 2.5

The most interesting part of this system is the AI pipeline. Rather than using a generic sentiment library, I integrated Google Gemini 2.5 directly to generate structured, actionable intelligence from each feedback submission.

The prompt is designed to return a consistent JSON structure every time:

{
  "sentiment": "Positive | Neutral | Negative",
  "summary": "2-3 sentence summary of the feedback",
  "highlights": ["key point 1", "key point 2"],
  "improvementSuggestions": ["suggestion 1", "suggestion 2"],
  "urgency": "Low | Medium | High"
}
Enter fullscreen mode Exit fullscreen mode

The urgency field is particularly useful — it lets organizers immediately identify submissions that need follow-up action, without reading every comment manually.

Tip: When prompting Gemini for structured JSON output, always explicitly specify the expected schema in your prompt and validate the response server-side. LLMs can occasionally deviate from the schema under edge cases.

📄 Automated PDF Report Generation

After AI analysis, the backend generates a branded HTML report and converts it to PDF. The report includes:

  • Event metadata (name, date, organizer)
  • Attendee information
  • Star rating visualization
  • AI-generated summary and highlights
  • Improvement suggestions with urgency indicator
  • Submission ID and timestamp for traceability

Using HTML-to-PDF conversion rather than a PDF library gives you full control over visual design — CSS, fonts, colors, layout — without being constrained by a library's API.

SMTP Email Delivery

The PDF report is automatically emailed to the event organizer via Gmail SMTP:

# Email config
SMTP_HOST = "smtp.gmail.com"
SMTP_PORT = 587
SMTP_SECURITY = "TLS"

# The SMTP password is stored in .env — never hardcoded
Enter fullscreen mode Exit fullscreen mode

Important: Gmail requires an App Password (not your account password) when authenticating via SMTP with 2FA enabled. Store it exclusively in environment secrets.

Database Schema: Supabase

All submissions and AI outputs are persisted to a Supabase PostgreSQL table (feedback_reports). The schema captures everything — raw input, AI analysis fields, PDF URL, and email delivery status — in a single row per submission, making dashboard queries simple and fast.

Key fields: submissionId, eventName, eventDate, rating, sentiment, summary, urgency, highlights, improvementSuggestions, pdfUrl, emailSent.

The Analytics Dashboard

The Next.js dashboard connects to the API and provides:

  • Real-time submission counts and average ratings
  • Sentiment breakdown (Positive / Neutral / Negative)
  • High-urgency submission highlighting
  • Filterable table with date range, event name, and sentiment filters
  • Per-submission PDF access links

The bulk report feature is especially powerful: select a date range, and the system retrieves all submissions in that window, passes the full dataset to Gemini for a consolidated analysis, generates a combined PDF, and emails it to the admin. A multi-hour manual reporting task reduced to a single button click.

Security Considerations

  • SMTP credentials stored exclusively in environment variables — never in the codebase
  • Supabase connection credentials managed via env secrets
  • Input validation at the FastAPI layer using Pydantic before data reaches AI or storage
  • Gemini API key scoped to the backend only — never exposed to the client

Getting Started

git clone https://github.com/Sameershahh/feedback-form-system
cd feedback-form-system

# Backend
cd api
pip install -r requirements.txt
# Add .env with Supabase, Gmail SMTP, and Gemini credentials
uvicorn main:app --reload

# Frontend
cd ../frontend
npm install
npm run dev
Enter fullscreen mode Exit fullscreen mode

Real-World Use Cases

  • Conference and workshop organizers collecting post-event feedback
  • Corporate training teams tracking session quality
  • SaaS products embedding feedback collection into onboarding flows
  • Event agencies needing automated client-ready reports

Resources

Curious about the AI prompt engineering behind the Gemini integration, or how the bulk report aggregation works? Drop a comment — happy to go deeper on any part of the stack.


Built by Sameer Shah — AI & Full-Stack Developer | Portfolio

Top comments (0)