Productionize app
Invocation: Start only when the user explicitly requests this workflow.
Prepare an application for production deployment across configuration, reliability, security, performance, observability, packaging, and deployment readiness.
Usage patterns
Optional arguments name the framework and deployment target:
/productionize-app # Auto-detect framework, general production prep
/productionize-app flutter testflight # Flutter app for TestFlight
/productionize-app react vercel # React app for Vercel deployment
/productionize-app nodejs docker # Node.js app for Docker deployment
Framework checklists cover Flutter, React/Next.js, Node.js, and Python; deployment checklists cover TestFlight, Google Play, web hosts (Vercel, Netlify, AWS), and containers. For any other stack or target, run the general workflow and state which checklist was unavailable.
Workflow
1. Detect stack and baseline
- Detect the framework from repository files: Flutter (
pubspec.yaml,.dart), React/Next.js (package.jsonwithreactornext), Node.js (package.jsonwithexpress,fastify,koa, orhono), or Python (pyproject.toml,requirements.txt). - Inspect existing packaging, deployment, and config files (
Dockerfile, CI workflows,.env.example, manifest files) and identify build, lint, and test commands. - Map external dependencies (databases, queues, third-party APIs) and entry points.
2. Audit and fix core production domains
Audit each domain, record concrete gaps with file paths, and apply fixes directly:
- Configuration and secrets: Move hardcoded credentials, API keys, and environment-specific URLs to environment variables or a secret store; validate required environment variables at startup so the app exits non-zero when required settings are missing; keep
.env.examplein sync and secrets out of Git. - Reliability and timeouts: Set explicit connect/read timeouts on all outbound HTTP and database calls; add bounded retries with exponential backoff only for idempotent or safe transient failures; handle unhandled promise rejections / uncaught exceptions; add graceful
SIGTERM/SIGINTshutdown draining in-flight requests. - Security: Sanitize and schema-validate external inputs; remove or gate debug endpoints and dev flags in production builds; restrict CORS to explicit allowed origins; set security response headers; ensure error responses return safe messages without stack traces or internal paths.
- Performance: Bound pagination and payload limits; eliminate obvious N+1 queries and add missing database indexes for hot lookups; enable asset compression and explicit
Cache-Controlheaders for static assets and cacheable responses. - Observability: Emit structured JSON logs with explicit log levels (
debug,info,warn,error) and request correlation IDs; expose a liveness/readiness health endpoint (e.g.,/healthz,/readyz) that verifies critical dependencies; remove leftover debug logging and temporary mocks. - User experience (client apps): Add top-level error boundaries, loading states, empty states, and offline error recovery for network requests.
3. Apply framework-specific optimizations
Apply the checklist for the detected framework (Flutter, React/Next.js, Node.js, or Python) from resources/manual/framework-checklists.md.
4. Prepare deployment and documentation
- Apply the target checklist (TestFlight, Google Play, Web, or Container) from resources/manual/framework-checklists.md.
- Update
README.mdwith required environment variables and secrets, exact build/test/deploy commands for the target platform, health check endpoints, and external service dependencies.
5. Verify production readiness
Run the stack’s concrete verification commands and record exact results:
- Production build: Run the release/production build command with optimization flags enabled (e.g.,
npm run build,flutter build --release,docker build, orpython -m build) and confirm exit code0. - Test and lint suite: Run the automated test, typecheck, and lint suite and add regression tests for any newly added startup validation, health endpoints, or error handlers.
- Secret and config check: Scan tracked files and build outputs for hardcoded secrets or
.envleaks, and verify the app fails fast with a clear error when a required environment variable is unset. - Health and deployment smoke check: Start the built artifact locally (or run a staging/dry-run deploy) and verify the health endpoint returns HTTP
200(and503when a required dependency is unavailable, if applicable).
Completion criteria
- Every gap identified in Steps 2 through 4 is fixed or explicitly documented as a follow-up with owner/blocker.
- Production build, automated tests, secret/config fail-fast check, and health/smoke verification all pass with recorded command output.
README.mdand.env.exampledocument all required runtime configuration and deployment steps.