smart-chatbot-api / docs /professional_workflow_guide.md
GitHub Actions
Deploy from GitHub Actions (2026-03-03 04:20 UTC)
c4d486b
# Professional Development Workflow Guide
## The Big Picture: Git Branches β‰  Deployment Environments
**Common Misconception:** Thinking branches = environments
**Reality:** Branches are code versions, environments are where code runs
```
Git Workflow (Code): Deployment Pipeline (Servers):
feature-branch Local Development
↓ ↓
development branch β†’ Development Server
↓ ↓
main branch β†’ Staging Server (Optional)
↓ ↓
(same main branch) β†’ Production Server
```
---
## Git Workflow: Managing Code Versions
### Step 1: Feature Development
```bash
# Create feature branch from development
git checkout development
git pull origin development
git checkout -b feature/new-chatbot-intent
# Work on your feature
# Make commits
git add .
git commit -m "Add product inquiry intent"
```
### Step 2: Integration Testing
```bash
# Merge feature into development branch
git checkout development
git merge feature/new-chatbot-intent
git push origin development
# Delete feature branch (cleanup)
git branch -d feature/new-chatbot-intent
```
### Step 3: Production Release
```bash
# When development is stable, merge to main
git checkout main
git pull origin main
git merge development
git push origin main
```
**Key Point**: `main` branch should always be production-ready!
---
## Deployment Pipeline: Where Code Runs
### Environment 1: Local Development
**Who uses it**: You, while developing
**Git branch**: Any branch you're working on
**Config file**: `.env.development`
**Purpose**: Fast iteration and debugging
```bash
# Run locally
python main.py
# Uses .env.development automatically
```
### Environment 2: Development Server (Optional)
**Who uses it**: Team members for integration testing
**Git branch**: `development` branch
**Config file**: `.env.development`
**Purpose**: Test how features work together
```bash
# Deploy development branch to dev server
git push origin development
# Server uses .env.development
```
### Environment 3: Staging Server (Pre-Production)
**Who uses it**: QA team, clients, final testing
**Git branch**: `main` branch
**Config file**: `.env.staging`
**Purpose**: Final testing before going live
```bash
# Deploy main branch to staging server
APP_ENV=staging python main.py
# Uses .env.staging with production-like settings
```
### Environment 4: Production Server (Live)
**Who uses it**: Real users/customers
**Git branch**: `main` branch
**Config file**: `.env.production`
**Purpose**: Serve real users
```bash
# Deploy main branch to production server
APP_ENV=production python main.py
# Uses .env.production with live settings
```
---
## Why Different Environment Configs?
### Development (.env.development)
```bash
# Loose security for debugging
API_DEBUG=true
CORS_ORIGINS=*
LOG_LEVEL=DEBUG
CONFIDENCE_THRESHOLD=0.3 # Lower threshold for testing
# Local connections
API_HOST=127.0.0.1
BACKEND_API_URL=http://127.0.0.1:8000
```
### Staging (.env.staging)
```bash
# Production-like but safer
API_DEBUG=true # Still debug for testing
CORS_ORIGINS=https://staging-app.netlify.app
LOG_LEVEL=INFO
CONFIDENCE_THRESHOLD=0.5 # Production-like threshold
# Staging URLs
API_HOST=0.0.0.0
BACKEND_API_URL=https://staging-chatbot.railway.app
```
### Production (.env.production)
```bash
# Tight security and performance
API_DEBUG=false
CORS_ORIGINS=https://smart-chatbot-demo.netlify.app
LOG_LEVEL=ERROR # Only log errors
CONFIDENCE_THRESHOLD=0.5 # Optimized threshold
# Production URLs
API_HOST=0.0.0.0
BACKEND_API_URL=https://smart-chatbot.railway.app
```
---
## Real-World Workflow Example
### Monday: New Feature Request
```bash
# 1. Create feature branch
git checkout -b feature/chinese-voice-support
# 2. Develop locally (uses .env.development)
python main.py # Test on localhost
# 3. Commit and push
git commit -m "Add Chinese voice recognition"
git push origin feature/chinese-voice-support
```
### Tuesday: Code Review & Integration
```bash
# 4. Merge to development after code review
git checkout development
git merge feature/chinese-voice-support
# 5. Deploy to development server for team testing
# (Development server pulls development branch)
```
### Wednesday: Prepare for Release
```bash
# 6. Merge to main when development is stable
git checkout main
git merge development
# 7. Deploy to staging for final testing
# (Staging server runs main branch with .env.staging)
```
### Thursday: Go Live
```bash
# 8. Deploy to production (same main branch!)
# (Production server runs main branch with .env.production)
```
**Key Insight**: Same code (`main` branch), different environments (staging vs production)!
---
## Environment Differences: What Changes?
| Aspect | Development | Staging | Production |
|--------|-------------|---------|------------|
| **Data** | Fake test data | Production-like test data | Real customer data |
| **URLs** | localhost:8000 | staging-app.com | myapp.com |
| **Debugging** | Full debug info | Some debug info | Minimal logging |
| **Security** | Relaxed CORS | Restricted CORS | Strict CORS |
| **Performance** | Doesn't matter | Should be fast | Must be fast |
| **Integrations** | Mock APIs | Test APIs | Live APIs |
---
## Why This Matters for Your Career
### Shows Professional Understanding
```bash
# Amateur approach
git push origin main # Hope it works in production! 🀞
# Professional approach
feature β†’ development β†’ main
↓ ↓ ↓
local β†’ dev server β†’ staging β†’ production
```
### Demonstrates Key Skills
- **Risk Management**: Staging catches issues before users see them
- **Team Collaboration**: Multiple environments support different roles
- **System Architecture**: Understanding infrastructure beyond just code
- **Quality Assurance**: Built-in testing at each stage
---
## Portfolio Project Simplification
**For your chatbot project, you can use a simplified workflow:**
### Minimal Setup (2 Environments)
```bash
Development: .env.development (localhost)
Production: .env.production (Railway + Netlify)
```
### Professional Setup (4 Environments)
```bash
Local: .env.development (localhost)
Development: .env.development (team dev server)
Staging: .env.staging (client testing server)
Production: .env.production (live user server)
```
**Recommendation**: Use minimal setup for speed, but **mention you understand the full professional workflow** in interviews!
---
## Interview Gold: What This Shows
**When recruiter asks**: *"Tell me about your development process"*
**Your answer**:
> "I follow professional Git workflow with feature branches merging to development, then main. I use environment-specific configurations - development for local work with debug enabled, staging for pre-production testing with production-like settings, and production with optimized security and performance. This ensures code quality and reduces production risks."
**Boom!** 🎯 You just demonstrated enterprise-level understanding.
---
## Quick Commands Reference
### Git Workflow
```bash
# Start new feature
git checkout -b feature/my-feature
# Integrate to development
git checkout development && git merge feature/my-feature
# Deploy to production
git checkout main && git merge development
```
### Environment Management
```bash
# Local development
python main.py
# Staging deployment
APP_ENV=staging python main.py
# Production deployment
APP_ENV=production python main.py
```
### Configuration Check
```bash
# See which environment is loaded
curl http://localhost:8000/
# Returns: {"environment": "development", ...}
```
Remember: **Professional workflow is about managing risk and enabling collaboration, not just moving code around!**