- Setup NestJS with TypeScript, ConfigModule, JWT authentication - Implemented Auth Module with signup, login, logout endpoints - Created DTOs with validation (SignupDto, LoginDto) - JWT Strategy with Passport integration for token validation - JwtAuthGuard for route protection with Bearer tokens - CurrentUser decorator for dependency injection - Supabase integration for user management and auth - Complete API documentation (API.md) with all endpoints - Design System for Web (Next.js + Tailwind) and Mobile (Flutter) - Comprehensive project documentation and roadmap - Environment configuration with Joi schema validation - Ready for Tasks Module and RLS implementation
274 lines
6.3 KiB
Markdown
274 lines
6.3 KiB
Markdown
# 🚀 ROADMAP DE EXECUÇÃO - TASK MANAGER
|
|
|
|
**Data Início**: 1 de dezembro de 2025
|
|
**Status Atual**: Setup & Configuração
|
|
|
|
---
|
|
|
|
## 📊 Visão Geral do Progresso
|
|
|
|
```
|
|
Fase 1: Backend [████░░░░░░] 10%
|
|
Fase 2: Frontend [██░░░░░░░░] 5%
|
|
Fase 3: Mobile [░░░░░░░░░░] 0%
|
|
Fase 4: DevOps/Deploy [░░░░░░░░░░] 0%
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 FASE 1: BACKEND (NestJS + Supabase) - EM PROGRESSO
|
|
|
|
### Passo 1.1: Setup & Dependências ⏳
|
|
**Objetivo**: Preparar ambiente backend com todas as dependências críticas
|
|
|
|
**Tarefas**:
|
|
- [ ] Instalar Supabase SDK (`@supabase/supabase-js`)
|
|
- [ ] Instalar dotenv (`dotenv`)
|
|
- [ ] Instalar JWT (`@nestjs/jwt`, `@nestjs/passport`)
|
|
- [ ] Instalar TypeORM (opcional, Supabase usa PostgREST)
|
|
- [ ] Criar `.env.example`
|
|
- [ ] Estruturar pasta `src/` com módulos
|
|
|
|
**Dependências na package.json**:
|
|
```json
|
|
{
|
|
"@supabase/supabase-js": "^2.x",
|
|
"@nestjs/config": "^3.x",
|
|
"@nestjs/jwt": "^12.x",
|
|
"@nestjs/passport": "^10.x",
|
|
"passport": "^0.7.x",
|
|
"passport-jwt": "^4.x",
|
|
"dotenv": "^16.x",
|
|
"joi": "^17.x"
|
|
}
|
|
```
|
|
|
|
**Arquivos a criar/modificar**:
|
|
- `backend-api/.env.example`
|
|
- `backend-api/src/config/` (arquivos de configuração)
|
|
|
|
---
|
|
|
|
### Passo 1.2: Módulo de Autenticação 🔐
|
|
**Objetivo**: Implementar signup, login, logout com JWT
|
|
|
|
**Estrutura a criar**:
|
|
```
|
|
src/
|
|
├── auth/
|
|
│ ├── auth.module.ts
|
|
│ ├── auth.service.ts
|
|
│ ├── auth.controller.ts
|
|
│ ├── strategies/
|
|
│ │ └── jwt.strategy.ts
|
|
│ ├── guards/
|
|
│ │ └── jwt.guard.ts
|
|
│ └── dto/
|
|
│ ├── signup.dto.ts
|
|
│ └── login.dto.ts
|
|
├── users/
|
|
│ ├── users.module.ts
|
|
│ ├── users.service.ts
|
|
│ └── dto/
|
|
│ └── create-user.dto.ts
|
|
└── common/
|
|
└── decorators/
|
|
└── current-user.decorator.ts
|
|
```
|
|
|
|
**Endpoints**:
|
|
- `POST /auth/signup` - Registrar usuário
|
|
- `POST /auth/login` - Login
|
|
- `POST /auth/logout` - Logout
|
|
- `GET /auth/me` - Perfil atual (requer JWT)
|
|
|
|
---
|
|
|
|
### Passo 1.3: Módulo de Tarefas 📝
|
|
**Objetivo**: Implementar CRUD de tarefas com segurança (RLS)
|
|
|
|
**Estrutura a criar**:
|
|
```
|
|
src/
|
|
└── tasks/
|
|
├── tasks.module.ts
|
|
├── tasks.service.ts
|
|
├── tasks.controller.ts
|
|
└── dto/
|
|
├── create-task.dto.ts
|
|
└── update-task.dto.ts
|
|
```
|
|
|
|
**Endpoints**:
|
|
- `GET /tasks` - Listar tarefas do usuário
|
|
- `GET /tasks/:id` - Detalhes da tarefa
|
|
- `POST /tasks` - Criar tarefa
|
|
- `PATCH /tasks/:id` - Atualizar tarefa
|
|
- `DELETE /tasks/:id` - Deletar tarefa
|
|
|
|
---
|
|
|
|
### Passo 1.4: Implementar RLS (Supabase) 🔒
|
|
**Objetivo**: Configurar Row Level Security no banco
|
|
|
|
**SQL a executar**:
|
|
```sql
|
|
-- Tabela tasks (já deve existir em Auth do Supabase)
|
|
CREATE TABLE IF NOT EXISTS tasks (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
user_id UUID NOT NULL REFERENCES auth.users(id),
|
|
title TEXT NOT NULL,
|
|
description TEXT,
|
|
completed BOOLEAN DEFAULT FALSE,
|
|
created_at TIMESTAMP DEFAULT NOW(),
|
|
updated_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
-- RLS Policy: Usuário só acessa suas tarefas
|
|
ALTER TABLE tasks ENABLE ROW LEVEL SECURITY;
|
|
|
|
CREATE POLICY "Users can only access their own tasks"
|
|
ON tasks
|
|
FOR ALL
|
|
USING (auth.uid() = user_id)
|
|
WITH CHECK (auth.uid() = user_id);
|
|
```
|
|
|
|
---
|
|
|
|
### Passo 1.5: Documentação da API 📚
|
|
**Objetivo**: Documenta endpoints e respostas
|
|
|
|
**Arquivo**: `backend-api/API.md`
|
|
- Descrever cada endpoint
|
|
- Exemplos de request/response
|
|
- Códigos de erro
|
|
- Authentication flow
|
|
|
|
---
|
|
|
|
### Passo 1.6: Dockerfile Backend 🐳
|
|
**Objetivo**: Containerizar backend para deploy
|
|
|
|
**Arquivo**: `backend-api/Dockerfile`
|
|
```dockerfile
|
|
FROM node:22-alpine
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
COPY . .
|
|
RUN npm run build
|
|
EXPOSE 3000
|
|
CMD ["npm", "run", "start:prod"]
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 FASE 2: FRONTEND (Next.js) - PENDENTE
|
|
|
|
### Passo 2.1: Setup & Componentes Base ⏳
|
|
**Objetivo**: Configurar Design System e componentes reutilizáveis
|
|
|
|
**Tarefas**:
|
|
- [ ] Instalar `@supabase/supabase-js`
|
|
- [ ] Instalar `lucide-react` (ícones)
|
|
- [ ] Configurar Google Fonts em `globals.css`
|
|
- [ ] Criar arquivo de tokens (colors, spacing, typography)
|
|
- [ ] Estruturar pasta `src/components/`
|
|
|
|
**Componentes a criar**:
|
|
- `Button.tsx` (Primary, Secondary, Tertiary, Danger)
|
|
- `Input.tsx` (com validation)
|
|
- `Card.tsx`
|
|
- `Modal.tsx`
|
|
- `Checkbox.tsx`
|
|
- `TaskItem.tsx`
|
|
|
|
---
|
|
|
|
### Passo 2.2: Autenticação (Frontend) 🔐
|
|
**Objetivo**: Integrar login/signup com Supabase
|
|
|
|
**Páginas a criar**:
|
|
- `app/(auth)/login/page.tsx`
|
|
- `app/(auth)/signup/page.tsx`
|
|
- `app/(auth)/forgot-password/page.tsx`
|
|
|
|
**Componentes**:
|
|
- `LoginForm.tsx`
|
|
- `SignupForm.tsx`
|
|
|
|
---
|
|
|
|
### Passo 2.3: Dashboard de Tarefas 📋
|
|
**Objetivo**: Interface de CRUD de tarefas
|
|
|
|
**Páginas a criar**:
|
|
- `app/(dashboard)/tasks/page.tsx`
|
|
|
|
**Componentes**:
|
|
- `TaskList.tsx`
|
|
- `TaskForm.tsx`
|
|
- `TaskFilters.tsx`
|
|
- `EmptyState.tsx`
|
|
|
|
---
|
|
|
|
### Passo 2.4: Realtime Sync 🔄
|
|
**Objetivo**: Sincronização em tempo real com WebSockets
|
|
|
|
**Implementar**:
|
|
- Supabase Realtime subscriptions
|
|
- Auto-atualização de tarefas
|
|
|
|
---
|
|
|
|
## 🎯 FASE 3: MOBILE (Flutter) - PLANEJADO
|
|
|
|
### Passo 3.1: Criar Projeto Flutter
|
|
### Passo 3.2: Design System Flutter
|
|
### Passo 3.3: Autenticação Flutter
|
|
### Passo 3.4: Telas de Tarefas
|
|
### Passo 3.5: Realtime Sync
|
|
|
|
---
|
|
|
|
## 🎯 FASE 4: DEVOPS & DEPLOY - PLANEJADO
|
|
|
|
### Passo 4.1: Docker Compose
|
|
### Passo 4.2: CI/CD Pipeline
|
|
### Passo 4.3: Deploy Backend
|
|
### Passo 4.4: Deploy Frontend
|
|
### Passo 4.5: Deploy Mobile
|
|
|
|
---
|
|
|
|
## 🎬 COMEÇANDO AGORA
|
|
|
|
### Próximas Ações Imediatas (Hoje):
|
|
|
|
1. **Instalar dependências do Backend**
|
|
```bash
|
|
cd backend-api
|
|
npm install @supabase/supabase-js @nestjs/config @nestjs/jwt @nestjs/passport passport passport-jwt dotenv joi
|
|
```
|
|
|
|
2. **Criar arquivo `.env.example`** com variáveis necessárias
|
|
|
|
3. **Estruturar módulos** (auth, users, tasks, common)
|
|
|
|
4. **Começar Passo 1.2** (Módulo de Autenticação)
|
|
|
|
---
|
|
|
|
## 📝 Notas Importantes
|
|
|
|
- **Git**: Fazer commits frequentes após cada passo concluído
|
|
- **Testing**: Adicionar testes conforme avançar
|
|
- **Documentation**: Atualizar este arquivo após cada milestone
|
|
- **Code Review**: Revisar código para padrões NestJS/Next.js
|
|
|
|
---
|
|
|
|
**Status**: Aguardando execução do Passo 1.1 ⏳
|