# ColaFlow Docker Quick Start

Quick guide to start ColaFlow backend for frontend development.

## Prerequisites

- Docker Desktop installed and running
- Git (optional, for version control)

## Quick Start (30 seconds)

### Windows (PowerShell)

```powershell
# Clone repo (if not already)
git clone <repo-url>
cd product-master

# Start all services
.\scripts\dev-start.ps1
```

### Linux/Mac (Bash)

```bash
# Clone repo (if not already)
git clone <repo-url>
cd product-master

# Start all services
chmod +x scripts/dev-start.sh
./scripts/dev-start.sh
```

### Using npm (from frontend directory)

```bash
cd colaflow-web
npm run docker:dev
```

## Access Points

After startup (30-60 seconds), access:

| Service | URL | Credentials |
|---------|-----|-------------|
| Frontend | http://localhost:3000 | - |
| Backend API | http://localhost:5000 | - |
| Swagger Docs | http://localhost:5000/swagger | - |
| Demo Login | - | owner@demo.com / Admin123! |

## Common Commands

```powershell
# View logs
docker-compose logs -f

# Stop all services
docker-compose down

# Restart backend only
docker-compose restart backend

# Reset all data (WARNING: deletes everything)
.\scripts\dev-start.ps1 -Reset

# Start with dev tools (pgAdmin, Redis Commander)
.\scripts\dev-start.ps1 -Tools
```

## Dev Tools (Optional)

Start with `-Tools` flag to access:

| Tool | URL | Credentials |
|------|-----|-------------|
| pgAdmin | http://localhost:5050 | admin@colaflow.com / admin |
| Redis Commander | http://localhost:8081 | - |

## Troubleshooting

### Services won't start

```powershell
# Check Docker is running
docker info

# View detailed logs
docker-compose logs backend
docker-compose logs postgres
```

### Port conflicts

Edit `.env` file to change ports:

```env
BACKEND_PORT=5001
FRONTEND_PORT=3001
POSTGRES_PORT=5433
```

### Fresh start

```powershell
# Remove all containers and data
docker-compose down -v

# Rebuild and restart
.\scripts\dev-start.ps1 -Clean
```

## Frontend Development

### Connect to containerized backend

Create `colaflow-web/.env.local`:

```env
NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_WS_URL=ws://localhost:5000/hubs/project
```

### Run frontend locally (recommended)

```bash
cd colaflow-web
npm install
npm run dev
```

Frontend will run on http://localhost:3000 and connect to containerized backend.

## What's Included?

The Docker environment provides:

- PostgreSQL 16 database
- Redis 7 cache
- .NET 9 backend API
- Next.js 15 frontend
- Demo tenant with sample data
- SignalR real-time updates

## Sample Data

Default demo account:

- Email: owner@demo.com
- Password: Admin123!
- Role: Tenant Owner (full access)

Includes:
- 1 demo project
- 1 epic
- 1 story
- 3 tasks

## Next Steps

1. Start backend: `.\scripts\dev-start.ps1`
2. Start frontend: `cd colaflow-web && npm run dev`
3. Open browser: http://localhost:3000
4. Login with demo account
5. Start developing!

## Need Help?

- Full documentation: `docs/DOCKER-DEVELOPMENT-ENVIRONMENT.md`
- Report issues: [GitHub Issues]
- Ask in Slack: #colaflow-dev

---

**Quick Reference:**

```powershell
# Start
.\scripts\dev-start.ps1

# Stop
docker-compose down

# Logs
docker-compose logs -f

# Reset
.\scripts\dev-start.ps1 -Reset
```
