Skip to content

TinyActive/nginx-love

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Nginx WAF - Advanced Nginx Management Platform

Comprehensive Nginx management system with ModSecurity WAF, Domain Management, SSL Certificates and Real-time Monitoring.

✨ Key Features

  • πŸ”’ ModSecurity WAF - OWASP Core Rule Set (CRS) + Custom Rules
  • 🌐 Domain Management - Load balancing, upstream monitoring, HTTPS backend support
  • πŸ” SSL Certificate Management - Auto Let's Encrypt + Manual upload
  • πŸ‘₯ Multi-user Management - Role-based access control (Admin/Moderator/Viewer)
  • πŸ“Š Real-time Monitoring - Performance metrics, alerts, system health
  • πŸ›‘οΈ Access Control Lists (ACL) - IP whitelist/blacklist, GeoIP, User-Agent filtering
  • πŸ“‹ Activity Logging - Comprehensive audit trail
  • πŸ”” Smart Alerts - Email/Telegram notifications with custom conditions
  • πŸ’Ύ Database Management - PostgreSQL with Prisma ORM
  • 🎨 Modern UI - React + TypeScript + ShadCN UI + Tailwind CSS

πŸ“‹ Prerequisites

  • Node.js 18+
  • pnpm 8+
  • Docker & Docker Compose

πŸš€ Quick Start

Option 1: Using Scripts (Recommended)

The easiest way to get started:

# Clone repository
git clone https://github.com/TinyActive/nginx-love.git
cd nginx-love

# Run quick start script (sets up everything)
bash scripts/quickstart.sh

This will:

  • Install dependencies
  • Start Docker services (PostgreSQL + API)
  • Run database migrations and seeding
  • Start frontend on http://localhost:5173

Default Credentials:

  • Username: admin
  • Password: admin123

Press Ctrl+C to stop all services


Option 2: Manual Setup

If you prefer manual control:

1. Clone & Install

git clone https://github.com/TinyActive/nginx-love.git
cd nginx-love
pnpm install

2. Setup Environment Files

# Docker Compose (database + API)
cp .env.example .env

# Frontend
cp apps/web/.env.example apps/web/.env

Important: Update .env with secure secrets before deploying to production.

3. Start Services with Docker

# Start database and API in containers
docker-compose up -d

# View logs
docker-compose logs -f api

4. Setup Database (First time only)

# Run migrations inside the API container
docker-compose exec api pnpm prisma:migrate
docker-compose exec api pnpm prisma:seed

5. Run Frontend

# Start frontend (connects to API on http://localhost:3001)
pnpm --filter @nginx-love/web dev    # http://localhost:5173

πŸ“œ Deployment Scripts

All scripts are located in the scripts/ directory and are ready to use.

🎯 quickstart.sh - Quick Testing (Recommended)

Best for: First-time setup, testing, demos

bash scripts/quickstart.sh

What it does:

  • βœ… Installs dependencies (pnpm)
  • βœ… Copies .env files from examples
  • βœ… Starts Docker services (PostgreSQL + API)
  • βœ… Runs database migrations and seeding
  • βœ… Starts frontend on http://localhost:5173
  • βœ… Handles graceful shutdown (Ctrl+C)

Architecture:

  • Database: Docker
  • API: Docker (port 3001)
  • Frontend: Local (port 5173)

πŸ› οΈ start.sh - Local Development

Best for: Development with hot-reload for API and frontend

bash scripts/start.sh

What it does:

  • βœ… Installs dependencies (pnpm)
  • βœ… Copies .env files from examples
  • βœ… Starts PostgreSQL in Docker
  • βœ… Runs API locally with hot-reload (port 3001)
  • βœ… Runs frontend locally with hot-reload (port 5173)
  • βœ… Handles graceful shutdown (Ctrl+C)

Architecture:

  • Database: Docker
  • API: Local (port 3001)
  • Frontend: Local (port 5173)

πŸš€ deploy.sh - Production Deployment

Best for: Production servers with Nginx + ModSecurity

sudo bash scripts/deploy.sh

What it does:

  1. βœ… Installs prerequisites (Node.js, pnpm, Docker, Docker Compose)
  2. βœ… Builds and starts Docker services (PostgreSQL + API)
  3. βœ… Runs database migrations and seeding
  4. βœ… Installs Nginx + ModSecurity WAF
  5. βœ… Builds and deploys frontend
  6. βœ… Configures systemd services
  7. βœ… Saves credentials to /root/.nginx-love-credentials

After deployment:

  • Frontend: http://YOUR_IP:8080
  • Backend API: http://YOUR_IP:3001

Manage services:

# Docker services
docker-compose up -d           # Start all
docker-compose down            # Stop all
docker-compose logs -f api     # View API logs

# Frontend (systemd)
systemctl restart nginx-love-frontend

# Nginx
systemctl restart nginx

Architecture:

  • Database: Docker
  • API: Docker (port 3001)
  • Frontend: Systemd service (port 8080)
  • Nginx: Reverse proxy + ModSecurity WAF

πŸ“Š Script Comparison

Script Database API Frontend Root Use Case
quickstart.sh Docker Docker Local ❌ Quick testing
start.sh Docker Local Local ❌ Development
deploy.sh Docker Docker Systemd βœ… Production

πŸ› οΈ Manual Commands

For advanced users who want manual control:

# Development
pnpm dev          # Start all apps locally
pnpm build        # Build all apps
pnpm lint         # Lint all apps

# Database (from apps/api/)
pnpm prisma:generate  # Generate Prisma client
pnpm prisma:migrate   # Run migrations
pnpm prisma:seed      # Seed database
pnpm prisma:studio    # Open Prisma Studio

# Docker
docker-compose up -d           # Start database + API
docker-compose up -d db        # Start only database
docker-compose logs -f api     # View API logs
docker-compose exec api pnpm prisma:migrate  # Run migrations
docker-compose down            # Stop all services

πŸ“ Project Structure

nginx-love/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/          # Vite + React frontend
β”‚   └── api/          # Express + Prisma backend
β”œβ”€β”€ docs/             # Documentation
β”œβ”€β”€ scripts/          # Deployment scripts
└── config/           # Configuration files

πŸ“š Documentation

πŸ”— Links

πŸ“„ License

Apache 2.0 License. See LICENSE for details.

πŸ‘₯ Support & Community

Getting Help

Security Issues

For security vulnerabilities, please email: security@tinyactive.net

Acknowledgments


πŸ”₯ Made with ❀️ by TinyActive Team

⭐ Star this repository if it helped you!