# Task 023 — Production Readiness

## Objective

Harden the platform for production deployment: security review, monitoring, backups, performance, and operational runbook.

## Scope

- Security checklist from `docs/11-security.md`
- Error tracking integration (e.g. Sentry)
- Structured logging
- MongoDB backup verification
- Load test light on campaign send path
- CI pipeline lint/build/test
- Complete `docs/12-deployment.md` runbook
- Rate limits on auth and tracking endpoints
- README production section

**Out of scope:** Multi-region HA (document as future).

## Requirements

1. All required env vars validated at startup in production mode.
2. Health check includes DB connectivity.
3. Deployment checklist in deployment doc completed.
4. No secrets in logs; dependency audit addressed.

## Files to create or modify

| Path | Action |
|------|--------|
| `src/lib/logger.ts` | Create |
| CI config | Create |
| `docs/11-security.md` | Hardening notes |
| `docs/12-deployment.md` | Full runbook |
| `docs/14-roadmap.md` | Mark Phase 10 complete |
| `docs/16-changelog.md` | Entry |
| `docs/13-decisions-log.md` | Hosting/monitoring decisions |

## Acceptance criteria

- [ ] Staging deployment successful per checklist
- [ ] Error tracking receives test error
- [ ] Backup restore tested once
- [ ] CI passes on main branch
- [ ] Security review sign-off from owner

## Documentation updates required

- `docs/11-security.md`
- `docs/12-deployment.md`
- `docs/14-roadmap.md`
- `docs/16-changelog.md`
- `docs/13-decisions-log.md`
