Inspiration

Government budgets are among the largest financial products in the world, yet they remain inaccessible to most citizens. While there are countless tools for personal financial literacy, civic financial literacy is almost nonexistent. National budgets are published as lengthy documents filled with complex tables, making it difficult for students, citizens, and even professionals to understand how public money is allocated or what the consequences of policy changes might be.

We built FiscalQuant to change that. Instead of treating government budgets as static documents, FiscalQuant transforms them into an interactive quantitative portfolio where users can experiment with fiscal policy, visualize spending changes, and instantly understand the economic trade-offs through AI-generated insights. Our goal is to make public finance intuitive, engaging, and accessible to everyone.


What it does

FiscalQuant is an AI-powered civic fintech platform that makes government budgeting interactive and educational.

📊 Zero-Sum Budget Simulator

Users can reallocate government spending using intuitive sliders. Every adjustment follows a strict zero-sum constraint, automatically redistributing the remaining budget across other sectors while ensuring the total budget always remains constant.

🤖 AI Macroeconomic Trade-off Analysis

Every simulated budget is analyzed by a streaming Gemini AI model using Server-Sent Events (SSE). Instead of waiting for a complete response, users receive real-time explanations describing the economic, social, and fiscal consequences of their proposed budget.

📈 Historical Budget Comparison

Users can compare budgets across multiple years, view inflation-adjusted differences, and explore how government priorities have evolved over time.

📉 Interactive Visualizations

Responsive charts update instantly as allocations change, allowing users to immediately understand how every decision affects the overall fiscal distribution.


How we built it

FiscalQuant was built as a modern full-stack web application with a strong emphasis on mathematical correctness, performance, and user experience.

Frontend

  • Next.js 14 (App Router)
  • React
  • TypeScript
  • Tailwind CSS
  • Recharts

A custom Phosphor Terminal Dark design system was created to make dense financial information both visually appealing and easy to explore.

Quantitative Budget Engine

The core simulator runs entirely on the client, providing instant feedback while users drag budget sliders. To eliminate rounding inconsistencies, we implemented the Hamilton Largest Remainder Method, guaranteeing that all allocations always sum to exactly 100%.

AI Integration

Gemini AI was integrated using Server-Sent Events (SSE) to stream macroeconomic explanations in real time, making the platform feel conversational instead of waiting for long AI responses.

Performance Optimization

Upstash Redis is used to cache historical budget datasets and deterministic AI responses, reducing latency, minimizing API calls, and improving scalability.


Challenges we ran into

The most difficult challenge was implementing mathematically correct zero-sum redistribution.

Increasing one budget category while ensuring every other category adjusted proportionally—without allowing negative values, violating constraints, or introducing rounding errors—required building a custom allocation engine based on the Hamilton Largest Remainder algorithm.

Another challenge was synchronizing multiple real-time systems simultaneously. Slider interactions, React state updates, Recharts visualizations, and streaming AI responses all needed to remain perfectly synchronized while maintaining a smooth user experience.


Accomplishments that we're proud of

We're proud of transforming complex government finance into an interactive educational experience.

Instead of reading hundreds of pages of budget documents, users can immediately understand fiscal policy by experimenting with simulations and receiving AI-powered explanations.

Technically, we're also proud of building:

  • A mathematically precise zero-sum allocation engine
  • Real-time AI streaming with SSE
  • High-performance client-side simulations
  • A polished financial dashboard with responsive visualizations
  • A scalable architecture using Redis caching

What we learned

Building FiscalQuant strengthened both our technical and domain knowledge.

On the engineering side, we learned about:

  • High-frequency React state management
  • Server-Sent Events (SSE)
  • Redis caching strategies
  • Mathematical allocation algorithms
  • Performance optimization for interactive applications

On the economics side, we gained a much deeper understanding of fiscal policy, government budgeting, inflation-adjusted comparisons, and the real-world trade-offs behind public spending decisions.


What's next for FiscalQuant

Our next goal is to make FiscalQuant a collaborative civic learning platform.

We plan to integrate Supabase so users can create accounts, save budget simulations, share their fiscal policies, and discuss economic ideas with others.

Long term, we want to expand beyond a single country's budget and support government datasets from around the world, creating an open platform that helps students, educators, journalists, and citizens better understand public finance through interactive simulations and AI-powered insights.

Built With

Share this project:

Updates

Submission history