Development Workflow Guide
Development Workflow Guide
Section titled “Development Workflow Guide”Complete guide to the development and deployment workflow for iSu Technologies applications.
🏗️ Development Environment
Section titled “🏗️ Development Environment”Directory Structure
Section titled “Directory Structure”Development: /projects/active/ (3.1GB total)
Production: /var/www/ (24GB total)
Development Projects
Section titled “Development Projects”| Project | Size | Git Status | Production Location |
|---|---|---|---|
| thrive-send-b2b2g | 2.0GB | ✅ Clean | /var/www/thrivesend/ |
| isutech-prospect-iq | 696MB | ✅ Clean | /var/www/prospect-iq/ |
| umdoni-website | 271MB | ✅ Clean | /var/www/umdoni/ |
| mnyandu-portfolio_from_root | 147MB | ✅ Clean | /var/www/nhlanhla-portfolio/ |
| matchmind | 19MB | ✅ Clean | /var/www/matchmind/ (stopped) |
| iSuMonitor | 7.6MB | ⚪ No Git | /var/www/monitor/ |
| autoslip | 1.7MB | ✅ Clean | Service only |
| MyProfile | 56KB | ⚪ No Git | Personal docs |
Note: Development happens directly on the production server at /projects/active/ due to Mac hardware constraints.
🔄 Standard Development Workflow
Section titled “🔄 Standard Development Workflow”1. Navigate to Development Directory
Section titled “1. Navigate to Development Directory”# Navigate to development projectcd /projects/active/<project-name>
# Check Git statusgit status
# Check current branchgit branch2. Make Changes
Section titled “2. Make Changes”# Create feature branch (recommended)git checkout -b feature/your-feature-name
# Or work on main/master (for small changes)git checkout main
# Edit filesnano src/components/YourComponent.tsx3. Test Locally
Section titled “3. Test Locally”For Next.js Applications:
# Install dependencies (if needed)npm install
# Run development servernpm run dev# Opens at http://localhost:3000
# Run tests (if available)npm test
# Build to verifynpm run buildFor FastAPI Applications:
# Activate virtual environmentsource venv/bin/activate
# Install dependencies (if needed)pip install -r requirements.txt
# Run development serveruvicorn app.main:app --reload --port 8000
# Run tests (if available)pytest
# Check code qualityflake8 app/black app/ --check4. Commit Changes
Section titled “4. Commit Changes”# Check what changedgit statusgit diff
# Stage changesgit add .# Or stage specific filesgit add src/components/YourComponent.tsx
# Commit with descriptive messagegit commit -m "Add new feature: description of what you did
- Bullet point 1- Bullet point 2
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
# View commit historygit log --oneline -55. Push to GitHub
Section titled “5. Push to GitHub”# Push to remote repositorygit push origin main# Or for feature branchgit push origin feature/your-feature-name
# If branch doesn't exist on remotegit push -u origin feature/your-feature-name6. Deploy to Production
Section titled “6. Deploy to Production”See deployment procedures below for specific application types.
🚀 Deployment Procedures
Section titled “🚀 Deployment Procedures”Deploying Next.js Applications (PM2)
Section titled “Deploying Next.js Applications (PM2)”Applications: ThriveSend, SANSA Frontend, iSuTech Backend
# 1. Navigate to production directorycd /var/www/<app-name>
# 2. Backup current build (optional but recommended)cp -r .next .next.backup-$(date +%Y%m%d)
# 3. Pull latest changes from Gitgit pull origin main
# 4. Install dependenciesnpm install
# 5. Build applicationnpm run build
# 6. Restart PM2 processpm2 restart <app-name>
# 7. Verify deploymentpm2 statuspm2 logs <app-name> --lines 50
# 8. Test applicationcurl http://localhost:<port># Or visit https://<domain>Example: Deploying ThriveSend
cd /var/www/thrivesendcp -r .next .next.backup-$(date +%Y%m%d)git pull origin mainnpm installnpm run buildpm2 restart thrivesendpm2 logs thrivesend --lines 50Deploying FastAPI Applications (systemd)
Section titled “Deploying FastAPI Applications (systemd)”Applications: SANSA Backend, Tumi Backend, SACE Backend
# 1. Navigate to production directorycd /var/www/<app-name>
# 2. Backup current code (optional)tar -czf ../backup-<app-name>-$(date +%Y%m%d).tar.gz app/
# 3. Pull latest changesgit pull origin main
# 4. Activate virtual environmentsource venv/bin/activate
# 5. Install new dependenciespip install -r requirements.txt
# 6. Run database migrations (if applicable)alembic upgrade head
# 7. Deactivate virtual environmentdeactivate
# 8. Restart systemd servicesudo systemctl restart <service-name>
# 9. Verify deploymentsudo systemctl status <service-name>sudo journalctl -u <service-name> -n 50
# 10. Test APIcurl http://localhost:<port>/api/health# Or visit https://<domain>/api/docsExample: Deploying SANSA Backend
cd /var/www/sansa-backendtar -czf ../backup-sansa-backend-$(date +%Y%m%d).tar.gz app/git pull origin mainsource venv/bin/activatepip install -r requirements.txtalembic upgrade headdeactivatesudo systemctl restart sansa-backendsudo systemctl status sansa-backendsudo journalctl -u sansa-backend -n 50curl http://localhost:8003/api/v1/healthDeploying Next.js Applications (systemd)
Section titled “Deploying Next.js Applications (systemd)”Applications: SACE Frontend, ProspectIQ Frontend
# 1. Navigate to production directorycd /var/www/<app-name>
# 2. Backup current buildcp -r .next .next.backup-$(date +%Y%m%d)
# 3. Pull latest changesgit pull origin main
# 4. Install dependenciesnpm install
# 5. Build applicationnpm run build
# 6. Restart systemd servicesudo systemctl restart <service-name>
# 7. Verify deploymentsudo systemctl status <service-name>sudo journalctl -u <service-name> -n 50
# 8. Test applicationcurl http://localhost:<port>Example: Deploying SACE Frontend
cd /var/www/sace-frontendcp -r .next .next.backup-$(date +%Y%m%d)git pull origin mainnpm installnpm run buildsudo systemctl restart sace-frontendsudo systemctl status sace-frontendsudo journalctl -u sace-frontend -n 50curl http://localhost:3000Deploying Static Sites
Section titled “Deploying Static Sites”Applications: Tumi Frontend, Umdoni, Portfolio, DocsHub
# 1. Navigate to production directorycd /var/www/<app-name>
# 2. Backup current buildtar -czf ../backup-<app-name>-$(date +%Y%m%d).tar.gz .
# 3. Pull latest changesgit pull origin main
# 4. If build step required (e.g., React/Vue)npm installnpm run build
# 5. No restart needed - nginx serves files automatically
# 6. Verify deploymentcurl https://<domain>
# 7. Check nginx logssudo tail -f /var/log/nginx/access.logExample: Deploying DocsHub (Astro Starlight)
cd /var/www/docs/repogit pull origin mainnpm ci --productionnpx astro build# Site built to: /var/www/docs/repo/dist# Nginx automatically serves updated files# Note: auto-updated every 10 min via cronDeploying ProspectIQ (5 Services)
Section titled “Deploying ProspectIQ (5 Services)”ProspectIQ requires careful orchestration due to its 5-service architecture:
# 1. Navigate to production directorycd /var/www/prospect-iq
# 2. Backup current codetar -czf ../backup-prospectiq-$(date +%Y%m%d).tar.gz .
# 3. Pull latest changesgit pull origin main
# 4. Install backend dependencies (if backend changed)cd backendsource venv/bin/activatepip install -r requirements.txtalembic upgrade headdeactivatecd ..
# 5. Install frontend dependencies (if frontend changed)cd frontendnpm installnpm run buildcd ..
# 6. Restart services in correct order# Stop workers firstsudo systemctl stop prospectiq-celery-beatsudo systemctl stop prospectiq-celerysudo systemctl stop prospectiq-worker
# Restart APIsudo systemctl restart prospectiq-api
# Restart frontendsudo systemctl restart prospectiq-frontend
# Start workerssudo systemctl start prospectiq-workersudo systemctl start prospectiq-celerysudo systemctl start prospectiq-celery-beat
# 7. Verify all servicessudo systemctl status prospectiq-api prospectiq-frontend \ prospectiq-celery prospectiq-celery-beat prospectiq-worker
# 8. Check logssudo journalctl -u prospectiq-api -n 20sudo journalctl -u prospectiq-celery -n 20🔧 Development Best Practices
Section titled “🔧 Development Best Practices”Git Workflow
Section titled “Git Workflow”Branch Strategy:
# Main branch for production-ready codemain / master
# Feature branches for new featuresfeature/add-user-authenticationfeature/improve-dashboard
# Bugfix branches for bug fixesbugfix/fix-login-errorbugfix/correct-typo
# Hotfix branches for urgent production fixeshotfix/critical-security-patchCommit Message Format:
Brief summary of change (50 chars or less)
More detailed explanation if needed. Wrap at 72 characters.- Bullet points for specific changes- Multiple bullets if needed
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>Good Commit Messages:
- ✅ “Add user authentication with JWT tokens”
- ✅ “Fix database connection timeout issue”
- ✅ “Update dashboard UI with new charts”
- ❌ “Fixed stuff”
- ❌ “WIP”
- ❌ “Changes”
Code Review Checklist
Section titled “Code Review Checklist”Before deploying to production:
- Code tested locally
- Tests passing (if applicable)
- No console errors
- Environment variables updated (if needed)
- Database migrations tested (if applicable)
- Git commits pushed to remote
- Code reviewed (if team workflow)
- Production backup created
- Deployment plan documented
- Rollback plan ready
Environment Variables
Section titled “Environment Variables”Development (.env.local):
# Development environment variablesDATABASE_URL=postgresql://user:pass@localhost:5432/dev_dbAPI_URL=http://localhost:8000DEBUG=trueProduction (.env.production):
# Production environment variablesDATABASE_URL=postgresql://user:pass@localhost:5432/prod_dbAPI_URL=https://api.domain.comDEBUG=falseSecurity:
- ✅ NEVER commit .env files to Git
- ✅ Add
.env*to.gitignore - ✅ Use strong passwords
- ✅ Rotate secrets regularly
- ✅ Use environment-specific configs
🔄 Database Migrations
Section titled “🔄 Database Migrations”Alembic (Python/FastAPI)
Section titled “Alembic (Python/FastAPI)”Create Migration:
cd /projects/active/<project-name>source venv/bin/activatealembic revision --autogenerate -m "Description of changes"Review Migration:
# Check generated migration filecat alembic/versions/<revision_id>_description.py
# Edit if needednano alembic/versions/<revision_id>_description.pyTest Migration (Development):
# Apply migrationalembic upgrade head
# Verify changespsql -U user -d dev_db -c "\dt"
# Rollback if neededalembic downgrade -1Deploy Migration (Production):
cd /var/www/<app-name>source venv/bin/activatealembic upgrade headdeactivatesudo systemctl restart <service-name>Prisma (Node.js/Next.js)
Section titled “Prisma (Node.js/Next.js)”Create Migration:
cd /projects/active/<project-name>npx prisma migrate dev --name description_of_changesDeploy Migration (Production):
cd /var/www/<app-name>npx prisma migrate deploypm2 restart <app-name># Orsudo systemctl restart <service-name>🚨 Rollback Procedures
Section titled “🚨 Rollback Procedures”Rolling Back Code
Section titled “Rolling Back Code”PM2 Applications:
# 1. Navigate to production directorycd /var/www/<app-name>
# 2. Restore previous buildrm -rf .nextmv .next.backup-YYYYMMDD .next
# 3. Restart PM2pm2 restart <app-name>
# Or restore from Gitgit log --oneline -10git reset --hard <previous-commit-hash>npm installnpm run buildpm2 restart <app-name>Systemd Applications:
# 1. Navigate to production directorycd /var/www/<app-name>
# 2. Restore from backuprm -rf apptar -xzf ../backup-<app-name>-YYYYMMDD.tar.gz
# 3. Restart servicesudo systemctl restart <service-name>
# Or restore from Gitgit log --oneline -10git reset --hard <previous-commit-hash>source venv/bin/activatepip install -r requirements.txtdeactivatesudo systemctl restart <service-name>Rolling Back Database
Section titled “Rolling Back Database”PostgreSQL:
# 1. Stop applicationsudo systemctl stop <service-name>
# 2. Restore database backupsudo -u postgres psql -d <database-name> < ~/backups/backup-YYYYMMDD.sql
# 3. Restart applicationsudo systemctl start <service-name>Alembic:
# Rollback to previous migrationcd /var/www/<app-name>source venv/bin/activatealembic downgrade -1deactivatesudo systemctl restart <service-name>📊 Monitoring Deployments
Section titled “📊 Monitoring Deployments”Verify Deployment Success
Section titled “Verify Deployment Success”Check Service Status:
# Systemd servicessudo systemctl status <service-name>
# PM2 processespm2 statusCheck Logs:
# Systemd logssudo journalctl -u <service-name> -f
# PM2 logspm2 logs <app-name>
# Nginx logssudo tail -f /var/log/nginx/access.logsudo tail -f /var/log/nginx/error.logTest Endpoints:
# Health checkscurl http://localhost:<port>/api/healthcurl https://<domain>/api/health
# Application accesscurl https://<domain>
# Check response timecurl -w "@curl-format.txt" -o /dev/null -s https://<domain>Common Issues After Deployment
Section titled “Common Issues After Deployment”| Issue | Solution |
|---|---|
| Service won’t start | Check logs: sudo journalctl -u <service> -n 100 |
| 502 Bad Gateway | Service not running or wrong port |
| 404 Not Found | Nginx config issue or wrong domain |
| Import errors (Python) | Missing dependencies: pip install -r requirements.txt |
| Module not found (Node) | Missing dependencies: npm install |
| Database connection failed | Check DATABASE_URL in .env |
| Permission denied | Check file ownership: chown -R www-data:www-data /var/www/<app> |
📦 Backup Strategy
Section titled “📦 Backup Strategy”Regular Backups
Section titled “Regular Backups”Code Backups:
# Git repositories (automatic via GitHub)cd /var/www/<app-name>git remote -vgit status
# Manual backup before deploymenttar -czf ~/backups/backup-<app-name>-$(date +%Y%m%d).tar.gz /var/www/<app-name>Database Backups:
# PostgreSQL backupsudo -u postgres pg_dump <database-name> > ~/backups/<database>-$(date +%Y%m%d).sql
# Backup all databasessudo -u postgres pg_dumpall > ~/backups/all-databases-$(date +%Y%m%d).sql
# Backup with compressionsudo -u postgres pg_dump <database-name> | gzip > ~/backups/<database>-$(date +%Y%m%d).sql.gzAutomated Backups (Cron):
# Edit crontabcrontab -e
# Add daily database backup at 2 AM0 2 * * * sudo -u postgres pg_dump sansa_production > ~/backups/sansa-$(date +\%Y\%m\%d).sql
# Add weekly cleanup of old backups (keep 30 days)0 3 * * 0 find ~/backups -name "*.sql" -mtime +30 -delete🔒 Security Considerations
Section titled “🔒 Security Considerations”Development Security
Section titled “Development Security”- ✅ Use different credentials for development and production
- ✅ Never commit secrets to Git
- ✅ Use
.envfiles for environment variables - ✅ Add
.env*to.gitignore - ✅ Rotate API keys regularly
- ✅ Use SSH keys for Git authentication
Production Security
Section titled “Production Security”- ✅ Use HTTPS for all applications
- ✅ Keep SSL certificates updated (auto-renewal via certbot)
- ✅ Use strong database passwords
- ✅ Restrict database access to localhost
- ✅ Enable UFW firewall
- ✅ Regular security updates:
sudo apt update && sudo apt upgrade - ✅ Use systemd service hardening
- ✅ Implement rate limiting on API endpoints
Secrets Management
Section titled “Secrets Management”Protected Files:
# AutoSlip secrets/projects/active/autoslip/.env.backup-*/projects/active/autoslip/google-credentials.json
# Application secrets/var/www/*/. env/var/www/*/.env.productionFile Permissions:
# Restrict .env fileschmod 600 /var/www/<app>/.env
# Restrict service account keyschmod 600 /var/www/<app>/google-credentials.json📝 Quick Reference
Section titled “📝 Quick Reference”Development to Production Flow
Section titled “Development to Production Flow”1. Work on feature in /projects/active/<project>/2. Test locally (npm run dev / uvicorn --reload)3. Commit changes to Git4. Push to GitHub5. Navigate to /var/www/<project>/6. Pull latest changes7. Install dependencies8. Build application9. Restart service10. Verify deployment11. Monitor logsCommon Commands
Section titled “Common Commands”# Developmentcd /projects/active/<project>git statusnpm run dev # or uvicorn app.main:app --reload
# Productioncd /var/www/<project>git pull origin mainnpm install && npm run build # or pip install -r requirements.txtpm2 restart <app> # or sudo systemctl restart <service>pm2 logs <app> # or sudo journalctl -u <service> -f📞 Support & Resources
Section titled “📞 Support & Resources”Internal Documentation
Section titled “Internal Documentation”- Hetzner Server Management - Infrastructure details
- Hetzner Server Guide - Operations procedures
External Resources
Section titled “External Resources”- Git Documentation
- Next.js Deployment
- FastAPI Deployment
- PM2 Documentation
- Systemd Service Management
Last Updated: 02/01/2026 | Document Owner: Development Team | Version: 1.0