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.

Ahsan Bilal
Principal Software Engineer
On this page
Monolithic billing apps are hard to deploy piece by piece, scale by feature, or split across teams — but users still want one login and one menu. That tension drove the Prime Alley architecture.
The split
Instead of one repo doing everything, we run four deployable services behind a shared shell:
- Accounts — central auth, companies, customers, vendors, invoices, Stripe billing API
- Billings — modern Next.js UI using the BFF pattern to proxy Laravel
- GSM — focused Stripe checkout with Elements for card payments
- AI/ML Gateway — WebSockets and Redis queues for live updates and async jobs
The main app shell handles navigation, layout, and entry point. Users experience one product. Engineers ship each service independently.
Why not rewrite everything?
Accounts already owned login, RBAC, and financial data. Billings needed a modern SPA without CORS pain. GSM needed a lighter checkout surface. The gateway needed to offload long-running work from the core API.
Rewriting into one Next.js monolith would have blocked parallel team work for months. Microservices matched the org structure and deployment cadence.
Integration patterns
- Accounts exposes JSON APIs — single source of truth for auth and billing data
- Billings never calls Laravel from the browser; Next.js proxies server-side
- GSM reads invoices and sessions from Accounts, handles card UI only
- Gateway enqueues jobs and pushes Socket.IO events when work completes
Shared conventions: JWT sessions, company_id scoping on every record, audit logs on admin actions.
Quality and delivery
GitLab CI runs per service. SonarQube tracks code quality. Vitest covers critical paths in the shell and frontends. Each service can fail deploy without taking down the entire platform — if the gateway is down, billing still works; users just lose live progress toasts.
Takeaway
Microservices pay off when boundaries match team ownership and users do not feel the seams. Invest in the shell, shared auth, and consistent company scoping first. Split services second.
See it in production
Products behind this article
Keep reading
All articles →Stripe Checkout in a Microservices Suite — The GSM Pattern
How GSM delivers a focused Next.js payment UI with Stripe Elements, Redis caching, and the Accounts API as the billing source of truth.
Next.js 16 Cache Components in Practice: use cache, cacheTag and updateTag
How we rebuilt this site's CMS-driven pages on Next.js 16 Cache Components — instant static pages, content that updates the moment you hit save, and a database fallback that never breaks the site.
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.