MetaSSR is an opinionated template for building AI-ready, multi-tenant, server-side rendered web applications with Next.js.
MetaSSR empowers developers to create augmented intelligence systems and agentic workflows by seamlessly integrating single or multimodal ML models into production-ready SSR apps β all with strict type safety, declarative patterns, comprehensive testing, and multi-tenant authorisation baked in.
Streamlined three-tier roles (OWNER/EDITOR/VIEWER) enable zero-friction onboarding (auto-OWNER status for creators), instant team collaboration with role-based permissions, and predictable access control β covering 90% of SaaS use cases without complexity.
Deploy ML models (LLMs, vision, speech, etc.) as API endpoints with type-safe, declarative schemas β no boilerplate!
Combine deterministic SSR logic with dynamic streaming AI agents in a unified Next.js framework.
Process text, images, and structured data in cohesive workflows (e.g., RAG pipelines with real-time UI updates).
Built-in support for mocking services and containerised testing.
-
Agentic Workflows: Chatbots with memory, autonomous research agents
-
Augmented Interfaces: Real-time document analysis + SSR rendering
-
Multimodal Pipelines: Vision + text models with unified API contracts
-
Modular Monolith Architecture - Well-organised codebase with clear separation of concerns
-
Type-Safe Development - Full TypeScript support end-to-end
-
Multi-Tenant Data Model and Auth - Role-based permissions, automatic tenant data isolation (zero-trust defaults), JWT-powered context, and π§ full audit logs
-
Declarative Patterns - Structured declarations over imperative code
-
Self-Documenting Code - Emphasis on semantic, declarative patterns
-
Testing Pyramid - Robust test coverage (Unit β Integration β E2E)
-
BDD-Oriented - Behaviour-Driven Development with
*.spec.tsfocus -
Zero-Config Instrumentation - Built-in tracing to capture response latency; AI prompts and token usage, etc.
-
π§ Agentic Workflow Engine - Build scalable, autonomous AI processes using built-in state management, asynchronous queue processing, and real-time event signaling for seamless multi-step orchestration.
-
Cost Controls - Automatic rate limiting and spend tracking per model
-
Fallback Strategies - Configurable failover for unreliable model APIs
-
-
π§ SSR + Streaming AI - Serve static shells while streaming model responses
-
π§ Deterministic Caching - Versioned outputs for reproducible AI results
-
π§ Benchmarking Suite - Compare model performance across deployments
- Frontend: Next.js 13+ (App Router)
- Relational DB: PostgreSQL (Prisma ORM)
- NoSQL DB: MongoDB (Model abstraction)
- API: Declarative schema-validated endpoints
| Test Type | Location |
|---|---|
| Unit | tests/unit/frontend, tests/unit/backend |
| Integration | tests/integration/frontend+api, tests/integration/api+db |
| E2E | tests/e2e |
We follow the Testing Pyramid approach with Behaviour-Driven Development (BDD) principles:
E2E (critical paths; few tests)
/ \
Integration \
/ \
Unit Tests (foundation; many tests)
βΆ Full Testing Documentation
- Node.js 18+
- Docker
- PostgreSQL & MongoDB (or use provided Docker setup)
-
Environment Configuration
cp .env.example .env # Edit .env with your configuration -
Launch Infrastructure
cd infra docker-compose up -d -
Database Initialisation
# One-time setup cd infra/scripts ./execute.sh 00-initialise-db.sql # Apply Prisma migrations (always run after schema changes) npm run resync-db # Create server user (always run after Prisma migrations) ./execute.sh 01-create-user-for-server.sql
-
Development Server
npm run dev
Open http://localhost:3000 in your browser.
| Command | Description |
|---|---|
test:unit:frontend |
Run unit tests for frontend components |
test:unit:backend |
Run unit tests for backend modules |
npm test:integration:frontend+api |
Run integration tests to test interaction of frontend components with API server |
npm test:integration:api+db |
Run integration tests to test interaction of API server with other backend services such as databases |
npm test:e2e |
Run end-to-end tests |
Contributions are welcome!
Please open an issue or PR for any improvements.
Help us build the future of AI-powered SSR: