Modern SaaS and cloud platforms rarely consist of a single application. Instead, they are built as multiple independently deployed systems:
- A public frontend (customer-facing)
- An admin panel (internal or privileged users)
- A backend API (business logic, auth, data, integrations)
Each deployment serves a different audience, runs in different environments, and fails in different ways. Because of this, testing must also be layered, separated, and deployment-aware.
Using Next.js for the frontend & admin panel and NestJS for the backend, this article explains how to design a production-grade testing strategy across these three deployments.
1. Why Multi-Deployment Testing Matters
In real SaaS systems like the ones you build (admin dashboards, APIs, subscription platforms, bots, etc.), a failure in one deployment does not always break the others.
For example:
| System What can break | |
| Frontend | UI crashes, wrong API calls, auth redirect loops |
| Admin Panel | RBAC bugs, wrong data edits, payment changes |
| Backend | Auth failures, webhook errors, database corruption |
If you only test the backend, you miss UI logic.
If you only test the frontend, you miss API contracts.
If you only test end-to-end, you won’t know which deployment failed.
So testing must be deployment-aware.
2. Deployment Architecture (Next + Nest)
A typical production setup looks like this:
These are three independently deployed systems:
- Frontend (Vercel / CDN)
- Admin Panel (Vercel / private domain)
- Backend (Node server / container / cloud)
Each needs its own test layer.
3. Backend Testing (NestJS)
The backend is the source of truth. If it breaks, everything breaks.
NestJS is perfect for structured testing because it supports unit, integration, and e2e tests.
3.1 What to Test in NestJS
| Layer What you test | |
| Services | Business logic (subscriptions, users, signals, billing) |
| Controllers | HTTP requests & responses |
| Guards | JWT auth, RBAC |
| Webhooks | Stripe, Paystack, Telegram, etc |
| Database | MongoDB queries |
3.2 NestJS Unit Tests
Example (AuthService):
These run without HTTP, fast and isolated.
3.3 NestJS API (Integration) Tests
You spin up NestJS in memory:
This validates:
- Routes
- Guards
- DTOs
- Database calls
This ensures the API contract is real.
4. Frontend Testing (Next.js – Public App)
The public frontend is what customers see.
Its job is not business logic, but:
- Rendering
- Routing
- API calls
- Auth flow
4.1 What to Test in the Frontend
| AreaWhat to test | |
| Pages | Login, signup, dashboard |
| API Calls | Correct endpoints, error handling |
| Routing | Redirects when logged in/out |
| Forms | Validation, submission |
| UI State | Loading, errors, success |
4.2 Unit Tests (React + Jest)
Example:
This checks components don’t crash.
4.3 Integration Tests (Mock API)
Using MSW (Mock Service Worker):
This ensures:
- Your UI correctly handles backend responses
- You don’t break the API contract
5. Admin Panel Testing (Next.js – Privileged App)
The admin panel is the most dangerous deployment because it can:
- Delete users
- Change billing
- Send signals
- Revoke access
So it needs extra testing.
5.1 What to Test in Admin Panels
| FeatureWhy it matters | |
| RBAC | Admin vs Super Admin |
| API permissions | Who can do what |
| Data mutation | Editing users, plans, signals |
| Audit logs | Tracking changes |
5.2 Role-Based UI Testing
Example:
This prevents privilege escalation bugs.
6. End-to-End (Cross-Deployment) Testing
This is where all deployments are tested together.
Using Playwright or Cypress:
Example:
- Create user from frontend
- Approve user from admin panel
- Login again from frontend
This detects:
- Broken auth flows
- API mismatches
- Deployment issues
7. Environment-Based Testing
In real SaaS, you will have:
| EnvironmentPurpose | |
| Local | Dev tests |
| Staging | Pre-production |
| Production | Live monitoring |
Each deployment (Frontend, Admin, Backend) must point to the same environment.
A staging test should never hit production data.
8. Why This Matters for Cloud & SaaS Engineering
In companies like Stripe, Microsoft, or SaaS startups, most outages are not from code — they are from bad deployments.
Examples:
- Frontend deployed, backend not
- Admin panel calling wrong API version
- Auth cookie not matching backend config
Multi-deployment testing prevents this.
Final Thought
When you run a system built on Next.js + NestJS, you are not testing “an app”.
You are testing:
- A public product
- A control system
- A cloud API
Treating frontend, admin panel, and backend as separate testable deployments is what separates hobby projects from enterprise SaaS systems, and it’s exactly how professional cloud engineers build reliable platforms.