55 @echo " CodeIntel - Development Commands"
66 @echo " "
77 @echo " Local Development:"
8- @echo " make dev - Start all services with hot reload"
9- @echo " make prod - Start production-like environment"
10- @echo " make build - Build Docker images"
8+ @echo " make dev - Start local dev (uses .env.dev)"
9+ @echo " make dev-prod - Test prod config locally (uses .env.prod)"
1110 @echo " make stop - Stop all services"
1211 @echo " make clean - Stop and remove all containers/volumes"
1312 @echo " make logs - View all logs"
13+ @echo " make health - Check service health"
1414 @echo " "
1515 @echo " Testing:"
1616 @echo " make test - Run backend tests"
17- @echo " make test-watch - Run tests in watch mode "
17+ @echo " make test-ws - Run WebSocket auth tests only "
1818 @echo " make coverage - Run tests with coverage report"
1919 @echo " "
2020 @echo " Deployment:"
2121 @echo " make deploy-backend - Deploy backend to Railway"
2222 @echo " make deploy-frontend - Deploy frontend to Vercel"
23- @echo " make deploy-all - Deploy both backend and frontend"
2423
25- # Development with hot reload
24+ # ============================================
25+ # LOCAL DEVELOPMENT
26+ # ============================================
27+
28+ # Development with .env.dev
2629dev :
27- docker compose -f docker-compose.dev.yml up -d
30+ @echo " 🚀 Starting LOCAL DEV environment..."
31+ @cp .env.dev .env
32+ docker compose up -d --build
2833 @echo " "
2934 @echo " ✅ Development environment started!"
3035 @echo " Backend: http://localhost:8000"
31- @echo " Docs: http://localhost:8000/docs"
36+ @echo " API Docs: http://localhost:8000/docs"
3237 @echo " Frontend: http://localhost:3000"
3338 @echo " Redis: localhost:6379"
3439 @echo " "
3540 @echo " View logs: make logs"
3641
37- # Production-like environment
38- prod :
39- docker compose up -d
42+ # Test production config locally (uses .env.prod)
43+ dev-prod :
44+ @echo " 🚀 Starting LOCAL environment with PROD config..."
45+ @cp .env.prod .env
46+ docker compose up -d --build
4047 @echo " "
41- @echo " ✅ Production environment started!"
48+ @echo " ✅ Prod-config environment started!"
4249 @echo " Backend: http://localhost:8000"
4350 @echo " Frontend: http://localhost:3000"
4451
45- # Build images
46- build :
47- docker compose build
48-
4952# Stop services
5053stop :
5154 docker compose down
52- docker compose -f docker-compose.dev.yml down
55+ @echo " ✅ Services stopped "
5356
5457# Clean everything (including volumes)
5558clean :
56- docker compose down -v
57- docker compose -f docker-compose.dev.yml down -v
59+ docker compose down -v --remove-orphans
5860 @echo " ✅ Cleaned all containers and volumes"
5961
6062# View logs
6163logs :
6264 docker compose logs -f
6365
64- # Run backend tests
66+ # Logs for specific service
67+ logs-backend :
68+ docker compose logs -f backend
69+
70+ logs-frontend :
71+ docker compose logs -f frontend
72+
73+ # ============================================
74+ # TESTING
75+ # ============================================
76+
77+ # Run all backend tests
6578test :
66- cd backend && python -m pytest tests/ -v
79+ cd backend && python3 -m pytest tests/ -v --no-cov
6780
68- # Run tests in watch mode
69- test-watch :
70- cd backend && python -m pytest tests/ -v --looponfail
81+ # Run WebSocket auth tests only
82+ test-ws :
83+ cd backend && python3 -m pytest tests/test_websocket_auth.py -v --no-cov
7184
7285# Run tests with coverage
7386coverage :
74- cd backend && python -m pytest tests/ --cov=. --cov-report=html --cov-report=term
87+ cd backend && python3 -m pytest tests/ --cov=. --cov-report=html --cov-report=term
7588 @echo " "
7689 @echo " Coverage report: backend/htmlcov/index.html"
7790
91+ # ============================================
92+ # DEPLOYMENT
93+ # ============================================
94+
7895# Deploy backend to Railway
7996deploy-backend :
8097 @echo " 🚀 Deploying backend to Railway..."
@@ -91,15 +108,16 @@ deploy-frontend:
91108deploy-all : deploy-backend deploy-frontend
92109 @echo " ✅ All services deployed!"
93110
94- # Quick restart of backend (for dev)
95- restart-backend :
96- docker compose restart backend
97- @echo " ✅ Backend restarted"
111+ # ============================================
112+ # UTILITIES
113+ # ============================================
98114
99- # Quick restart of frontend (for dev)
100- restart-frontend :
101- docker compose restart frontend
102- @echo " ✅ Frontend restarted"
115+ # Check service health
116+ health :
117+ @echo " Checking services..."
118+ @curl -s http://localhost:8000/health | python3 -m json.tool 2> /dev/null || echo " ❌ Backend not responding"
119+ @curl -s -o /dev/null -w " " http://localhost:3000 && echo " ✅ Frontend is up" || echo " ❌ Frontend not responding"
120+ @docker compose exec -T redis redis-cli ping 2> /dev/null | grep -q PONG && echo " ✅ Redis is up" || echo " ❌ Redis not responding"
103121
104122# Shell into backend container
105123shell-backend :
@@ -109,27 +127,12 @@ shell-backend:
109127shell-redis :
110128 docker compose exec redis redis-cli
111129
112- # View Redis stats
113- redis-stats :
114- docker compose exec redis redis-cli INFO
115-
116- # Check service health
117- health :
118- @echo " Checking services..."
119- @curl -s http://localhost:8000/health | python -m json.tool || echo " ❌ Backend not responding"
120- @curl -s http://localhost:3000 > /dev/null && echo " ✅ Frontend is up" || echo " ❌ Frontend not responding"
121- @docker compose exec redis redis-cli ping > /dev/null && echo " ✅ Redis is up" || echo " ❌ Redis not responding"
122-
123- # Install dependencies (local dev without Docker)
124- install-backend :
125- cd backend && pip install -r requirements.txt
126-
127- install-frontend :
128- cd frontend && npm install
129-
130- # Run locally without Docker
131- run-backend-local :
132- cd backend && uvicorn main:app --reload --port 8000
130+ # Quick rebuild backend only
131+ rebuild-backend :
132+ docker compose up -d --build backend
133+ @echo " ✅ Backend rebuilt and restarted"
133134
134- run-frontend-local :
135- cd frontend && npm run dev
135+ # Quick rebuild frontend only
136+ rebuild-frontend :
137+ docker compose up -d --build frontend
138+ @echo " ✅ Frontend rebuilt and restarted"
0 commit comments