Initializing
Back to Projects
Year2025
DomainFullstack
AccessPrivate Repo
Complexity8.7 / 10
Video DemoArchitecture DocsScreenshots
TypeScriptNext.js 15NestJSTurborepoPrismaPostgreSQLRedisMeiliSearchMinIOTailwind CSSBullMQJWTDocker
FullstackProduction

Aatmanova Universe — Premium Wellness Platform

A high-performance Turborepo monorepo powering a premium wellness platform with Next.js 15, NestJS, 47 domain modules, dual design languages, and B2B wholesaler portal.

Domain Modules0
Apps in Monorepo0
Design Languages0
VPS Deployments0
Test Suites0
GitHub ActionsCI/CD

Table of Contents


The Challenge

Building a premium wellness e-commerce platform that serves both B2C consumers and B2B wholesale partners presents architectural challenges that generic solutions fail to address:

  • Platform duality: Consumer-facing experience needs immersive, high-fidelity "Spiritual Premium" design while B2B operations require dense, efficient "Professional Utility" interfaces — one codebase couldn't serve both personas effectively
  • Monolithic constraints: The legacy single-repo approach caused deployment coupling — changing the landing page required redeploying the entire system
  • Scale requirements: Supporting thousands of products, real-time inventory, GST-compliant invoicing, and B2B credit management required a domain model that could evolve independently
  • Search performance: Customer-facing product discovery needed sub-100ms search responses across a growing catalog

The requirement: Build a monorepo that can independently deploy 6 separate Next.js applications while sharing a single NestJS core API, with real-time inventory, full GST compliance, and B2B wholesale capabilities — all while maintaining type safety across the entire codebase.


Architecture & Solution

Aatmanova Universe uses a Turborepo npm workspaces monorepo that enables independent deployment of 6 applications while sharing a single NestJS backend and type-safe packages.

Parsing system architecture diagram...

Component Responsibilities

LayerComponentResponsibility
Frontend Apps6 Next.js 15 appsIndependent deployment, shared UI package
Backend CoreNestJS API47 domain modules, business logic
Shared PackageTypeScript typesCross-app type safety, auth utilities
Search EngineMeiliSearchSub-100ms product discovery
Queue SystemBullMQAsync job processing
Object StorageMinIOMedia and file storage
CacheRedisSession, query, rate-limit caching

Tech Stack

LayerTechnologyRole
MonorepoTurborepo + npm workspacesIndependent deployment orchestration
Frontend FrameworkNext.js 15React 19 with App Router
Backend FrameworkNestJS 11Modular API architecture
DatabasePostgreSQL 16Primary data store
ORMPrisma 6Type-safe database access
QueueBullMQ + RedisAsync job processing
SearchMeiliSearchFull-text product search
StorageMinIOS3-compatible object storage
StylingTailwind 4.0Utility-first CSS
AuthenticationJWT + CookiesSession management
ValidationZodRuntime type validation
API DocsSwagger/OpenAPIAPI documentation
TestingPlaywright, JestE2E and unit testing
ContainerDockerDeployment packaging

Monorepo Structure

code
aatmanova-universe/
├── apps/
│   ├── web/Next.js 15 (Consumer Landing)
│   ├── admin/Next.js 15 (Admin Dashboard)
│   ├── wholesaler/Next.js 15 (B2B Partner Portal)
│   ├── profile/Next.js 15 (User Profiles)
│   ├── admin-lite/Next.js 15 (Lite Admin)
│   └── api/NestJS (Core API)
├── packages/
│   └── shared/Universal types, auth, utilities
├── architecture/Business logic documentation
├── infra/Docker & deployment configs
└── scripts/Build & deployment automation

App Port Mapping (Local Development)

AppPortDesign Language
web3000Spiritual Premium
admin3001Professional Utility
wholesaler3002Professional Utility
profile3003Spiritual Premium
admin-lite3004Professional Utility
api4000NestJS

Key Engineering Decisions

1. Turborepo for Independent Deployments

Each app can be deployed independently without affecting others. Landing page changes don't require redeploying the admin panel:

json
// turbo.json
{
  "pipeline": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**", ".next/**"]
    },
    "dev": {
      "cache": false,
      "persistent": true
    },
    "lint": {},
    "test": {}
  }
}

2. Dual Design Language System

Two completely different UI experiences from the same monorepo:

Spiritual Premium (web, profile):

tsx
// Cosmic gradients, glassmorphism, celestial animations
<div className="bg-gradient-to-br from-purple-900 via-indigo-900 to-black">
  <GlassCard>{children}</GlassCard>
</div>

Professional Utility (admin, wholesaler, admin-lite):

tsx
// High-density data grids, Bento layouts, scannable deltas
<div className="grid grid-cols-4 gap-4">
  <BentoCard>{children}</BentoCard>
</div>

3. Edge Middleware for Route Protection

All B2B dashboard routes protected at the edge:

typescript
// apps/wholesaler/middleware.ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
  const token = request.cookies.get('wholesaler_session');
  
  if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {
    return NextResponse.redirect(new URL('/login', request.url));
  }
  
  return NextResponse.next();
}

4. MeiliSearch for Sub-100ms Product Discovery

Real-time search across thousands of products:

typescript
// modules/search/search.service.ts
async function searchProducts(query: string, filters: SearchFilters) {
  const results = await meiliClient.index('products').search(query, {
    filter: filters.category ? `category = "${filters.category}"` : '',
    limit: 20,
    attributesToHighlight: ['name', 'description'],
  });
  
  return results;
}

5. BullMQ for Async Job Processing

Inventory alerts, order processing, and notification dispatch:

typescript
// jobs/inventory-alerts.processor.ts
@Processor('inventory')
export class InventoryAlertsProcessor {
  @Process()
  async handleStockAlert(job: Job) {
    const product = await this.inventoryService.findById(job.data.productId);
    
    if (product.stock <= product.lowStockThreshold) {
      await this.notificationService.sendLowStockAlert(product);
    }
  }
}

47 Domain Modules

The NestJS API contains 47 independently versioned domain modules:

CategoryModules
Coreauth, users, customers, notifications
Commercecatalog, inventory, orders, payments, invoices, shipments
Financeledger, credit-notes, refunds, quotes, reports, challans
B2Bwholesaler, coupons, subscriptions, gift-cards
Contentblog, events, faq, testimonials, reviews
Wellnessservices, bookings, programs, mantra, gita, numerology, pkh
Operationsactivity-log, audit-logs, analytics, automation, community, search, referrals, health

Dual Design Languages

1. Spiritual Premium (Consumer-Facing)

  • Aesthetic: Cosmic gradients, glassmorphism, celestial animations
  • Typography: Outfit (Headings), Plus Jakarta Sans (Body)
  • Persona: Immersive, enlightened, high-fidelity

2. Professional Utility (Operations-Facing)

  • Aesthetic: High-density data grids, scannable Bento layouts
  • Typography: Plus Jakarta Sans / DM Sans
  • Persona: Efficient, precise, action-oriented

B2B Wholesaler Portal

A complete B2B partner management system:

  • Authentication: JWT + HttpOnly cookies with 7-day expiry
  • Partner Dashboard: Real-time credit limit, outstanding balance, available credit
  • Procurement Wizard: Connected to live backend catalog and order engine
  • Self-Service Invoices: Partner invoice list with real-time status mapping
  • Operational Ledger: Credit utilization, balance trends, entry-level analysis
  • Secure Middleware: Edge-protected dashboard routes

Financial Intelligence

GST Compliance (India)

  • GSTR-1 Reporting: B2B, B2CS, and HSN-wise CSV exports
  • Tax Engine: Automatic GST calculation per state
  • Invoice Generation: Proper tax breakdown with HSN codes

Multi-Account Treasury

  • Bank Account Selection: Precise debit account during payment recording
  • Dynamic Treasury API: Real-time liquidity account fetching

Credit Management

  • Credit Limits: Partner-specific credit boundaries
  • Outstanding Tracking: Real-time balance monitoring
  • Credit Notes: Item-level returns and credit issuance

Deployment

Quick Start

bash
# Install dependencies
npm install

# Start local development
./start.sh

# Or manually
cp .env.example .env
docker compose up -d
npm run db:migrate
npm run dev

Infrastructure (Docker Compose)

yaml
services:
  postgres:
    image: postgres:16
    ports:
      - "5434:5432"
  
  redis:
    image: redis:7
    ports:
      - "6380:6379"
  
  meilisearch:
    image: getmeili/meilisearch
    ports:
      - "7701:7700"
  
  minio:
    image: minio/minio
    ports:
      - "9005:9000"

Production VPS Nodes

NodeServices
node-2Primary: Aatmanova Universe, Media Stack

Production Checklist

bash
# Build all apps
npm run build

# Run database migrations
npm run db:migrate

# Deploy to VPS
npm run deploy:vps

# Verify health
curl https://aatmanova.school/health

Roadmap

Phase 1.0 — Core Foundation (Complete)

  • Initial monorepo setup with Turborepo
  • Basic auth and user management

Phase 1.5 — Commerce Foundation (Complete)

  • Product catalog and inventory
  • Basic ordering flow

Phase 1.6 — Monorepo Tectonic Shift (Complete)

  • 3-App Architecture: web, admin, wholesaler
  • Dual Design Language System

Phase 1.7 — Admin Security Perimeter (Complete)

  • Secure login, Edge Middleware, Cookie-based sessions

Phase 1.8 — Wholesaler Portal (Complete)

  • B2B authentication, procurement wizard, real-time invoices

Phase 1.9 — Modernized Financial Transparency (Complete)

  • Self-service invoices, operational ledger, audit trail

Phase 2.0 — Performance Optimization (In Progress)

  • MeiliSearch integration
  • Redis caching layer

Phase 2.1 — Mobile Apps (Planned)

  • React Native companion apps

Phase 3.0 — International Expansion (Future)

  • Multi-currency, multi-language support

Engineering Proof

Real-world validation, system demonstrations, and interface captures of the execution states.

System Demonstration

Video walkthrough detailing core logic, interactions, and system behaviors in action.

System Captures

Architecture Feedback

Spotted a potential optimization or antipattern? Let me know.

Submit a Technical Suggestion