mirror of
https://github.com/KLogicHQ/nats-console.git
synced 2026-10-06 13:12:09 +00:00
d4a47e1b30ef29d47a51d95232be6ca0907ac112
NATS JetStream Console
A modern, enterprise-grade web console for managing NATS JetStream clusters. Built with Next.js, Node.js, and TypeScript, featuring real-time monitoring and a developer-friendly experience.
Features
- Multi-cluster Management - Connect and manage multiple NATS JetStream clusters
- Stream Management - Create, configure, and monitor streams with message browser
- Consumer Management - Manage consumers with real-time lag visualization
- Real-time Metrics - Live dashboards with ClickHouse-backed analytics
- Alerting - Configurable alerts for lag, throughput, and errors
- Team Collaboration - Multi-tenant with organizations and teams
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | Next.js 15, React 19, TypeScript, TailwindCSS, shadcn/ui, ECharts, TanStack Table |
| Backend | Fastify, Prisma ORM, PostgreSQL |
| Metrics | ClickHouse (time-series), Redis (cache/sessions) |
| Messaging | NATS JetStream |
Quick Start (Local Development)
Prerequisites
- Node.js 20+
- pnpm 9+
- Docker & Docker Compose
Step-by-Step Setup
- Clone the repository
git clone https://github.com/your-org/nats-console.git
cd nats-console
- Install dependencies
pnpm install
- Start infrastructure services
# Start PostgreSQL, Redis, ClickHouse, and NATS
make db-up
# Or using docker-compose directly
docker-compose up -d
- Setup environment variables
# API
cp apps/api/.env.example apps/api/.env
# Web
cp apps/web/.env.example apps/web/.env
# Workers
cp apps/workers/.env.example apps/workers/.env
- Initialize the database
# Generate Prisma client
make prisma-generate
# Run migrations
make prisma-migrate
- Start development servers
# Start all services (API, Web, Workers)
make dev
- Access the application
| Service | URL |
|---|---|
| Web Dashboard | http://localhost:3000 |
| API | http://localhost:3001 |
| NATS Monitoring | http://localhost:8222 |
| Prisma Studio | Run make prisma-studio |
One-Command Setup
make setup && make dev
Makefile Commands
Development
make dev # Start all services in dev mode
make api-dev # Start API only
make web-dev # Start Web only
make workers-dev # Start Workers only
Database Operations
make db-up # Start database containers
make db-down # Stop database containers
make db-shell-postgres # PostgreSQL shell
make db-shell-redis # Redis CLI
make db-shell-clickhouse # ClickHouse client
make db-shell-nats # NATS CLI
Prisma
make prisma-generate # Generate Prisma client
make prisma-migrate # Run migrations
make prisma-studio # Open Prisma Studio
make prisma-reset # Reset database
Build & Production
make build # Build all packages
make start # Start in production mode
make health # Check health of all services
Production Deployment
Using Docker Compose
- Build the images
docker-compose -f docker-compose.prod.yml build
- Create environment file
cp .env.prod.example .env.prod
# Edit .env.prod with production values
- Start services
docker-compose -f docker-compose.prod.yml up -d
- Run migrations
docker-compose -f docker-compose.prod.yml exec api pnpm prisma migrate deploy
Environment Variables (Production)
# Required
DATABASE_URL=postgresql://user:pass@host:5432/nats_console
REDIS_URL=redis://host:6379
CLICKHOUSE_URL=http://host:8123
JWT_SECRET=your-secure-jwt-secret
# Optional
NATS_URL=nats://host:4222
LOG_LEVEL=info
Testing with Example Apps
The examples/ directory contains sample NATS applications:
cd examples
# Install dependencies
pnpm install
# Run message producer
pnpm run producer
# Run message consumer
pnpm run consumer
# Run high-volume load test
pnpm run load-test
Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/my-feature - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature/my-feature - Open a Pull Request
License
MIT License - see LICENSE for details.
Description
Languages
TypeScript
95.8%
Dockerfile
1.8%
Shell
1%
Makefile
0.8%
JavaScript
0.4%
Other
0.2%