Server Project Organization Guide
Server Project Organization Guide
Section titled “Server Project Organization Guide”Server: production-server-01 (Hetzner) Last Updated: 2026-04-11
Overview
Section titled “Overview”This guide explains the directory organization patterns used on our production server, helping you understand where projects are located and how they’re deployed.
Directory Organization Patterns
Section titled “Directory Organization Patterns”Our server uses two main directories for hosting applications, each serving different deployment types:
/var/www/ - Traditional Web Applications
Section titled “/var/www/ - Traditional Web Applications”Purpose: Direct deployment applications running on the host system
Characteristics:
- Applications run as systemd services or PM2 processes
- Dependencies installed directly on the host
- Share host system resources (PostgreSQL, Redis, Node.js, Python)
- Managed via systemd or process managers
Examples:
- KopanoWorks - Construction project management (pnpm monorepo)
- ProspectIQ - Lead enrichment platform (FastAPI + Celery)
- ThriveSend - Email marketing platform (Node.js)
- SANSA - Space education platform (Frontend + Backend)
/opt/ - Containerized Applications
Section titled “/opt/ - Containerized Applications”Purpose: Self-contained Docker-based applications
Characteristics:
- Applications run in Docker containers via Docker Compose
- All dependencies bundled inside containers
- Isolated environments with their own databases, web servers, etc.
- Managed via
docker composecommands
Examples:
- Polelo DMS - Document management system (Laravel + Docker)
- AutoSlip - Automated slip system
- Buka - Containerized application
Why This Separation?
Section titled “Why This Separation?”This organization follows Linux best practices:
| Directory | Purpose | Standard Usage |
|---|---|---|
/var/www/ | Variable data for web services | Web content, applications served by web servers |
/opt/ | Optional/add-on software packages | Self-contained third-party or containerized applications |
Benefits:
- ✅ Clear separation between deployment types
- ✅ Easy to understand how each project is managed
- ✅ Prevents confusion during maintenance and troubleshooting
- ✅ Follows industry-standard conventions
Complete Project Inventory
Section titled “Complete Project Inventory”/var/www/ Projects (Direct Deployment)
Section titled “/var/www/ Projects (Direct Deployment)”| Project | Location | Type | Port(s) | Domain |
|---|---|---|---|---|
| KopanoWorks | /var/www/kopanoworks/ | pnpm monorepo (Express + Next.js + React Native) | Various | kopanoworks.isutech.co.za, admin.kopanoworks.isutech.co.za |
| ProspectIQ | /var/www/prospect-iq/ | FastAPI + Celery | 8002, 3002 | prospectiq.isutech.co.za |
| ThriveSend | /var/www/thrivesend/ | Node.js | Various | thrivesend.isutech.co.za |
| SANSA Frontend | /var/www/sansa-frontend/ | Next.js | 3003 | sansa.isutech.co.za |
| SANSA Backend | /var/www/sansa-backend/ | Node.js + Express | 8003 | sansa.isutech.co.za/api |
| AssessFlow | /var/www/assess-flow/ | Web application | Various | assess-flow.isutech.co.za |
| ConformEdge | /var/www/conformedge/ | Web application | Various | conformedge.isutech.co.za |
| DealVault | /var/www/dealvault/ | Web application | Various | dealvault.isutech.co.za |
| PropertyData Engine | /var/www/propertydata-engine/ | Data processing engine | Various | propertydata-engine.isutech.co.za |
| Tumi Frontend | /var/www/tumi-frontend/ | Frontend application | Various | tumi.isutech.co.za |
| Tumi Backend | /var/www/tumi-backend/ | Backend API | Various | tumi.isutech.co.za/api |
| BuildQ | /var/www/buildq/ | Construction platform | Various | buildq.isutech.co.za |
| Umdoni | /var/www/umdoni/ | Municipal website | Various | umdoni.gov.za |
| DocsHub | /var/www/docs/ | MkDocs documentation site | 5001 (API) | docs.isutech.co.za |
/opt/ Projects (Containerized)
Section titled “/opt/ Projects (Containerized)”| Project | Location | Type | Docker Ports | Domain |
|---|---|---|---|---|
| Polelo DMS | /opt/polelo-dms/ | Laravel + Nextcloud + PostgreSQL + Redis + Meilisearch | 8100 (nginx), 8180 (nextcloud) | polelodms.isutech.co.za |
| AutoSlip | /opt/AutoSlip/ | Containerized application | Various | autoslip.isutech.co.za |
| Buka | /opt/buka/ | Containerized application | Various | buka.isutech.co.za |
Polelo DMS Case Study
Section titled “Polelo DMS Case Study”Polelo DMS is a perfect example of why containerized apps live in /opt/:
Architecture
Section titled “Architecture”┌─────────────────────────────────────────┐│ Polelo DMS (Laravel) │ Custom business logic│ Workflows, File Plans, Audit, Reports │├─────────────────────────────────────────┤│ Nextcloud │ Document storage, sync, mobile│ Storage, Sync, Versioning, Sharing │├─────────────────────────────────────────┤│ PostgreSQL + Redis + Meilisearch │ Data layer└─────────────────────────────────────────┘Running Containers
Section titled “Running Containers”polelo-nginx # Nginx web server (port 8100)polelo-app # Laravel PHP applicationpolelo-nextcloud # Nextcloud platform (port 8180)polelo-meilisearch # Search enginepolelo-redis # Cache/queueHow It’s Accessed
Section titled “How It’s Accessed”- Docker containers run at
/opt/polelo-dms/ - Nginx container exposes port 8100 internally
- Host Nginx proxies
polelodms.isutech.co.za→http://127.0.0.1:8100 - SSL certificate managed by Let’s Encrypt on the host
Useful Commands for Server Exploration
Section titled “Useful Commands for Server Exploration”Finding Projects
Section titled “Finding Projects”# List all projects in /var/www/ls -la /var/www/
# List all containerized apps in /opt/ls -la /opt/
# Find a specific project by namefind /var/www /opt -maxdepth 2 -type d -iname "*project-name*" 2>/dev/nullChecking Running Services
Section titled “Checking Running Services”# List all systemd servicessystemctl list-units --type=service
# Check services for a specific projectsystemctl list-units --type=service | grep -i project-name
# Check status of a specific servicesystemctl status service-nameDocker Operations
Section titled “Docker Operations”# List all running Docker containersdocker ps
# List all containers (including stopped)docker ps -a
# Check containers for a specific projectdocker ps | grep project-name
# View Docker Compose services for a projectcd /opt/project-namedocker compose ps
# View logs for a containerdocker logs container-name
# Follow logs in real-timedocker logs -f container-nameNginx Configuration
Section titled “Nginx Configuration”# List all enabled sitesls /etc/nginx/sites-enabled/
# Search for a domain in nginx configsgrep -r "domain.com" /etc/nginx/sites-enabled/
# Test nginx configurationnginx -t
# Reload nginx (after config changes)systemctl reload nginxPort Usage
Section titled “Port Usage”# Check what's listening on all portsss -tulpn
# Check a specific portss -tulpn | grep :8100
# Find process using a portlsof -i :8100Project Exploration
Section titled “Project Exploration”# Check project structurels -la /var/www/project-name/ls -la /opt/project-name/
# Look for configuration filesls /var/www/project-name/{.env,config/,*.yml,*.json} 2>/dev/null
# Check if project uses Dockerls /opt/project-name/docker-compose*.yml 2>/dev/null
# View package.json for Node.js projectscat /var/www/project-name/package.json
# View requirements.txt for Python projectscat /var/www/project-name/requirements.txt
# View composer.json for PHP projectscat /var/www/project-name/composer.jsonProcess Management
Section titled “Process Management”# Check PM2 processes (Node.js apps)pm2 listpm2 info app-namepm2 logs app-name
# Check systemd service logsjournalctl -u service-name -n 100 --no-pager
# Follow service logsjournalctl -u service-name -fDatabase Connections
Section titled “Database Connections”# Connect to PostgreSQLpsql -U username -d database_name
# List all PostgreSQL databasespsql -U postgres -c "\l"
# Connect to Redisredis-cli
# Check Redis inforedis-cli infoQuick Reference Table
Section titled “Quick Reference Table”| Task | /var/www/ Project | /opt/ Project |
|---|---|---|
| View logs | journalctl -u service-name -f or pm2 logs app-name | docker logs -f container-name |
| Restart | systemctl restart service-name or pm2 restart app-name | docker compose restart |
| Check status | systemctl status service-name or pm2 status | docker compose ps |
| View config | .env, config/ folder | docker-compose.yml, .env |
| Update code | git pull, restart service | git pull, docker compose up -d --build |
Best Practices
Section titled “Best Practices”For New Deployments
Section titled “For New Deployments”-
Decide on deployment type first:
- Self-contained with multiple services? → Use Docker in
/opt/ - Traditional web app using host services? → Use
/var/www/
- Self-contained with multiple services? → Use Docker in
-
Follow naming conventions:
- Use lowercase with hyphens:
project-name - Be consistent with domain names
- Use lowercase with hyphens:
-
Document your deployment:
- Add to this inventory
- Update nginx configs
- Configure monitoring
For Maintenance
Section titled “For Maintenance”-
Always check the location first:
Terminal window find /var/www /opt -name "project-name" -type d -
Understand the deployment type:
- Check for
docker-compose.yml→ Containerized - Check for systemd service → Direct deployment
- Check for
-
Use appropriate commands:
- Don’t try to use
systemctlon Docker containers - Don’t try to use
dockercommands on systemd services
- Don’t try to use
Troubleshooting
Section titled “Troubleshooting””Where is this project?"
Section titled “”Where is this project?"”# Search everywherefind /var/www /opt /home -name "*project*" -type d 2>/dev/null"How is this project running?"
Section titled “"How is this project running?"”# Check systemdsystemctl list-units | grep -i project
# Check Dockerdocker ps | grep -i project
# Check PM2pm2 list | grep -i project
# Check portsss -tulpn | grep -i project"Which domain points to this project?”
Section titled “"Which domain points to this project?””# Search nginx configsgrep -r "project-name\|domain.com" /etc/nginx/sites-enabled/Additional Resources
Section titled “Additional Resources”- Hetzner Server Guide - Complete server management guide
- Monitoring Quick Reference - Server monitoring commands
- Development Workflow - Development process guidelines
Questions or Updates? If you discover new patterns or projects, please update this document to keep it current for the team.