feat: bootstrap b2bcall saas architecture

- monorepo skeleton (apps/, packages/, infrastructure/, scripts/, docs/)
- docker-compose with PostgreSQL 18 and Redis 7 (localhost-only)
- .gitignore and .env.example
- initial TODO.md and docs/ARCHITECTURE.md
This commit is contained in:
2026-08-27 23:12:29 -03:00
parent e79ad6e1be
commit 2f130622d1
8 changed files with 6638 additions and 0 deletions

51
docs/ARCHITECTURE.md Normal file
View File

@@ -0,0 +1,51 @@
# Arquitetura — B2BCall
SaaS multi-tenant de call center, discagem preditiva, telefonia, IA e billing.
Ver `agente.md` na raiz do projeto para a especificação completa.
## Stack
- **Backend**: Node.js, TypeScript, NestJS, Fastify
- **Frontend**: Next.js, React, TypeScript, Tailwind CSS, shadcn/ui
- **Banco**: PostgreSQL (18)
- **Cache/Jobs**: Redis + BullMQ
- **Telefonia**: FreeSWITCH
- **Reverse Proxy**: nginx
## Monorepo
```
apps/
frontend/ Next.js
api/ API principal (NestJS)
dialer-worker/ Predictive Dialer Engine
freeswitch-events/ Consumidor ESL (mod_event_socket)
freeswitch-config/ Provedor XML Curl (Directory/Dialplan)
scheduler/ Jobs agendados (callbacks, retenção, fechamento)
ai-worker/ Pipeline de transcrição/análise IA
billing-worker/ Rating Engine / fechamento mensal
packages/
database/ auth/ billing/ ai/ telephony/ shared/ types/ ui/
infrastructure/
docker/ freeswitch/ postgres/ redis/ nginx/
scripts/
docs/
```
## Servidor atual (ambiente de desenvolvimento)
- Debian 13 (trixie), kernel 6.12
- 2 vCPU, ~1.9GB RAM, ~26GB disco livre
- Hostname: `Lab-FSCore-RTPEngine` — sugere ambiente de laboratório, não produção
**Atenção**: a RAM disponível é baixa para rodar a stack completa (Postgres + Redis +
FreeSWITCH + workers Node + Next.js) ao mesmo tempo. Ver `TODO.md` para riscos e
recomendações antes de escalar para todos os serviços simultaneamente.
## Rede
Serviços de infraestrutura (Postgres, Redis) expostos apenas em `127.0.0.1`, nunca
publicamente, conforme seção 184 de `agente.md`.