DEV Community

 Mohamed Rashard Rizmi
Mohamed Rashard Rizmi

Posted on

I built a free MVP cost estimator with Next.js 15 and Gemini API - here's how

If you have ever tried to launch a software product, you know the traditional development agency model is fundamentally broken.

Founders are bleeding their pre-seed runway just trying to get a price quote.

Agencies will drag them through three weeks of pointless "discovery calls" only to hand them a bloated $40,000 estimate and a 4-month timeline for a basic MVP. They will confidently charge $8,000 for "custom authentication architecture" when we all know setting up Supabase Auth takes about four hours.

I got tired of watching non-technical founders get overcharged for things that should take days, not months. So, I decided to automate the entire agency discovery process and build a tool that gives founders the honest numbers in seconds.

What the Tool Does

  • In plain English: A founder types their app idea into a text box. The tool instantly breaks down the technical requirements and shows them the realistic (and usually bloated) traditional agency cost, followed by a lean, fixed-price 72-hour alternative.

  • Technical breakdown: The user’s natural language prompt is sent to the AI. The model acts as a virtual CTO, breaking the idea down into discrete architectural components (Auth, Database, Payments, LLM integrations, etc.). It then maps these features against an internal pricing matrix based on standard agency hourly rates (Project Managers, QA, UI Designers) versus lean execution.

  • The Estimate: The user receives a clear, brutal breakdown—e.g., "$47,000 | 14 weeks | 3 engineers" for the agency route. When they enter their email to unlock the realistic 72-hour alternative price, they instantly receive a full PDF architectural blueprint of their idea.

How I Built It

I built this engine to run 24/7 with near-zero latency.

  • Here is the stack: Next.js 15: The core framework. I leveraged the App Router to build a Programmatic SEO (pSEO) engine with 75+ auto-generated, indexed pages (like "cost to build an Uber clone"). These are pre-rendered and cached via Cloudflare for lightspeed, $0-cost delivery.

  • Gemini 1.5 Flash: The brain of the estimator. I chose Flash because speed is critical here. It analyzes the business logic and calculates the technical components in milliseconds.

  • Supabase: The backend database that securely stores the captured leads, the user inputs, and the generated estimates.

  • Resend: The email engine. The moment a founder enters their email to escape the "agency panic," Resend instantly fires a transactional email delivering their custom PDF blueprint and a Calendly link.

  • The Technical Challenge: Parsing Gemini's JSON Reliably. The most interesting technical challenge wasn't the UI—it was getting the LLM to return strictly formatted data.

When you build a programmatic UI that depends on AI output to render pricing tables and feature lists, you need strict, predictable JSON. If the AI returns malformed data, the entire React frontend breaks. Even with careful prompt engineering, LLMs love to hallucinate markdown blockticks (

json ...

) or inject conversational pleasantries before the actual data object.To solve this,

I implemented a two-layered defense:

  • Native Configuration: I leveraged Gemini's built-in response_mime_type: "application/json" configuration to force the model into data-only mode.

  • Middleware Parsing & Validation: Before the response ever hits the frontend state, a custom regex utility strips out any residual markdown formatting.

The raw object is then passed through a strict Zod schema validation. If the schema fails (e.g., a missing price key), the server seamlessly triggers a fast, hidden retry loop to Gemini.

The result is a 100% stable UI that never crashes on unpredictable AI output.

The Takeaway
Normal developer portfolios are just dead brochures. I wanted to build a self-running tool that provides massive, instant value to founders while undeniably proving my architectural skills.

If you are a developer scoping a project, or a founder who is about to sign a 6-month contract with an agency, run your idea through the engine first. It takes two minutes, and it might save you $40,000.

See what your app idea actually costs to build: 👉 https://www.mohamedrashard.dev/cost-to-build

Top comments (0)