Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Southern Street Premier League (SSPL) - Reorganized Project

A comprehensive React + Node.js application for managing the Southern Street Premier League tournament system.

πŸ—οΈ Project Structure

/var/www/vhosts/ssplt10.cloud/
β”œβ”€β”€ httpdocs/              # Frontend (React/Vite SPA)
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ .env
β”‚   β”œβ”€β”€ .env.preview
β”‚   β”œβ”€β”€ .env.production
β”‚   └── vite.config.ts
β”œβ”€β”€ backend/               # Backend (Node.js/Express)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── app.js
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ .env
β”‚   β”œβ”€β”€ .env.preview
β”‚   β”œβ”€β”€ .env.production
β”‚   └── ecosystem.config.js
β”œβ”€β”€ logs/                  # PM2 and application logs
β”œβ”€β”€ deploy-scripts/        # Deployment automation
β”‚   β”œβ”€β”€ deploy.sh
β”‚   └── sync_env.sh
β”œβ”€β”€ nginx.conf            # Nginx configuration
└── README.md

πŸš€ Quick Start

Local Development

  1. Install dependencies:

    npm run install:all
  2. Start development servers:

    npm run dev:full

    This starts both frontend (port 5173) and backend (port 3001).

Environment-Specific Commands

  • Development: npm run dev
  • Preview: npm run build:preview
  • Production: npm run build:production

🌍 Environments

Development

  • Domain: http://localhost:3001
  • Frontend: http://localhost:5173
  • API: http://localhost:3001/api

Preview

  • Domain: https://preview.ssplt10.cloud
  • API: https://preview.ssplt10.cloud/api

Production

  • Domain: https://www.ssplt10.cloud
  • API: https://www.ssplt10.cloud/api

πŸ“‹ Deployment

Automated Deployment

# Deploy to production
./deploy-scripts/deploy.sh production

# Deploy to preview
./deploy-scripts/deploy.sh preview

# Sync environment files
./deploy-scripts/sync_env.sh production

Manual Deployment Steps

  1. Build frontend:

    cd httpdocs
    npm run build:production
  2. Deploy frontend:

    sudo cp -r httpdocs/dist/* /var/www/vhosts/ssplt10.cloud/httpdocs/
  3. Deploy backend:

    cd backend
    npm ci --production
    pm2 start ecosystem.config.js --env production
    pm2 save
  4. Reload Nginx:

    sudo nginx -t && sudo systemctl reload nginx

πŸ”§ Configuration

Environment Variables

Backend (.env files)

  • NODE_ENV: Environment name
  • PORT: Backend port (3001)
  • RAZORPAY_KEY_ID: Razorpay API key
  • RAZORPAY_KEY_SECRET: Razorpay secret key
  • DOMAIN: Application domain
  • VITE_API_URL: API base URL
  • VITE_SUPABASE_*: Supabase configuration

Frontend (.env files)

  • VITE_API_URL: API endpoint
  • VITE_SUPABASE_*: Supabase configuration
  • VITE_RAZORPAY_KEY_ID: Razorpay public key
  • VITE_APP_NAME: Application name
  • VITE_APP_VERSION: Application version

PM2 Process Management

# Start backend
pm2 start backend/ecosystem.config.js --env production

# View logs
pm2 logs sspl-backend

# Monitor processes
pm2 monit

# Restart
pm2 restart sspl-backend

Nginx Configuration

The nginx.conf file includes:

  • SSL/TLS configuration
  • SPA routing with try_files
  • API proxy to backend
  • Rate limiting
  • Security headers
  • Separate configurations for production and preview

πŸ“Š Monitoring & Logs

PM2 Logs

  • logs/pm2-backend-out.log: Standard output
  • logs/pm2-backend-error.log: Error logs

Nginx Logs

  • /var/log/nginx/ssplt10_access.log: Access logs
  • /var/log/nginx/ssplt10_error.log: Error logs

Health Checks

  • Backend: GET /health
  • PM2: pm2 status
  • Nginx: sudo systemctl status nginx

πŸ”’ Security Features

  • Rate limiting on API endpoints
  • Security headers (CSP, HSTS, etc.)
  • CORS configuration
  • Input validation
  • Environment variable validation

πŸ§ͺ Testing

# Run frontend tests
npm run --workspace=httpdocs test

# Run backend tests
npm run --workspace=backend test

πŸ“ API Documentation

Endpoints

  • POST /api/create-order: Create Razorpay order
  • POST /api/verify-payment: Verify payment
  • GET /api/health: Health check

🀝 Contributing

  1. Create a feature branch
  2. Make changes
  3. Test locally
  4. Deploy to preview environment
  5. Create pull request

πŸ“ž Support

For issues or questions:

  1. Check PM2 logs: pm2 logs sspl-backend
  2. Check Nginx logs: sudo tail -f /var/log/nginx/ssplt10_error.log
  3. Verify environment variables
  4. Test API endpoints with curl

πŸ“‹ Deployment Checklist

  • βœ… Build frontend for target environment
  • βœ… Copy dist/ to httpdocs/
  • βœ… Install backend dependencies
  • βœ… Sync environment variables
  • βœ… Start/restart PM2 process
  • βœ… Verify PM2 logs
  • βœ… Reload Nginx
  • βœ… Test SPA routing
  • βœ… Verify API endpoints
  • βœ… Check environment variables
  • βœ… Monitor logs

πŸ”„ Updates

When updating the application:

  1. Update environment variables if needed
  2. Run deployment script
  3. Verify health checks
  4. Monitor logs for errors
  5. Test critical user flows

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages