Back to work
Perfect Portal / 2025

A multi-tenant SaaS that earned the word “perfect.”

A multi-tenant SaaS platform with Stripe Connect payouts, AI-assisted document workflow, and end-to-end PDF generation — built so a small team could manage hundreds of agents without losing a payout to spreadsheet error.

Role
Full-Stack Developer + UI/UX
Stack
Next.jsTypeScriptTailwindshadcn/uiPostgresStripe ConnectGoogle GeminiTiptap@react-pdf/rendererVercel BlobResend
Tags
FintechMulti-tenant SaaSPaymentsAI
§ 01 / Context

Context

Perfect Portal needed to replace a tangled spreadsheet system that broke once they grew past a handful of agents. Payouts were manual, document workflows were copy-paste from Word templates, and there was no single source of truth for “what did we pay this person.” Every onboarding round added new failure points.

§ 02 / Approach

Approach

Built the entire platform on Next.js with role-scoped access for admins, agents, and clients — each role only seeing what they needed. Wired up Stripe Connect for direct-to-bank payouts, with a webhook handler that signature-verifies every event before any state change and routes 10 distinct event types — payout.created, payout.paid, payout.failed, transfer.created, transfer.failed, account.updated, checkout.session.completed, invoice.payment_succeeded, invoice.payment_failed, customer.subscription.deleted. Implemented forward-only state transitions on payment status so out-of-order webhook arrivals don’t corrupt the row, plus an events table that idempotently dedupes Stripe’s at-least-once retries. The document side runs on Tiptap with Google Gemini AI assistance for first-draft writing, and final signed documents export to PDF through @react-pdf/renderer. Includes a Firebase-to-Postgres migration path written to bring legacy data forward without downtime.

§ 03 / Outcome

Outcome

Replaced the spreadsheet entirely. Payouts now happen in minutes, not days. Webhook reconciliation handles the edge cases — duplicate events, out-of-order arrivals, retries — without manual intervention. The audit log makes finance reviews trivial.

§ 04 / Metrics

What it does

  • 01Stripe Connect integration handling 10 distinct webhook event types with signature verification and idempotent processing
  • 02Three user roles (admin, agent, client) with role-scoped data access at the application and database layers
  • 03Active in production, managing payouts and agent onboarding day-to-day
§ / Building something similar?

Tell us what you’re working on.

We’re happy to talk through what we learned on this project and whether we’re the right partner for yours.