The Underdog: From $200K in Debt to $1M App Maker
Prompt 0 — One-time setup (Cursor rules + guardrails)
You are my senior full-stack engineer pair-programmer.
Goal: build a “Lawn Route Planner” web app for solo lawn-mowing businesses:
Store clients + addresses
Create recurring jobs (weekly/fortnightly) and one-off jobs
Auto-generate a daily route (optimize order) and show it on a map
Let me drag-drop reorder stops and save
Export the route to Google Maps / Apple Maps
Basic analytics (jobs completed, revenue estimates)
Hard requirements:
Write production-quality code, not pseudocode.
After every change: list files changed + how to run locally.
Prefer small, incremental commits. If something is ambiguous, choose a reasonable default and proceed.
Keep it simple: MVP first, then polish.
Ask me questions only if you are fully blocked; otherwise decide and move forward.
Tech stack (use this unless impossible):
Next.js (App Router) + TypeScript
Tailwind + shadcn/ui
Prisma + Postgres
Auth.js (or Clerk if easier)
Map: Mapbox GL JS (or Google Maps if you must)
Route optimization: start with a simple heuristic (nearest neighbor), later upgrade.
Deployment target: Vercel
Now generate:
a concise PRD
user stories
a data model sketch
a milestone plan (MVP -> v1)
Then stop.
Step 1 — Scaffold the repo
Based on the PRD, scaffold the project.
Do:
Create a Next.js App Router project structure
Configure Tailwind + shadcn/ui
Add Prisma + Postgres config
Add Auth (Auth.js). Provide local dev auth setup.
Add env example file and a README with setup steps
Deliverables:
A working app that loads the homepage.
A /login route and protected /app route (even if basic).
Prisma schema + initial migration.
Output:
Commands to run
Files created/changed
Any required env vars
Step 2 — Data model (clients, jobs, schedules, runs)
Implement the core data model with Prisma and migrations.
Entities:
User
Client (name, phone, notes)
Address (street, city, postcode, lat, lng)
Job (clientId, addressId, priceEstimate, durationMins, notes)
RecurrenceRule (jobId, frequency: WEEKLY|FORTNIGHTLY, dayOfWeek, startDate, active)
JobInstance (jobId, scheduledDate, status: PLANNED|DONE|SKIPPED, actualPrice?, actualDuration?, completedAt?)
RoutePlan (date, userId, status)
RouteStop (routePlanId, jobInstanceId, orderIndex, plannedArrivalTime?)
Also:
Indexes for userId/date lookups
Basic seed script with sample data
Then generate:
Prisma schema
Migrations
A simple “DB browser” admin page at /app/admin showing tables counts (clients/jobs/jobInstances)
Step 3 — CRUD UI for clients + jobs (MVP backbone)
Build the MVP CRUD screens.
Routes (all protected under /app):
/app/clients: list + search
/app/clients/new: create client + address
/app/clients/[id]: client detail (edit), list jobs for that client, add job
/app/jobs: list jobs, filter by active recurrence
UI:
Use shadcn/ui components (Table, Dialog, Form, Input, Button)
Use React Hook Form + zod for validation
Backend:
Use Next.js server actions for create/update/delete
Include loading/error states
Deliver:
Fully working CRUD for Client, Address, Job, RecurrenceRule.
Keep styling clean and consistent.
Step 4 — Generate job instances (the “week 1 / week 2” problem)
Implement a scheduler that expands recurrence rules into JobInstances.
Requirements:
A function that, given a date range (e.g., next 30 days), ensures JobInstances exist for each active recurring job.
Idempotent (running multiple times doesn’t duplicate).
Runs:
On demand from a button “Generate schedule for next 30 days”
Automatically when a recurrence rule is created/updated (generate ahead)
UI:
/app/schedule: calendar-like list grouped by date
Each day shows planned jobs (JobInstances), status toggles (Done/Skipped), and a “Plan Route” button.
Data rules:
Weekly: create on specified dayOfWeek
Fortnightly: alternate weeks starting from startDate
Deliver:
Server action(s) for generation
A clear explanation of recurrence logic
Tests for the date logic (unit tests)
Step 5 — Geocoding addresses (lat/lng) + map preview
Add geocoding for addresses and a map preview.
Approach:
Use Mapbox Geocoding API (preferred). Store lat/lng on Address.
Add a “Geocode address” button on address edit if lat/lng missing.
Automatically attempt geocoding on address creation; if it fails, allow manual.
UI:
Client detail page shows a small map preview pin.
/app/map: shows all clients as pins with clustering.
Deliver:
Secure server-side geocoding calls (env vars).
Rate-limit the geocode action per user.
Clear errors if geocode fails.
Step 6 — Route planning (daily optimized order)
Build daily route planning.
Goal:
Given a selected date, create a RoutePlan with ordered RouteStops for all PLANNED JobInstances that day.
MVP algorithm:
Start from a “home base” address set in user settings (lat/lng).
Use nearest-neighbor heuristic to order stops.
Persist the order in RouteStops(orderIndex).
UI:
/app/schedule/[date]: “Plan Route” creates/updates RoutePlan
Show the stop list with drag-and-drop reordering
Show total distance/time estimate (rough)
Implementation details:
Use Mapbox Directions Matrix or Directions API if available. If not, approximate distance by haversine for MVP.
If a stop lacks lat/lng, block and prompt to geocode.
Deliver:
RoutePlan creation
Reorder + save
Distance estimate
Step 7 — Map route visualization + turn-by-turn export
Add the route map visualization and export.
UI:
On /app/schedule/[date], show:
A map with route polyline and numbered stops
Stop cards with client name + address + job notes
Buttons:
“Open in Google Maps”
“Open in Apple Maps”
“Copy share link”
Export rules:
Build the external maps URL with origin=homeBase, destination=lastStop, waypoints=others.
If too many waypoints for a single URL, split into multiple legs and show multiple links.
Deliver:
Mapbox GL rendering with polyline
Export links
Good mobile layout (this will be used in the field)
Step 8 — “Day workflow”: mark done, notes, receipts, simple analytics
Implement the daily workflow features.
Per stop:
Mark DONE
Record actual price + duration
Add completion notes + optional photo upload (store in S3-compatible storage or Vercel Blob)
Dashboard:
/app/dashboard:
Jobs completed (7d/30d)
Estimated vs actual revenue
Time spent
Deliver:
Storage integration for photos
Basic analytics queries (Prisma)
Clean UI cards (shadcn/ui)
Step 9 — Payments (optional v1): paywall + onboarding
Add an optional subscription paywall (v1).
Use Stripe.
Plans:
Free: up to 15 clients
Pro: unlimited + route map + export
Requirements:
Gating logic on server side
Billing page
Upgrade CTA in-app when user hits limits
Deliver:
Stripe checkout + webhook handling
Feature flags/limits enforced
Step 10 — Polish + shipping checklist
Prepare for deployment and harden the app.
Do:
Add Playwright smoke tests (login, create client, create recurring job, generate schedule)
Add error monitoring (Sentry optional)
Add basic rate limiting
Audit env vars + secrets
Add DB indexes + performance pass
Deliver:
Vercel deployment steps
“Release checklist” in README
A short list of next improvements