Inspiration

Every freelancer and small business owner knows the same quiet anxiety: you send an invoice, and then you wait. You have no idea whether this client will pay on time, pay three weeks late, or make you chase them for a month. Globally, $3.1 trillion in B2B invoices are overdue at any given moment, and the people hurt most are the ones who can least afford it — solo freelancers and small teams with no finance department and no system to see trouble coming.

I kept thinking: the data to predict this already exists. Every business has a payment history sitting in its records. Nobody was using it to actually predict risk before it happened. So I built Clariva to turn that history into foresight.

What it does

Clariva is an AI-powered invoice intelligence platform that predicts which invoices will be paid late — before they're overdue.

  • AI invoice extraction — paste raw invoice text and AI fills in the client, amount, dates, and line items automatically
  • Payment risk scoring — every invoice gets a 0–100 risk score computed from the client's real payment history, with a plain-English explanation of why
  • AI reminder emails — one click drafts a professional, personalized follow-up with the invoice number, amount, and days overdue
  • Bulk operations — select multiple overdue invoices and generate unique AI reminders for all of them at once
  • Client risk profiles — reliability score, average days to pay, and an AI assessment with recommended payment terms
  • Business insights — the dashboard reads real payment patterns and gives specific, data-driven recommendations
  • Cash flow analytics — forward-looking projections and breakdowns, all from real SQL aggregations, exportable to CSV

When a client pays, the system records it, updates that client's history, and feeds the result back into future risk predictions. It gets smarter over time.

How we built it

The frontend is Next.js 14, built with Vercel v0 and deployed on Vercel as serverless functions — 11 independent API routes.

The data layer is Amazon Aurora PostgreSQL Serverless v2 in us-east-1. I chose Aurora because invoice data is deeply relational: users have clients, clients have invoices, invoices have payment histories. The risk-scoring engine runs SQL JOINs and aggregations across a deliberate five-table schema (users, clients, invoices, reminders, payment_history) with foreign keys, B-tree indexes, and JSONB columns for line items. Aurora Serverless v2 scales to zero when idle and scales up instantly under load — the exact infrastructure a funded startup would ship on day one.

The AI layer runs on Groq with llama-3.3-70b, powering five distinct features: extraction, risk explanations, reminders, business insights, and client assessments — all grounded in real data from Aurora, not a generic chatbot.

The stack is rounded out with Drizzle ORM for type-safe database access and NextAuth v5 with JWT for authentication.

Challenges we ran into

Getting Aurora to connect cleanly from a serverless environment was the hardest part — wrangling SSL configuration, URL-encoding special characters in the connection string, and configuring public access and security-group rules so Vercel could reach the database. Designing the risk-scoring algorithm to be genuinely useful — not arbitrary — meant carefully weighting payment lateness, outstanding balances, and client history into a single interpretable score. And keeping the v0-generated UI and the hand-built backend in sync, so the front end always reflected real database state, took disciplined wiring.

Accomplishments that we're proud of

A complete, shippable B2B SaaS — built solo — with real database intelligence rather than a thin AI wrapper. The risk scores come from actual SQL over real payment data, the schema is properly normalized with indexes and foreign keys, and every AI feature is grounded in the user's own information. It looks like a funded product and works like one.

What we learned

How to architect a deliberate relational schema for a real-world domain, how to run Aurora Serverless v2 cost-effectively from a serverless frontend, and how to combine a design-first tool like v0 with hand-engineered backend logic to get both polish and depth. Most of all, that the most powerful AI features aren't the flashy ones — they're the ones quietly grounded in real data.

What's next for Clariva

Email integration to send reminders directly, automated recurring invoices, multi-currency support, a mobile app, and a continuously learning risk model that improves as more payment data flows in. The long-term vision: give every freelancer and small business the kind of payment intelligence that today only large enterprises can afford.

Built With

Share this project:

Updates