Back to blocks
Finanças a Dois: React + Firebase
4.0
ptDesenvolvimento de AplicativosReactFirebaseClean ArchitectureFinançasGestão de Gastos
Prompt
Gerar um aplicativo react + Firebase (Clean Architecture) chamado “Finanças a Dois”, para o casal acompanhar contas pagas e a pagar, metas de gastos/poupança e gestão de empréstimos, com projeção anual e alertas inteligentes.
PILARES DE NEGÓCIO
1. Visão clara do fluxo de caixa mensal (valor pago vs. pendente).
2. Automação de despesas fixas e lembretes.
3. Decisão orientada sobre quitar ou amortizar empréstimos.
4. Experiência colaborativa (dois usuários na mesma “casa”).
STACK TÉCNICO
- Flutter 3.22 (Material 3, `Riverpod`, `go_router`, `intl`)
- Firebase
- Auth (e-mail/senha) + deep-link convite de casal
- Firestore (coleções descritas abaixo)
- Cloud Functions (Node 20)
- Cloud Storage (comprovantes)
- FCM (push lembretes)
- CI/CD: GitHub Actions → Firebase App Distribution
MODELOS FIRESTORE
- `/households/{hid}` → { name, createdAt, memberIds[] }
- `/users/{uid}` → perfil, notificationPrefs, householdId
- `/bills/{hid}/{yyyyMM}/{billId}`
{ title, amount, category, dueDate, recurrence, status, paidAt, paymentMethod{bank,channel}, attachmentUrl }
- `/recurringTemplates/{hid}/{templateId}`
{ title, amount, category, dueDay, paymentMethod, active, createdAt }
- `/goals/{hid}/{goalId}`
{ type:SAVINGS|DEBT, title, targetAmount, currentAmount, deadline }
- `/loans/{hid}/{loanId}`
{ title, principal, interestRateAnnual, termMonths, startDate, paymentDay, paidPrincipal, paidInterest, nextDueDate, remainingInstallments, status }
- `/loanPayments/{hid}/{loanId}/{yyyyMM}/{id}`
{ installmentNumber, amountPrincipal, amountInterest, paidAt, paymentMethod, attachmentUrl }
- `/summaries/{hid}/{yyyyMM}` → { totalPaid, totalPending, updatedAt }
- `/projections/{hid}/{year}` → { monthTotals{“01”:val, …}, updatedAt }
CLOUD FUNCTIONS
1. recurringScheduler (Pub/Sub diário 00:10)
- Lê `/recurringTemplates` ativos e gera contas futuras em `/bills`.
2. monthlySummaryCache (Pub/Sub diário 00:30)
- Soma bills por status e grava em `/summaries`.
3. loanStatusUpdater (Pub/Sub diário 01:00)
- Marca empréstimos como OVERDUE se nextDueDate < hoje.
4. suggestEarlyPayoff (HTTPS Callable)
- Recebe loanId, calcula saldo devedor (Price/SAC), compara taxa × CDI líquido e retorna canPayoff, interestSaved.