forjajs 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/CHANGELOG.md +68 -2
  2. package/README.md +4 -2
  3. package/README.pt-BR.md +4 -1
  4. package/boilerplates/02-saas-starter/README.md +58 -293
  5. package/boilerplates/02-saas-starter/backend/.env.example +13 -0
  6. package/boilerplates/02-saas-starter/backend/.oxlintrc.json +8 -0
  7. package/boilerplates/02-saas-starter/backend/nest-cli.json +6 -0
  8. package/boilerplates/02-saas-starter/backend/package.json +32 -73
  9. package/boilerplates/02-saas-starter/backend/src/app.module.ts +16 -16
  10. package/boilerplates/02-saas-starter/backend/src/billing/adapters/http/billing.controller.ts +55 -0
  11. package/boilerplates/02-saas-starter/backend/src/billing/adapters/persistence/orm-entities.ts +28 -0
  12. package/boilerplates/02-saas-starter/backend/src/billing/adapters/persistence/typeorm-billing.repository.ts +46 -0
  13. package/boilerplates/02-saas-starter/backend/src/billing/application/billing.service.spec.ts +58 -0
  14. package/boilerplates/02-saas-starter/backend/src/billing/application/billing.service.ts +68 -0
  15. package/boilerplates/02-saas-starter/backend/src/billing/billing.module.ts +11 -0
  16. package/boilerplates/02-saas-starter/backend/src/billing/domain/plan.spec.ts +23 -0
  17. package/boilerplates/02-saas-starter/backend/src/billing/domain/plan.ts +36 -0
  18. package/boilerplates/02-saas-starter/backend/src/billing/domain/ports.ts +27 -0
  19. package/boilerplates/02-saas-starter/backend/src/billing/domain/subscription.spec.ts +28 -0
  20. package/boilerplates/02-saas-starter/backend/src/billing/domain/subscription.ts +47 -0
  21. package/boilerplates/02-saas-starter/backend/src/identity/adapters/http/auth.dto.ts +22 -0
  22. package/boilerplates/02-saas-starter/backend/src/identity/adapters/http/identity.controller.ts +59 -0
  23. package/boilerplates/02-saas-starter/backend/src/identity/adapters/persistence/orm-entities.ts +25 -0
  24. package/boilerplates/02-saas-starter/backend/src/identity/adapters/persistence/typeorm-identity.repository.ts +47 -0
  25. package/boilerplates/02-saas-starter/backend/src/identity/application/auth.service.spec.ts +72 -0
  26. package/boilerplates/02-saas-starter/backend/src/identity/application/auth.service.ts +63 -0
  27. package/boilerplates/02-saas-starter/backend/src/identity/domain/model.spec.ts +19 -0
  28. package/boilerplates/02-saas-starter/backend/src/identity/domain/model.ts +42 -0
  29. package/boilerplates/02-saas-starter/backend/src/identity/domain/password.spec.ts +17 -0
  30. package/boilerplates/02-saas-starter/backend/src/identity/domain/password.ts +26 -0
  31. package/boilerplates/02-saas-starter/backend/src/identity/identity.module.ts +12 -0
  32. package/boilerplates/02-saas-starter/backend/src/main.ts +19 -19
  33. package/boilerplates/02-saas-starter/backend/src/platform/auth/jwt-auth.guard.ts +17 -0
  34. package/boilerplates/02-saas-starter/backend/src/platform/auth/principal.ts +22 -0
  35. package/boilerplates/02-saas-starter/backend/src/platform/auth/roles.guard.spec.ts +23 -0
  36. package/boilerplates/02-saas-starter/backend/src/platform/auth/roles.guard.ts +20 -0
  37. package/boilerplates/02-saas-starter/backend/src/platform/auth/token.service.ts +54 -0
  38. package/boilerplates/02-saas-starter/backend/src/platform/config.spec.ts +18 -0
  39. package/boilerplates/02-saas-starter/backend/src/platform/config.ts +33 -0
  40. package/boilerplates/02-saas-starter/backend/src/platform/platform.module.ts +14 -0
  41. package/boilerplates/02-saas-starter/backend/tsconfig.build.json +6 -0
  42. package/boilerplates/02-saas-starter/backend/tsconfig.json +16 -21
  43. package/boilerplates/02-saas-starter/backend/vitest.config.ts +7 -0
  44. package/boilerplates/02-saas-starter/boilerplate.manifest.json +19 -14
  45. package/boilerplates/02-saas-starter/docker-compose.yml +10 -24
  46. package/boilerplates/02-saas-starter/memory/30-domains/billing/context.md +15 -132
  47. package/boilerplates/02-saas-starter/memory/30-domains/identity/context.md +20 -0
  48. package/boilerplates/README.md +9 -10
  49. package/dist/bin/create-memory-nest-kit.js +0 -0
  50. package/dist/bin/forja.js +0 -0
  51. package/dist/bin/init-project.js +1 -0
  52. package/dist/lib/core/journey.js +10 -0
  53. package/dist/lib/generators/memory-generator.d.ts +0 -11
  54. package/dist/lib/generators/memory-generator.js +5 -161
  55. package/dist/lib/generators/readme-generator.js +1 -1
  56. package/dist/lib/llm/json-output.d.ts +14 -0
  57. package/dist/lib/llm/json-output.js +77 -0
  58. package/dist/lib/project-upgrade.d.ts +0 -4
  59. package/dist/lib/project-upgrade.js +19 -1
  60. package/dist/lib/project-wiring.d.ts +8 -0
  61. package/dist/lib/project-wiring.js +74 -2
  62. package/dist/lib/validators/structure-validator.js +0 -1
  63. package/dist/packages/llm/src/index.js +12 -2
  64. package/dist/scripts/llm-fit.js +23 -1
  65. package/dist/scripts/project-upgrade.js +9 -6
  66. package/docs/init-project.md +1 -1
  67. package/docs/llm-fit-loop.md +16 -0
  68. package/memory/90-decisions/0086-projeto-conectado-e-jornada-como-gate.md +1 -1
  69. package/memory/90-decisions/0088-templates-validados.md +3 -0
  70. package/memory/90-decisions/0089-skills-do-projeto.md +51 -0
  71. package/memory/90-decisions/0090-adapters-de-agente-somente-leitura.md +47 -0
  72. package/package.json +2 -2
  73. package/specs/skills-do-projeto/plan.md +40 -0
  74. package/specs/skills-do-projeto/spec.md +63 -0
  75. package/specs/skills-do-projeto/tasks.md +27 -0
  76. package/templates/project/AGENTS.md +9 -0
  77. package/templates/project/agents/context-engineer.md +3 -0
  78. package/templates/project/agents/governance.md +3 -0
  79. package/templates/project/agents/marketing.md +3 -0
  80. package/templates/project/agents/orchestrator.md +3 -0
  81. package/templates/project/agents/product.md +3 -0
  82. package/templates/project/agents/sdd-architect.md +3 -0
  83. package/templates/project/skills/README.md +14 -0
  84. package/templates/project/skills/accessibility-review/SKILL.md +89 -0
  85. package/templates/project/skills/api-design/SKILL.md +77 -0
  86. package/templates/project/skills/architecture-decision-record/SKILL.md +92 -0
  87. package/templates/project/skills/backlog-slicing/SKILL.md +82 -0
  88. package/templates/project/skills/bounded-context-mapping/SKILL.md +88 -0
  89. package/templates/project/skills/ci-pipeline-review/SKILL.md +83 -0
  90. package/templates/project/skills/commit-message/SKILL.md +143 -0
  91. package/templates/project/skills/data-migrations/SKILL.md +88 -0
  92. package/templates/project/skills/dependency-upgrade/SKILL.md +75 -0
  93. package/templates/project/skills/docker-compose-review/SKILL.md +85 -0
  94. package/templates/project/skills/domain-modeling/SKILL.md +120 -0
  95. package/templates/project/skills/event-storming/SKILL.md +95 -0
  96. package/templates/project/skills/executive-writing/SKILL.md +99 -0
  97. package/templates/project/skills/frontend-architecture/SKILL.md +97 -0
  98. package/templates/project/skills/incident-postmortem/SKILL.md +93 -0
  99. package/templates/project/skills/lgpd-compliance/SKILL.md +108 -0
  100. package/templates/project/skills/llm-provider-routing/SKILL.md +18 -0
  101. package/templates/project/skills/observability/SKILL.md +93 -0
  102. package/templates/project/skills/product-evaluation/SKILL.md +130 -0
  103. package/templates/project/skills/prompt-spec/SKILL.md +83 -0
  104. package/templates/project/skills/pull-request/SKILL.md +101 -0
  105. package/templates/project/skills/query-performance/SKILL.md +83 -0
  106. package/templates/project/skills/release-checklist/SKILL.md +106 -0
  107. package/templates/project/skills/release-notes/SKILL.md +87 -0
  108. package/templates/project/skills/requirements-elicitation/SKILL.md +127 -0
  109. package/templates/project/skills/requirements-gathering/SKILL.md +134 -0
  110. package/templates/project/skills/technical-spike/SKILL.md +101 -0
  111. package/templates/project/skills/testing/SKILL.md +109 -0
  112. package/templates/project/skills/threat-modeling/SKILL.md +87 -0
  113. package/templates/project/skills/ts-async-patterns/SKILL.md +101 -0
  114. package/templates/project/skills/ts-code-review/SKILL.md +121 -0
  115. package/templates/project/skills/ts-module-layout/SKILL.md +104 -0
  116. package/templates/project/skills/ts-testing/SKILL.md +89 -0
  117. package/templates/project/skills/web-performance/SKILL.md +72 -0
  118. package/boilerplates/02-saas-starter/.env.example +0 -25
  119. package/boilerplates/02-saas-starter/CHECKLIST-CRIACAO.md +0 -190
  120. package/boilerplates/02-saas-starter/INFO.md +0 -252
  121. package/boilerplates/02-saas-starter/QUICK_START.md +0 -194
  122. package/boilerplates/02-saas-starter/START-HERE.md +0 -259
  123. package/boilerplates/02-saas-starter/backend/src/common/decorators/roles.decorator.ts +0 -3
  124. package/boilerplates/02-saas-starter/backend/src/common/decorators/tenant.decorator.ts +0 -6
  125. package/boilerplates/02-saas-starter/backend/src/common/middleware/roles.guard.ts +0 -23
  126. package/boilerplates/02-saas-starter/backend/src/config/database.ts +0 -26
  127. package/boilerplates/02-saas-starter/backend/src/modules/auth/auth.controller.ts +0 -46
  128. package/boilerplates/02-saas-starter/backend/src/modules/auth/auth.module.ts +0 -25
  129. package/boilerplates/02-saas-starter/backend/src/modules/auth/auth.service.ts +0 -145
  130. package/boilerplates/02-saas-starter/backend/src/modules/auth/dto/auth.dto.ts +0 -30
  131. package/boilerplates/02-saas-starter/backend/src/modules/auth/strategies/jwt.strategy.ts +0 -24
  132. package/boilerplates/02-saas-starter/backend/src/modules/auth/strategies/local.strategy.ts +0 -19
  133. package/boilerplates/02-saas-starter/backend/src/modules/billing/billing.controller.ts +0 -42
  134. package/boilerplates/02-saas-starter/backend/src/modules/billing/billing.module.ts +0 -13
  135. package/boilerplates/02-saas-starter/backend/src/modules/billing/billing.service.ts +0 -67
  136. package/boilerplates/02-saas-starter/backend/src/modules/billing/entities/invoice.entity.ts +0 -52
  137. package/boilerplates/02-saas-starter/backend/src/modules/organizations/entities/organization.entity.ts +0 -36
  138. package/boilerplates/02-saas-starter/backend/src/modules/organizations/organizations.controller.ts +0 -16
  139. package/boilerplates/02-saas-starter/backend/src/modules/organizations/organizations.module.ts +0 -13
  140. package/boilerplates/02-saas-starter/backend/src/modules/organizations/organizations.service.ts +0 -34
  141. package/boilerplates/02-saas-starter/backend/src/modules/subscriptions/entities/subscription.entity.ts +0 -40
  142. package/boilerplates/02-saas-starter/backend/src/modules/subscriptions/subscriptions.controller.ts +0 -36
  143. package/boilerplates/02-saas-starter/backend/src/modules/subscriptions/subscriptions.module.ts +0 -13
  144. package/boilerplates/02-saas-starter/backend/src/modules/subscriptions/subscriptions.service.ts +0 -91
  145. package/boilerplates/02-saas-starter/backend/src/modules/users/entities/user.entity.ts +0 -42
  146. package/boilerplates/02-saas-starter/backend/src/modules/users/users.controller.ts +0 -14
  147. package/boilerplates/02-saas-starter/backend/src/modules/users/users.module.ts +0 -13
  148. package/boilerplates/02-saas-starter/backend/src/modules/users/users.service.ts +0 -48
  149. package/boilerplates/02-saas-starter/memory/00-global/agent-contract.md +0 -227
  150. package/boilerplates/02-saas-starter/memory/00-global/context-policy.md +0 -141
  151. package/boilerplates/02-saas-starter/memory/00-global/index.md +0 -133
  152. package/boilerplates/02-saas-starter/memory/00-global/mission.md +0 -45
  153. package/boilerplates/02-saas-starter/memory/00-global/patterns.md +0 -223
  154. package/boilerplates/02-saas-starter/memory/10-product/business-rules.md +0 -240
  155. package/boilerplates/02-saas-starter/memory/10-product/nfrs.md +0 -239
  156. package/boilerplates/02-saas-starter/memory/10-product/personas.md +0 -195
  157. package/boilerplates/02-saas-starter/memory/10-product/vision.md +0 -63
  158. package/boilerplates/02-saas-starter/memory/20-architecture/overview.md +0 -232
  159. package/boilerplates/02-saas-starter/memory/30-domains/auth/api.md +0 -186
  160. package/boilerplates/02-saas-starter/memory/30-domains/auth/context.md +0 -85
  161. package/boilerplates/02-saas-starter/memory/30-domains/billing/api.md +0 -262
  162. package/boilerplates/02-saas-starter/memory/30-domains/subscriptions/api.md +0 -176
  163. package/boilerplates/02-saas-starter/memory/30-domains/subscriptions/context.md +0 -100
  164. package/boilerplates/02-saas-starter/memory/40-delivery/backlog.md +0 -81
  165. package/boilerplates/02-saas-starter/memory/40-delivery/roadmap.md +0 -97
  166. package/boilerplates/02-saas-starter/memory/40-delivery/sprint-atual.md +0 -57
  167. package/boilerplates/02-saas-starter/memory/50-orchestration/topology.md +0 -90
  168. package/boilerplates/02-saas-starter/memory/60-runs/index.md +0 -54
  169. package/boilerplates/02-saas-starter/memory/70-summaries/global.md +0 -50
  170. package/boilerplates/02-saas-starter/memory/80-data/schema.md +0 -185
  171. package/boilerplates/02-saas-starter/memory/90-decisions/adr-template.md +0 -75
@@ -1,239 +0,0 @@
1
- # NFRs - Non-Functional Requirements
2
-
3
- ## 1. Performance
4
-
5
- ### Response Times (p99)
6
-
7
- | Endpoint | Target |
8
- |----------|--------|
9
- | /api/auth/login | < 200ms |
10
- | /api/subscriptions | < 150ms |
11
- | /api/billing | < 300ms |
12
- | /api/users | < 100ms |
13
- | Health check | < 50ms |
14
-
15
- ### Database Query Performance
16
-
17
- - Simple queries: < 50ms
18
- - Complex queries (joins): < 200ms
19
- - Aggregations: < 1s
20
- - Indexes: On every foreign key + filtering column
21
-
22
- ### Throughput
23
-
24
- - 1000 concurrent users: No degradation
25
- - 10k requests/min: No errors
26
- - Database connections: Pool of 20 (adjust per load test)
27
- - Cache hit rate: > 80% for subscription data
28
-
29
- ---
30
-
31
- ## 2. Scalability
32
-
33
- ### Horizontal Scaling
34
-
35
- - Stateless API: Deploy multiple instances
36
- - Load balancer: Round-robin or sticky sessions
37
- - Cache layer: Redis for session/subscription data
38
- - Database: Single PostgreSQL, upgrade to RDS eventually
39
-
40
- ### Database Scaling Strategy
41
-
42
- **Phase 1** (0-100k users): Single PostgreSQL instance
43
- **Phase 2** (100k-1M users): RDS Multi-AZ + read replicas
44
- **Phase 3** (1M+ users): Sharding by tenant_id
45
-
46
- ### Vertical Scaling Limits
47
-
48
- - Memory: Start with 2GB, monitor
49
- - CPU: Start with 2 cores, scale to 8
50
- - Disk: Start with 100GB, add SSD
51
-
52
- ---
53
-
54
- ## 3. Reliability & Availability
55
-
56
- ### Uptime Target
57
-
58
- - Production: 99.9% SLA (43 min downtime/month)
59
- - Staging: 95% (no SLA)
60
- - Development: No guarantee
61
-
62
- ### Fault Tolerance
63
-
64
- - Database failure: Immediate alert, manual failover
65
- - API failure: Health check detects in 30s, auto-restart
66
- - Payment gateway failure: Retry logic + fallback to mock
67
- - Cache failure: Graceful degradation, no cache needed
68
-
69
- ### Error Recovery
70
-
71
- - Transient errors (500): Retry 3x with exponential backoff
72
- - Permanent errors (400): Fail immediately, log for debugging
73
- - Timeout: 30s default, 60s for webhooks
74
-
75
- ### Data Durability
76
-
77
- - Database backups: Daily, retained 30 days
78
- - WAL archiving: Enabled
79
- - Recovery: Restore to 24h ago in <30min
80
- - RPO (Recovery Point Objective): 1 day
81
- - RTO (Recovery Time Objective): 30 minutes
82
-
83
- ---
84
-
85
- ## 4. Security
86
-
87
- ### Threat Vectors & Mitigations
88
-
89
- | Threat | Mitigation | Implemented |
90
- |--------|-----------|-----------|
91
- | SQL Injection | Parameterized queries (Typeorm ORM) | ✅ |
92
- | XSS | CSP headers, input validation | 🚧 |
93
- | CSRF | JWT (stateless), no session cookies | ✅ |
94
- | Brute force | Rate limiting 100 req/sec | 🚧 |
95
- | Man-in-the-middle | TLS 1.3, HSTS | 🚧 |
96
- | Privilege escalation | RBAC, JWT validation | ✅ |
97
- | Data breach | Encryption in transit, PII redaction | ✅ |
98
- | Denial of service | Rate limiting, query timeouts | 🚧 |
99
-
100
- ### Cryptography
101
-
102
- - Password hashing: bcrypt, cost=12
103
- - JWT signing: HS256, secret from env
104
- - Token rotation: No (JWT is stateless)
105
- - API keys: SHA-256 hash in database
106
- - Secrets in env: Never in code or git
107
-
108
- ### Authentication & Authorization
109
-
110
- - Multi-factor auth: Not in MVP (hook for future)
111
- - Session timeout: 15 min (access token)
112
- - Password reset: Email link, 24h expiry
113
- - Account lockout: After 5 failed attempts (15 min)
114
-
115
- ---
116
-
117
- ## 5. Maintainability
118
-
119
- ### Code Quality
120
-
121
- - Language: TypeScript strict mode (no `any`)
122
- - Linting: ESLint + Prettier, enforced in CI
123
- - Testing: Unit (50%+), E2E (30%+), Coverage >60%
124
- - Code reviews: Every PR requires 1 approval
125
- - Documentation: JSDoc on public methods
126
-
127
- ### Deployment
128
-
129
- - CI/CD: GitHub Actions
130
- - Deployment: Blue-green or canary
131
- - Rollback: Automatic on health check failure
132
- - Configuration: 12-factor app (env vars only)
133
-
134
- ### Observability
135
-
136
- - Logging: JSON, structured logging with levels
137
- - Metrics: Prometheus scrape endpoint
138
- - Tracing: OpenTelemetry hooks (not mandatory)
139
- - Monitoring: Alert on >1% error rate
140
-
141
- ### Version Control
142
-
143
- - Git flow: main (prod) ← staging ← feature branches
144
- - Commit messages: Conventional commits
145
- - Tags: Semantic versioning (v1.0.0)
146
- - Release notes: Changelog per version
147
-
148
- ---
149
-
150
- ## 6. Compliance
151
-
152
- ### Regulatory
153
-
154
- - GDPR: Compliant (data export, deletion, consent)
155
- - CCPA: Compliant (opt-out, data requests)
156
- - SOC2 Type I: Audit trail, access controls
157
- - HIPAA: Not required for MVP
158
-
159
- ### Data Protection
160
-
161
- - Data at rest: Application-level encryption (not DB encryption)
162
- - Data in transit: TLS 1.3 mandatory
163
- - PII classification: Email, password, name
164
- - Retention: 90 days for logs, 1 year for deleted orgs
165
-
166
- ### Audit & Logging
167
-
168
- - User actions: Logged (create, update, delete)
169
- - Admin actions: Logged with timestamp + user
170
- - Failed auth: Logged but rate-limited (prevent log spam)
171
- - Access patterns: No personal data, just metrics
172
-
173
- ---
174
-
175
- ## 7. Usability
176
-
177
- ### Developer Experience
178
-
179
- - Setup time: < 10 minutes
180
- - Deploy time: < 5 minutes
181
- - Learning curve: Existing NestJS developers +1 day
182
- - Error messages: Clear, actionable, no stack traces in production
183
-
184
- ### API Usability
185
-
186
- - Consistency: RESTful with HTTP verbs
187
- - Discoverability: Swagger/OpenAPI docs
188
- - Error handling: Standard HTTP status codes + error codes
189
- - Pagination: Limit + offset, max 100 items
190
- - Filtering: Query params, escapable
191
-
192
- ### Documentation
193
-
194
- - README: Quick start, examples, architecture
195
- - API docs: Swagger endpoint at /api/docs
196
- - Patterns: memory/00-global/patterns.md
197
- - Examples: Postman collection provided
198
-
199
- ---
200
-
201
- ## 8. Cost Optimization
202
-
203
- ### Infrastructure
204
-
205
- - Database: PostgreSQL (cheaper than DynamoDB)
206
- - Cache: Redis (cheaper than ElastiCache for small scale)
207
- - CDN: Not needed (API only)
208
- - Monitoring: Open-source tools (Prometheus, Grafana)
209
-
210
- ### Development
211
-
212
- - No vendor lock-in (can migrate to AWS/GCP/Azure)
213
- - OSS stack: NestJS, Typeorm, Jest (no expensive licenses)
214
- - Cost tracking: Budget alerts in cloud provider
215
-
216
- ---
217
-
218
- ## 9. Cross-Cutting Concerns
219
-
220
- ### Monitoring & Alerting
221
-
222
- - CPU > 80%: Scale up
223
- - Memory > 85%: Investigate leak
224
- - Error rate > 1%: Page on-call
225
- - Database connections > 18/20: Page on-call
226
- - Response time p99 > 1s: Investigate
227
-
228
- ### Incident Response
229
-
230
- - Severity 1 (total outage): 15 min response
231
- - Severity 2 (partial outage): 1 hour response
232
- - Severity 3 (degradation): 4 hours response
233
- - Severity 4 (minor issue): Next business day
234
-
235
- ### SLA Remedies
236
-
237
- - 99.5-99.9%: 10% credit
238
- - 99-99.5%: 25% credit
239
- - <99%: 50% credit (or full refund)
@@ -1,195 +0,0 @@
1
- # Personas
2
-
3
- ## 1. Sarah — SaaS Founder
4
-
5
- **Perfil**
6
- - Age: 32, Tech co-founder
7
- - Background: Full-stack engineer, 2 startups anteriores
8
- - Pain: "Não quero gastar 6 meses em infrastructure"
9
- - Goal: Lançar em produção em 4 semanas
10
-
11
- **Needs**
12
- - Autenticação que funciona out-of-box
13
- - Subscriptions com planos escaláveis
14
- - Multi-tenant architecture
15
- - Documentação clara
16
- - TypeScript (evitar bugs)
17
-
18
- **Success Metric**
19
- - Implementou 3 planos
20
- - 10 clientes beta
21
- - Churn < 5%
22
-
23
- ---
24
-
25
- ## 2. Dev — Backend Engineer
26
-
27
- **Perfil**
28
- - Age: 28, Senior backend engineer
29
- - Background: 5 anos Node.js + NestJS
30
- - Pain: "Não quero ver mais boilerplates ruins"
31
- - Goal: Código limpo, patterns claros, fácil manutenção
32
-
33
- **Needs**
34
- - Patterns SOLID applicados
35
- - Dependency injection funcionando
36
- - Tests E2E que fazem sentido
37
- - Modular, fácil de estender
38
- - Memory/context bem documentada
39
-
40
- **Success Metric**
41
- - Adicionou 2 novos domínios (messaging, analytics)
42
- - 0 bugs em produção
43
- - Contribui PRs de volta
44
-
45
- ---
46
-
47
- ## 3. Ops — DevOps Engineer
48
-
49
- **Perfil**
50
- - Age: 31, Platform engineer
51
- - Background: Kubernetes, Terraform, observability
52
- - Pain: "Quero infra como código, não setup manual"
53
- - Goal: Deploy automatizado, observável, resiliente
54
-
55
- **Needs**
56
- - Docker-compose funcional
57
- - Env vars documentadas
58
- - Health checks implementados
59
- - Logging estruturado (JSON)
60
- - Prometheus metrics
61
- - Error tracking hooks
62
-
63
- **Success Metric**
64
- - Deploy em <5 mins
65
- - Uptime > 99.9%
66
- - Issue detection < 5min from error
67
-
68
- ---
69
-
70
- ## 4. PM — Product Manager
71
-
72
- **Perfil**
73
- - Age: 29, Fintech PM
74
- - Background: Produto, não técnico
75
- - Pain: "Não entendo o código, mas preciso trackear features"
76
- - Goal: Dashboard de features, roadmap claro, metrics
77
-
78
- **Needs**
79
- - Memory/roadmap.md atualizado
80
- - Métricas de negócio (MRR, churn)
81
- - Feature flags (on/off sem deploy)
82
- - User behavior tracking
83
- - Relatórios automáticos
84
-
85
- **Success Metric**
86
- - Roadmap 3 meses planejado
87
- - Decision-making em <1 dia
88
- - Feature adoption tracking
89
-
90
- ---
91
-
92
- ## 5. Compliance — Security Officer
93
-
94
- **Perfil**
95
- - Age: 45, Compliance officer
96
- - Background: Banking, healthcare
97
- - Pain: "Preciso de audit trails e GDPR compliance"
98
- - Goal: Segurança, compliance, sem falsos positivos
99
-
100
- **Needs**
101
- - JWT + MFA ready (hooks)
102
- - Tenant isolation garantida
103
- - Audit logging completo
104
- - Data export (GDPR)
105
- - Encryption at rest (hooks)
106
- - PII redaction em logs
107
-
108
- **Success Metric**
109
- - SOC2 readiness check: ✅
110
- - 0 security issues em audit
111
- - Compliance dashboard
112
-
113
- ---
114
-
115
- ## User Journey Map: Sarah (Founder)
116
-
117
- ```
118
- Day 0: Descobre SaaS Starter
119
- → Lê README
120
- → Vê que tem auth + subscriptions
121
- → Decision: "Vou tentar"
122
-
123
- Day 1: Setup
124
- → Clone repo
125
- → docker-compose up
126
- → npm run seed
127
- → Tests passam ✅
128
- → Decision: "Funciona!"
129
-
130
- Days 2-3: Customização
131
- → Estuda patterns.md
132
- → Adiciona 3º plano customizado
133
- → Cria 2 novos endpoints
134
- → Tests continuam passando ✅
135
- → Decision: "Posso fazer"
136
-
137
- Days 4-7: Integração
138
- → Integra frontend
139
- → Testa flow signup → upgrade
140
- → Deploy em staging
141
- → QA aprova
142
- → Decision: "Produção amanhã"
143
-
144
- Week 2: Produção
145
- → Deploy em prod
146
- → 5 clientes criados
147
- → Monitor metrics
148
- → 1 bug encontrado, fix in 30min
149
- → Success: "É rápido e fácil"
150
- ```
151
-
152
- ---
153
-
154
- ## Feature Prioritization (por persona)
155
-
156
- | Feature | Sarah | Dev | Ops | PM | Compliance |
157
- |---------|-------|-----|-----|----|----|
158
- | JWT Auth | 🔴 | 🟡 | 🟢 | 🟢 | 🔴 |
159
- | Subscriptions | 🔴 | 🟡 | 🟢 | 🔴 | 🟢 |
160
- | Mock Billing | 🔴 | 🟢 | 🟢 | 🟡 | 🟡 |
161
- | Multi-tenant | 🟡 | 🔴 | 🟢 | 🟡 | 🔴 |
162
- | E2E Tests | 🟡 | 🟡 | 🟢 | 🟢 | 🟢 |
163
- | Observability | 🟢 | 🟡 | 🔴 | 🟢 | 🟡 |
164
- | Memory/Docs | 🟡 | 🔴 | 🟢 | 🔴 | 🟢 |
165
-
166
- 🔴 = Critical | 🟡 = Important | 🟢 = Nice to have
167
-
168
- ---
169
-
170
- ## Usage Scenarios
171
-
172
- ### Scenario 1: SaaS Founder Launch
173
- ```
174
- Week 1: Setup + customize plans
175
- Week 2: Frontend integration
176
- Week 3: QA + staging
177
- Week 4: Production launch
178
- → 4 weeks to first revenue
179
- ```
180
-
181
- ### Scenario 2: Enterprise Team
182
- ```
183
- Day 1: Setup
184
- Day 2-5: Architecture review + customization
185
- Week 2-4: Integration with existing systems
186
- → 3 weeks to production-ready
187
- ```
188
-
189
- ### Scenario 3: Freelancer/Agency
190
- ```
191
- Day 1: Understand patterns
192
- Days 2-5: Extend for client
193
- Week 2: Deploy for client
194
- → Invoice client, 40 hours billable
195
- ```
@@ -1,63 +0,0 @@
1
- # Visão do Produto
2
-
3
- ## Elevator Pitch
4
-
5
- **SaaS Starter** é uma plataforma de gestão de subscriptions SaaS com:
6
- - Autenticação JWT + multi-tenant
7
- - Planos flexíveis (free, pro, enterprise)
8
- - Billing mock Stripe-like
9
- - RBAC completo
10
- - Pronto para produção
11
-
12
- ## Proposição de Valor
13
-
14
- | Valor | Descrição |
15
- |-------|-----------|
16
- | **Time to Market** | Deploy em 1 semana, não 3 meses |
17
- | **Segurança** | JWT + RBAC + Tenant isolation out-of-box |
18
- | **Escalabilidade** | PostgreSQL + Redis, pronto para 100k+ users |
19
- | **Developer Experience** | TypeScript + NestJS + tipos fortes |
20
- | **Production Ready** | E2E tests, error handling, observability |
21
-
22
- ## Diferencial Competitivo
23
-
24
- 1. **Boilerplate vs Plataforma**: Fornecemos código customizável, não SaaS locked-in
25
- 2. **Multi-tenant First**: Desde o início, não retrofitted
26
- 3. **Agent-Ready**: Orquestração de agentes IA como cidadão de primeira classe
27
- 4. **Documentation as Code**: Memory levels vs wikis desatualizados
28
-
29
- ## 12-Month Vision
30
-
31
- | Trimestre | Objetivo | Métricas |
32
- |-----------|----------|---------|
33
- | Q1 (Agora) | MVP multi-tenant com auth + subscriptions | 3 módulos, 80+ E2E tests |
34
- | Q2 | Billing real (Stripe), webhooks | 0 payment fails, <1% churn |
35
- | Q3 | Analytics & observability | Dashboards, <100ms p99 latency |
36
- | Q4 | Compliance (SOC2, GDPR) | Audit trails, data export |
37
-
38
- ## Limites Declarados
39
-
40
- **Este boilerplate NÃO inclui:**
41
- - Frontend (React/Vue/etc — você escolhe)
42
- - Email delivery (apenas templates)
43
- - SMS (integração Twilio você faz)
44
- - Storage (S3, apenas clients)
45
- - Mobile SDK
46
-
47
- **Por quê?** Manter scaffold enxuto, focado em backend SaaS core.
48
-
49
- ## Sucesso =
50
-
51
- Um novo SaaS pode:
52
- 1. ✅ Clonar repo
53
- 2. ✅ `npm install && docker-compose up`
54
- 3. ✅ `npm run seed` (data de teste)
55
- 4. ✅ `npm test` (verde)
56
- 5. ✅ `npm run start:dev`
57
- 6. ✅ Fazer POST /api/auth/signup
58
- 7. ✅ Upgrade plan em /api/subscriptions
59
- 8. ✅ Ver mock payment em /api/billing
60
- 9. ✅ Deploy em staging
61
- 10. ✅ Customizar conforme necessário
62
-
63
- Tudo em **< 2 horas**.