Billings
A fast, modern billing dashboard that talks only to its own server, so cross-domain cookie, CORS and CSRF problems simply disappear.
In plain words
Billings is the screen staff use to manage companies, invoices and payments. Instead of the browser talking straight to the billing server (which often breaks logins), it talks to its own website server, which safely passes requests along. Logins stay reliable and the app feels fast.
Interactive preview
How Billings works
Interactive · illustrative sample data
The challenge
Calling a Laravel API on another domain from a React app means fragile cookies, CORS preflights and CSRF token juggling, with half-logged-in states when sessions expire.
Our approach
Use the backend-for-frontend pattern: the browser only talks to Next.js on the same origin; Next.js proxies to Laravel server-side with the right credentials.
Step by step
From first click to finished job
- 1
Browser calls Next.js
All requests go to the same origin.
- 2
Next.js proxies to Laravel
Server-side, with Sanctum credentials.
- 3
UI updates instantly
React Query caches and refreshes in the background.
Capabilities
What it does
Same-origin BFF
No CORS or CSRF issues in the browser.
Clean session handling
Expired sessions redirect to login, with no half-authenticated states.
Dashboards
Companies, invoices, payments, roles and audit logs.
React Query caching
Snappy UI with cache and background refresh against the BFF.
Engineering
Key decisions
Keep Laravel as the source of truth
No rewrite of a proven API; only the UI layer is modernised.
Architecture
Tech stack
UI
- Next.js
- React
- TypeScript
- Tailwind
Data
- React Query
- Sanctum
- BFF
Outcome
What it delivers
- Reliable logins without cross-domain cookie workarounds
- Modern UI shipped without rewriting the Laravel backend
Deep dives
Read the engineering notes
Next.js BFF Pattern — Fixing Cross-Domain Laravel API Calls
Why we built Billings as a Next.js backend-for-frontend that proxies to Laravel — eliminating CORS, CSRF, and broken session cookies in the browser.
Prime Alley Microservices — One Product, Four Deployable Services
How we split billing, accounts, payments, and live updates into separate services while keeping a single login and navigation shell for end users.
Services behind it