books/docs/architecture/deployment-architecture.md
Greg fa8acef423 Epic 1, Story 1.1: Project Initialization & Repository Setup
- Initialize Git repository with main branch
- Create comprehensive .gitignore for Node.js, React, and environment files
- Set up directory structure (frontend/, backend/, docs/)
- Create detailed README.md with project overview and setup instructions
- Add .env.example with all required environment variables
- Configure Prettier for consistent code formatting

All acceptance criteria met:
 Git repository initialized with appropriate .gitignore
 Directory structure matches Technical Assumptions
 README.md created with project overview and setup docs
 .env.example file with all required environment variables
 Prettier config files added for code formatting consistency

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:12:30 +01:00

79 lines
2.2 KiB
Markdown

# Deployment Architecture
## Deployment Strategy
**Frontend Deployment:**
- **Platform:** Coolify (self-hosted)
- **Build Command:** `npm run build` (in frontend/)
- **Output Directory:** `frontend/dist`
- **Serving:** Static files served by Nginx/Caddy via Coolify reverse proxy
- **CDN/Edge:** No CDN (self-hosted), Coolify handles SSL and caching headers
**Backend Deployment:**
- **Platform:** Coolify (self-hosted)
- **Build Command:** None (Node.js runs directly)
- **Deployment Method:** Docker container with `npm start`
- **Process Manager:** Docker handles restarts, no PM2 needed
- **Health Checks:** `GET /api/health` monitored by Coolify
**Database Deployment:**
- **Platform:** Coolify-managed PostgreSQL container
- **Backups:** Automated daily backups via Coolify
- **Migrations:** Run `npx prisma migrate deploy` on deployment
## CI/CD Pipeline
**MVP:** Manual deployment via Coolify UI (no CI/CD pipeline initially).
**Future CI/CD (GitHub Actions example):**
```yaml
# .github/workflows/deploy.yaml
name: Deploy to Coolify
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: |
cd frontend && npm ci
cd ../backend && npm ci
- name: Run tests
run: |
cd frontend && npm test
cd ../backend && npm test
- name: Build frontend
run: cd frontend && npm run build
- name: Deploy to Coolify
uses: coolify/action@v1
with:
api-key: ${{ secrets.COOLIFY_API_KEY }}
project-id: ${{ secrets.COOLIFY_PROJECT_ID }}
```
## Environments
| Environment | Frontend URL | Backend URL | Purpose |
|-------------|-------------|-------------|---------|
| Development | http://localhost:5173 | http://localhost:3000/api | Local development with hot reload |
| Production | https://books.yourdomain.com | https://books.yourdomain.com/api | Live environment on Coolify |
**Note:** No staging environment for MVP (single-user, can test locally). Add staging in v1.1 if needed.
---