Manish Gaud

— CASE STUDY / ENTERPRISE SAAS

A multi-tenant HR & payroll platform, built for European SMBs.

Employrax is the HR and payroll SaaS I'm building as founder. Three working portals — owner, admin, employee — with full onboarding, payroll generation, leave management, and Form 16 compliance. Designed to scale from SMB to enterprise without architectural rewrites.

Founder & lead architect · 2024–present · Live on staging

View live demo →

— Section B

Context

Most HR and payroll products fail one of two ways. They start as cheap monoliths that break when a customer crosses a few hundred employees, or they over-engineer with microservices nobody needs. Both kinds end in expensive rewrites.

I designed Employrax as a disciplined modular monolith with explicit domain boundaries — fast to build, easy to operate, and ready to extract services later if any domain demands it. The product is India-first by design: TDS, PF, ESI, Professional Tax, and Form 16 generation are first-class capabilities, not bolted-on afterthoughts. The architecture is built so other geographies can plug in without touching shared code.

It runs as a real multi-tenant SaaS — three portals (platform owner, company admin, employee self-service), tenant-isolated data, RBAC down to individual permissions, audit logging across every sensitive action.

Most HR platforms either over-engineer or under-think. Employrax was an exercise in doing neither.

— Section C

My role

I’m the founder, sole architect, and lead engineer. I designed every module, wrote the technical specifications, made every architectural decision, and used modern AI coding tools — Cursor, Claude — under my direction to accelerate implementation. The architecture, the data model, the rollout sequence, the trade-off decisions: all mine. Every line that ships, I review and own.

— Section D

The hard parts

Five architectural decisions worth surfacing. Each one is the kind of choice people regret not making earlier.

D1

Compensation snapshotting

The naive approach to salary structures is to store a reference: “employee X is on salary structure Y.” Then when payroll runs, you resolve the components live. This breaks the first time someone updates the structure mid-year — historical payroll silently changes.

Instead, when a salary structure is assigned to an employee, Employrax resolves every component value and writes them into an immutable snapshot table (employee_salary_components). Future structure edits don’t touch historical assignments. Payroll for April 2024 still computes the way April 2024 was promised — even if the underlying structure has been revised three times since. This is the kind of decision people regret not making on month eighteen.

D2

Modular monolith over microservices

Microservices solve organizational scaling problems, not technical ones, and Employrax is built by one person right now. Picking microservices on day one would have been LinkedIn-driven architecture — bad operationally, bad financially, and slow to ship.

Instead I designed a modular monolith with strict domain boundaries: nine modules (Platform, Auth, Tenant, Organization, Employee, Compensation, Payroll, Notification, Audit), each with its own actions, services, queries, policies, and HTTP layer. Cross-module shortcuts are forbidden by convention. The result: I get fast local development and one deploy target today, and if any domain becomes genuinely heavy in the future — payroll processing is the obvious candidate — it can be extracted without rewriting the rest of the system.

D3

India-first payroll engine with pluggable country contracts

Payroll engines that hardcode country logic become unmaintainable. Payroll engines that try to be “country-agnostic” from day one ship nothing. The middle path: a TaxEngineInterface contract, an IndiaTaxEngine concrete implementation, and dedicated calculators for each statutory rule (PF, ESI, Professional Tax, TDS).

Country-specific logic stays isolated in Engines/India/. When the time comes to add a second geography, the work is well-bounded — a new engine implementation, not a system-wide refactor. Form 16 generation, India’s annual tax certificate, lives in the same isolated module.

D4

Tenant-aware base models

Multi-tenant SaaS has one truly dangerous bug class: a query that forgets to filter by tenant and silently leaks one customer’s data to another. The defence is structural, not careful: a TenantAwareModel base class that automatically applies a TenantScope to every query, and a TenantContext resolved by middleware before any business code runs.

This means a junior developer (or an AI agent) cannot accidentally write a cross-tenant leak without first explicitly bypassing the safety. The few global tables that genuinely need to be tenant-free extend BaseModel instead. The default is safe; the dangerous path requires intent.

D5

Phased migration order as architecture

A multi-tenant SaaS data model has dependencies that map directly onto its onboarding flow. Get the migration order wrong and you ship a system that can’t actually bootstrap a real customer. The migrations are deliberately ordered into six phases — platform identity, tenant and organization, employee foundation, compensation foundation, payroll foundation, audit and platform control — totalling 35+ tables in a strict sequence.

This isn’t bookkeeping; it’s a forcing function. It guarantees that the database model can be built up incrementally on a fresh environment, that fixtures and seeders work, and that disaster recovery has a defined replay order. It’s documentation that the database itself enforces.

— Section E

Architecture

ONBOARDING Company Signup public registration form Superadmin Review approve � reject � request info Tenant Provisioned DB schema � admin invited OPERATIONS Employees Added compensation snapshot locked India Payroll Engine TDS � PF � ESI � Pro Tax Payslip + Form 16 tax-compliant output
How a company moves from signup to live payroll.
  • Platform

  • Auth

  • Tenant

  • Organization

  • Employee

  • Compensation

  • Payroll

    first candidate for extraction

  • Notification

  • Audit

Nine domain modules with strict boundaries, ready for selective service extraction.

— Section F

Stack

Backend
Laravel (PHP 8.3) · PostgreSQL · Redis · Laravel Sanctum · Horizon
Frontend
React · TypeScript · Vite · TanStack Query · Zustand · React Hook Form · Tailwind CSS
Infrastructure
AWS · Docker · Terraform · GitHub Actions · S3-compatible storage (MinIO local / S3 production)

— Section G

What shipped

Live on staging.emplyrax.com. A full feature walkthrough takes about an hour.

  • — Three working portals: Platform Owner, Company Admin, Employee Self-Service.
  • — Complete onboarding flow: public company signup → superadmin approval → tenant provisioning → admin invitation → first login.
  • — Employee lifecycle: creation, departments, designations, documents, bank details, job history.
  • — Compensation: pay components, salary structures, employee assignment with immutable snapshotting.
  • — Payroll processing with India statutory engine: TDS, PF, ESI, Professional Tax — produces actual payslips.
  • — Leave management end-to-end.
  • — Form 16 generation for tax filing compliance.
  • — Multi-tenant data isolation, RBAC, audit logging, API-first across the whole surface.

Not yet shipped: production hosting at scale (currently on shared Lightsail for staging), formal load testing, the attendance module, the mobile app. The architecture supports all of these — they’re sequencing decisions, not unsolved problems.

Building something with this shape — multi-tenant SaaS, regulated workflows, sensitive financial data, real production discipline?

Let’s talk.

Book a call →