DEV Community

James Sanderson
James Sanderson

Posted on • Originally published at techcirkle.com

Case Study: How We Built AML SoftServe360 — A Production-Ready, Multi-Tenant Compliance SaaS Core

In the world of B2B SaaS, there is a massive difference between a flashy demo dashboard and a true enterprise-grade platform. When you add Anti-Money Laundering (AML) compliance into the mix, that gap widens significantly. Compliance software demands absolute data isolation, ironclad audit trails, and predictable API performance.

When our team at TechCirkle set out to build AML SoftServe360 (an internal product initiative), we weren't just building a feature set. We were engineering a highly secure, multi-tenant foundation capable of scaling into case management, automated alerts, and complex third-party integrations — without compromising data integrity.

Here is the engineering blueprint of how we took this multi-tenant compliance platform from brief to build.


The Tech Stack: Strategic Architecture Over Tech Hype

We needed a stack that allowed for rapid iteration but offered production-grade data guarantees out of the box. Instead of building a heavily fragmented, bespoke backend, we chose a unified pairing: Next.js (App Router) + Supabase (PostgreSQL).

Here is the concrete engineering reasoning behind this choice:

  • PostgreSQL as the System of Record: Row-Level Security (RLS) and strict schema constraints enforce tenant boundaries at the lowest possible layer.
  • Unified Auth & Data: Supabase Auth integrates natively with PostgreSQL database policies, drastically reducing custom glue code and authentication mismatch bugs.
  • Next.js App Router Paradigm: React Server Components (RSC) and explicit route handlers map cleanly to secure server-side data fetching and versioned API endpoints.
  • Operational Predictability: Utilizing Docker multi-stage builds, environment templates, and the Supabase CLI allowed us to maintain dev/QA/production environment parity without complex infrastructure sprawl.

The Engineering Pillars Under the Hood

To ensure the codebase remained clean and maintainable as future engineering teams onboard, we established five strict development pillars:

  1. Server-First Rendering: React Server Components by default, keeping client-side interactive "islands" tightly scoped to keep bundles lean.
  2. Explicit API Versioning: All integration-ready APIs live strictly under /api/v1 with uniform request validation and standardized error payloads.
  3. Lightweight Client State: Utilizing Zustand for transient UI state only where client-side interactivity is explicitly required.
  4. End-to-End Type Safety: Centralized TypeScript interfaces combined with automated database types generated directly from the live Supabase schema.
  5. SQL-First Migrations: Every schema change is versioned via the Supabase CLI, making all data layer updates completely reviewable and reproducible.

The Architectural Challenge: Tenancy Cannot Be "Bolted On" Late

Multi-tenant SaaS platforms almost always fail when tenancy logic is treated as an afterthought.

For an AML platform, the stakes are even higher. The engineering team faced a critical challenge: enforce strict organization-scoped isolation at both the database and API layers, keep system latency low, and ensure no database or tenant identifiers ever leak across tenants in errors, logs, or internal admin tools.

The Solution: A Deep Dive into the Roadmap

[Threat Modeling] ➔ [SQL Migrations & RLS] ➔ [API/v1 Context Validation] ➔ [Lean Frontend] ➔ [Docker Deployment]
Enter fullscreen mode Exit fullscreen mode

Step 1: Discovery & Threat Modeling

We initiated the project by mapping out user journeys, tenant lifecycles, and minimum viable security controls. Our non-negotiable baselines were established: strict organizational isolation, an auditable schema change control process, and explicit API contracts.

Step 2: Schema Design & Database-Level Isolation

We modeled organizations and user memberships directly in PostgreSQL. Instead of relying on the application layer to filter data (which is highly prone to human error), we applied Postgres Row-Level Security (RLS) policies. If a query runs, the database itself ensures a user cannot see data outside their assigned organization context.

Step 3: Hardening the API Surface (/api/v1)

We engineered middleware and API handlers that aggressively validate session states and organization contexts before any domain services are executed. If an organization token is missing or mismatched, the request fails gracefully at the boundary.

Step 4: Building a Lean Frontend Experience

The user interface was constructed using clean Tailwind CSS and shadcn/ui patterns. By relying on server rendering for heavy data fetching, the application remains incredibly fast, secure, and performant.

Step 5: Hardening, QA, and Engineering Handoff

To ensure long-term developer ergonomics, we wrapped the project with automated local database lifecycle scripts, seeded datasets for local testing, and comprehensive runbooks for continuous delivery.


The Outcomes: A Defensible Foundation

By aligning strict engineering practices with a highly focused product brief, the project yielded immediate operational benefits:

  • A Credible SaaS Core: A rock-solid, multi-tenant infrastructure that allows the product team to build out advanced AML features without ever having to re-architect auth or tenancy.
  • Reduced Schema Drift: SQL-first migrations and automatically generated types have effectively eliminated runtime data surprises.
  • Seamless Scalability: Clean domain boundaries and versioned APIs make future background workers, webhooks, and third-party data ingest pipelines easily tractable.

Building Your Next Complex Platform?

Whether you are building a highly regulated compliance platform, a multi-tenant B2B platform, or scaling an enterprise web application, getting the foundational architecture right on day one saves hundreds of engineering hours down the line.

At TechCirkle, we specialize in turning complex software briefs into highly scalable, secure, and production-ready digital products.

Explore our full engineering portfolio at TechCirkle or reach out directly to our application architects on the TechCirkle Contact Page to discuss how we can de-risk your upcoming build.

Top comments (0)