Core Stack is a modern full-stack application built with Next.js, featuring type-safe APIs, real-time communication, and background job processing.
┌─────────────────────────────────────────────────────────────────────────┐
│ CLIENT LAYER │
│ Browser (React) + CLI (Commander.js) │
└───────────────────────────┬─────────────────────────────────────────────┘
│
┌────────────┴────────────┐
│ │
tRPC Client WebSocket Client
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────────────────┐
│ NEXT.JS SERVER (port 3000) │
│ ┌─────────────────┐ ┌──────────────┐ ┌────────────────┐ │
│ │ tRPC Routers │ │ Drizzle ORM │ │ Auth Service │ │
│ │ - user.* │ │ - Schema │ │ - JWT │ │
│ │ - post.* │ │ - Queries │ │ - LDAP │ │
│ │ - auth.* │ └──────┬───────┘ └────────────────┘ │
│ │ - project.* │ │ │
│ └─────────────────┘ │ │
│ │ │
│ ┌────────────────────────────┴───────────────────────┐ │
│ │ Queue Manager (BullMQ) │ │
│ │ - default │ - email │ - processing │ │
│ └────────────────────────────┬───────────────────────┘ │
└───────────────────────────────┼─────────────────────────────────────────┘
│
┌───────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌────────────────┐ ┌──────────────────┐
│ PostgreSQL │ │ Redis │ │ WebSocket │
│ (port 5432) │ │ (port 6379) │ │ Server │
│ - users │ │ - Cache │ │ (port 3001) │
│ - posts │ │ - Queues │ └──────────────────┘
│ - projects │ └────────────────┘
└───────────────┘
- Next.js 15 - React framework with App Router and Turbopack
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- tRPC - End-to-end type-safe API client
- tRPC - Type-safe API server
- Drizzle ORM - Type-safe PostgreSQL ORM
- Next.js API Routes - Server-side handlers
- BullMQ - Redis-based task queue
- WebSocket (ws) - Real-time bidirectional communication
- Pino - High-performance structured logging
- Prometheus - Metrics collection and monitoring
- Health Checks - Kubernetes-compatible liveness/readiness probes
- JWT - Token-based authentication
- LDAP - Enterprise directory authentication
- bcrypt - Password hashing
- PostgreSQL - Relational database
- Redis - Cache and queue backend
- Commander.js - Command-line interface
corestack/
├── app/ # Next.js app directory
│ ├── api/ # API routes (tRPC, queue)
│ ├── login/ # Login page
│ ├── projects/ # Projects dashboard
│ └── page.tsx # Home page
├── components/ # React components
├── lib/ # Shared libraries
│ ├── auth/ # Authentication (JWT, LDAP)
│ ├── db/ # Database & schema
│ ├── observability/ # Logging, metrics, health checks
│ ├── trpc/ # tRPC configuration
│ ├── websocket/ # WebSocket client
│ └── queue/ # Queue configuration
├── server/ # Server-side code
│ ├── routers/ # tRPC routers
│ ├── queue/ # Queue workers
│ └── websocket.ts # WebSocket server
├── cli/ # CLI client
├── docs/ # Documentation
└── scripts/ # Utility scripts
Type-safe API endpoints handling business logic:
auth.*- Authentication and authorizationuser.*- User managementpost.*- Post/content managementproject.*- Project management
BullMQ queues for async processing:
default- General purpose jobsemail- Email sending jobsprocessing- Data processing jobs
Real-time communication for:
- Live updates
- Chat/messaging
- Notifications
- Channel-based pub/sub
Production-grade observability features:
Structured Logging
- JSON-based logs in production
- Pretty-printed logs in development
- Context-aware child loggers
- Integrated across all services (tRPC, WebSocket, queues)
Health Checks
/api/health/live- Liveness probe/api/health/ready- Readiness probe (checks database, Redis)/api/health/startup- Startup probe
Prometheus Metrics
/api/metrics- Metrics endpoint- HTTP request rates and latency
- tRPC procedure performance
- WebSocket connection and message metrics
- Queue job processing times
- Database query performance
- System resources (CPU, memory, event loop)
See Observability Documentation for detailed configuration.
For detailed architecture information, see:
- Request Flow - How API calls flow through the system
- WebSocket Flow - Real-time message handling
- Job Processing Flow - Background job execution
- Authentication Flow - Login and token management
- Data Flow - Database queries and caching
✅ Type Safety - End-to-end TypeScript with tRPC ✅ Real-time - WebSocket support for live updates ✅ Async Processing - Background jobs with BullMQ ✅ Authentication - Email/password + LDAP support ✅ Database - Type-safe queries with Drizzle ORM ✅ CLI Client - Command-line access to all features ✅ Observability - Structured logging, health checks, and Prometheus metrics ✅ Production-Ready - Comprehensive monitoring and uptime tracking