Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 212 additions & 0 deletions PLAN_CRM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Plano: CRM de Mentoria

## Stack Definida
- **Frontend:** Next.js 14 (App Router)
- **Banco de dados:** Supabase (PostgreSQL)
- **UI:** Tailwind CSS + shadcn/ui (visual elaborado)
- **Drag & Drop:** `@dnd-kit/core` (kanban)
- **Notificações WhatsApp:** CallMeBot API (gratuito, pessoal) ou Twilio
- **Moeda:** R$ (BRL)
- **Acesso:** Solo user, local por enquanto

---

## Estrutura de Páginas

| Rota | Descrição |
|------|-----------|
| `/` | Dashboard com métricas |
| `/kanban` | Quadro Kanban com drag & drop |
| `/leads` | Lista/tabela com filtros e busca |
| `/leads/[id]` | Detalhe do lead + timeline + reuniões |
| `/settings` | Configurar estágios, produtos, origens |

---

## Schema do Banco de Dados (Supabase)

### Tabela `stages`
```sql
- id (uuid, PK)
- name (text) — ex: "Primeiro Contato"
- color (text) — cor hex para o kanban
- order (int) — ordem no kanban
- type (enum: 'normal' | 'won' | 'lost') — para lógica de "Fechado" e "Perdido"
- created_at (timestamp)
```

### Tabela `products`
```sql
- id (uuid, PK)
- name (text) — ex: "Mentoria 3 meses"
- price (numeric) — valor padrão
- description (text, nullable)
- active (boolean)
- created_at (timestamp)
```

### Tabela `sources`
```sql
- id (uuid, PK)
- name (text) — ex: "Instagram", "Indicação", "YouTube"
- created_at (timestamp)
```

### Tabela `leads`
```sql
- id (uuid, PK)
- name (text)
- phone (text)
- email (text, nullable)
- stage_id (uuid, FK → stages)
- source_id (uuid, FK → sources, nullable)
- product_id (uuid, FK → products, nullable)
- proposal_value (numeric, nullable) — R$
- payment_method (text, nullable) — ex: "3x R$ 500"
- notes (text, nullable) — campo livre adicional
- created_at (timestamp)
- updated_at (timestamp)
```

### Tabela `meetings`
```sql
- id (uuid, PK)
- lead_id (uuid, FK → leads)
- title (text)
- date (date)
- time (time)
- link (text, nullable) — link Zoom/Meet
- notified (boolean) — se a notificação WhatsApp foi enviada
- created_at (timestamp)
```

### Tabela `interactions` (timeline)
```sql
- id (uuid, PK)
- lead_id (uuid, FK → leads)
- type (enum: 'note' | 'stage_change' | 'meeting' | 'proposal')
- content (text)
- created_at (timestamp)
```

---

## Estágios Iniciais (seed)
1. **Primeiro Contato** — cor azul claro, type: normal
2. **Sessão de Diagnóstico** — cor amarelo, type: normal
3. **Criação de Proposta** — cor laranja, type: normal
4. **Proposta Enviada** — cor roxo, type: normal
5. **Fechado** — cor verde, type: won
6. **Não Fechado / Perdido** — cor vermelho/cinza, type: lost

---

## Funcionalidades por Página

### Dashboard (`/`)
- Cards de métricas:
- Total de leads ativos
- Leads por estágio (barra/donut chart)
- Valor total em proposta (R$)
- Taxa de conversão (Fechados / Total)
- Reuniões das próximas 7 dias
- Lista rápida de próximas reuniões

### Kanban (`/kanban`)
- Colunas por estágio com cores
- Cards de lead: nome, telefone, valor proposta, próxima reunião
- Drag & drop entre colunas (atualiza estágio no banco)
- Ao mudar de estágio, registra na timeline do lead
- Botão para adicionar lead direto no kanban

### Lista de Leads (`/leads`)
- Tabela com: nome, telefone, estágio, próxima reunião, valor, origem
- Busca por nome/telefone/email
- Filtros: por estágio, por origem, por produto
- Ordenação por data de criação / próxima reunião
- Botão "Novo Lead"

### Detalhe do Lead (`/leads/[id]`)
- Formulário de edição dos dados do lead
- Seletor de estágio
- Seção de proposta: produto, valor, forma de pagamento
- Seção de próxima reunião: data, horário, link + botão de notificação WhatsApp
- Timeline de interações (histórico de notas, mudanças de estágio, reuniões)
- Adicionar nota/interação manualmente

### Configurações (`/settings`)
- Gerenciar estágios (nome, cor, ordem) — add/edit/reorder/delete
- Gerenciar produtos (nome, valor padrão, descrição)
- Gerenciar origens de leads
- Configurar número WhatsApp para notificações

---

## Notificações WhatsApp
- **Solução:** CallMeBot (API gratuita para uso pessoal)
- O usuário se cadastra uma vez no CallMeBot com seu WhatsApp
- Recebe uma API key
- O sistema envia alertas HTTP para reuniões com menos de 24h
- **Trigger:** Cron job via Next.js API Route + Vercel Cron / ou roda local com `node-cron`
- **Mensagem exemplo:** "📅 Lembrete: Reunião com João Silva amanhã às 15h - [link Meet]"

---

## Ordem de Implementação

### Fase 1 — Base
1. Setup Next.js 14 + Supabase + Tailwind + shadcn/ui
2. Schema do banco + seed dos estágios iniciais
3. Autenticação básica (single user com Supabase Auth)

### Fase 2 — CRUD de Leads
4. Página de lista de leads com filtros/busca
5. Formulário de criação/edição de lead
6. Página de detalhe do lead
7. Timeline de interações

### Fase 3 — Kanban
8. Página Kanban com colunas por estágio
9. Drag & drop entre colunas
10. Registro automático de mudança de estágio na timeline

### Fase 4 — Dashboard
11. Métricas: totais, conversão, valor em proposta
12. Lista de próximas reuniões

### Fase 5 — Notificações e Configurações
13. Página de configurações (estágios, produtos, origens)
14. Integração com CallMeBot para WhatsApp
15. Cron job de lembretes de reuniões

---

## Estrutura de Diretórios (Next.js)

```
mentoria-crm/
├── app/
│ ├── (dashboard)/
│ │ └── page.tsx # Dashboard principal
│ ├── kanban/
│ │ └── page.tsx # Kanban
│ ├── leads/
│ │ ├── page.tsx # Lista de leads
│ │ └── [id]/
│ │ └── page.tsx # Detalhe do lead
│ ├── settings/
│ │ └── page.tsx # Configurações
│ └── api/
│ └── notify/
│ └── route.ts # API de notificação WhatsApp
├── components/
│ ├── kanban/ # Componentes do kanban
│ ├── leads/ # Componentes de leads
│ ├── dashboard/ # Componentes do dashboard
│ └── ui/ # shadcn/ui components
├── lib/
│ ├── supabase.ts # Client Supabase
│ └── whatsapp.ts # Integração CallMeBot
└── types/
└── index.ts # Tipos TypeScript
```
41 changes: 41 additions & 0 deletions mentoria-crm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
5 changes: 5 additions & 0 deletions mentoria-crm/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
<!-- END:nextjs-agent-rules -->
1 change: 1 addition & 0 deletions mentoria-crm/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
36 changes: 36 additions & 0 deletions mentoria-crm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
18 changes: 18 additions & 0 deletions mentoria-crm/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);

export default eslintConfig;
7 changes: 7 additions & 0 deletions mentoria-crm/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
Loading