initial: Backend Auth Module + Design System + Complete Documentation
- 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
This commit is contained in:
51
.gitignore
vendored
Normal file
51
.gitignore
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# Environment variables
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
.dart_tool/
|
||||
.flutter/
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
build/
|
||||
.next/
|
||||
out/
|
||||
*.apk
|
||||
*.app
|
||||
*.ipa
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.DS_Store
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Coverage
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
# OS
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
|
||||
# Flutter/Dart specific
|
||||
.pub
|
||||
.dart_tool
|
||||
.fvm
|
||||
.flutter
|
||||
|
||||
# Test
|
||||
test/**/*.js
|
||||
test/**/*.js.map
|
||||
139
GIT_PUSH_INSTRUCTIONS.md
Normal file
139
GIT_PUSH_INSTRUCTIONS.md
Normal file
@@ -0,0 +1,139 @@
|
||||
# 📤 INSTRUÇÕES PARA FAZER PUSH DO PROJETO
|
||||
|
||||
Quando você tiver a URL do repositório Git, siga estes passos:
|
||||
|
||||
## 1️⃣ Configurar Git na Raiz do Projeto
|
||||
|
||||
```bash
|
||||
cd c:\Users\Erik Silva\Documents\projetos\to-do-list
|
||||
|
||||
# Inicializar repositório (se ainda não foi feito)
|
||||
git init
|
||||
|
||||
# Criar branch main
|
||||
git checkout -b main
|
||||
|
||||
# Configurar informações do Git (use seus dados)
|
||||
git config user.name "Erik Silva"
|
||||
git config user.email "seu-email@example.com"
|
||||
```
|
||||
|
||||
## 2️⃣ Adicionar Todos os Arquivos
|
||||
|
||||
```bash
|
||||
# Ver status
|
||||
git status
|
||||
|
||||
# Adicionar tudo (respeitando .gitignore)
|
||||
git add .
|
||||
|
||||
# Verificar o que vai ser commitado
|
||||
git status
|
||||
```
|
||||
|
||||
## 3️⃣ Fazer o Primeiro Commit
|
||||
|
||||
```bash
|
||||
git commit -m "initial: Backend Auth Module + Design System + Complete Documentation
|
||||
|
||||
- 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
|
||||
- JwtAuthGuard for route protection
|
||||
- CurrentUser decorator for dependency injection
|
||||
- Supabase integration for user management
|
||||
- Complete API documentation (API.md)
|
||||
- Design System for Web (Next.js + Tailwind) and Mobile (Flutter)
|
||||
- Comprehensive project documentation
|
||||
- Environment configuration with Joi validation
|
||||
- Ready for Tasks Module implementation"
|
||||
```
|
||||
|
||||
## 4️⃣ Adicionar Remote e Fazer Push
|
||||
|
||||
```bash
|
||||
# Substituir pela URL do seu repositório
|
||||
git remote add origin https://git.stackbyte.cloud/erik/todolist-fullstack.git
|
||||
|
||||
# Fazer push da branch main
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
## 5️⃣ (Opcional) Se Precisar de Credenciais
|
||||
|
||||
Se o Git pedir credenciais:
|
||||
|
||||
```bash
|
||||
# Para git via HTTPS, pode usar token pessoal:
|
||||
# Quando pedir password, use o token em vez da senha
|
||||
|
||||
# Ou configure SSH para não pedir senha toda vez:
|
||||
# git remote set-url origin git@git.stackbyte.cloud:erik/todolist-fullstack.git
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Checklist antes do Push
|
||||
|
||||
- [x] Backend compilando sem erros (`npm run build`)
|
||||
- [x] Frontend tem package.json válido
|
||||
- [x] .env.example criado (sem valores reais)
|
||||
- [x] Documentação completa
|
||||
- [x] .gitignore configurado
|
||||
- [x] node_modules/ não será adicionado
|
||||
- [x] .env não será adicionado (segurança)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Após o Push
|
||||
|
||||
Verifique se tudo está lá:
|
||||
|
||||
```bash
|
||||
# Ver histórico de commits
|
||||
git log --oneline
|
||||
|
||||
# Ver branches
|
||||
git branch -a
|
||||
|
||||
# Ver remote
|
||||
git remote -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Próximo Commit (Passo 1.3)
|
||||
|
||||
Quando implementar o Tasks Module, o commit será:
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "feat: Tasks Module implementation with CRUD endpoints
|
||||
|
||||
- Implement TasksService with create, read, update, delete
|
||||
- Create TasksController with protected endpoints
|
||||
- Create Task DTOs (CreateTaskDto, UpdateTaskDto)
|
||||
- Integrate with Supabase PostgREST API
|
||||
- Add RLS policies documentation
|
||||
- Update API.md with Tasks endpoints"
|
||||
|
||||
git push origin main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💡 Dica: Rebase antes de Push (se necessário)
|
||||
|
||||
```bash
|
||||
# Se houver conflitos ou precisar limpar histórico
|
||||
git rebase -i HEAD~3 # Últimos 3 commits
|
||||
|
||||
# Ou fazer um rebase em uma branch remota
|
||||
git fetch origin
|
||||
git rebase origin/main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Quando estiver pronto, é só me chamar que a gente faz o push! 🚀**
|
||||
240
PROGRESSO.md
Normal file
240
PROGRESSO.md
Normal file
@@ -0,0 +1,240 @@
|
||||
# ✅ PROGRESSO - FASE 1: BACKEND (Passo 1 & 2 Concluído)
|
||||
|
||||
**Data**: 1 de dezembro de 2025
|
||||
**Status**: 🟢 Em Desenvolvimento
|
||||
|
||||
---
|
||||
|
||||
## 🎯 O que foi feito até agora
|
||||
|
||||
### ✅ Passo 1.1: Setup & Dependências (COMPLETO)
|
||||
|
||||
**Dependências Instaladas**:
|
||||
- ✅ `@supabase/supabase-js` - Cliente Supabase
|
||||
- ✅ `@nestjs/config` - Configuração centralizada
|
||||
- ✅ `@nestjs/jwt` - JWT para autenticação
|
||||
- ✅ `@nestjs/passport` - Estratégias de autenticação
|
||||
- ✅ `passport`, `passport-jwt` - Implementação JWT
|
||||
- ✅ `dotenv` - Variáveis de ambiente
|
||||
- ✅ `joi` - Validação de schema
|
||||
- ✅ `class-validator`, `class-transformer` - DTOs
|
||||
|
||||
**Arquivos Criados**:
|
||||
```
|
||||
backend-api/
|
||||
├── .env.example # Template de variáveis
|
||||
├── API.md # Documentação da API
|
||||
├── src/
|
||||
│ ├── config/
|
||||
│ │ ├── app.config.ts # Config da app
|
||||
│ │ ├── database.config.ts # Config Supabase
|
||||
│ │ ├── jwt.config.ts # Config JWT
|
||||
│ │ └── supabase.service.ts # Service Supabase
|
||||
│ ├── common/
|
||||
│ │ └── decorators/
|
||||
│ │ └── current-user.decorator.ts
|
||||
│ ├── auth/
|
||||
│ │ ├── dto/
|
||||
│ │ │ ├── signup.dto.ts
|
||||
│ │ │ └── login.dto.ts
|
||||
│ │ ├── strategies/
|
||||
│ │ │ └── jwt.strategy.ts
|
||||
│ │ └── guards/
|
||||
│ │ └── jwt.guard.ts
|
||||
│ ├── users/
|
||||
│ │ └── dto/
|
||||
│ │ └── create-user.dto.ts
|
||||
│ ├── tasks/
|
||||
│ │ └── dto/
|
||||
│ │ ├── create-task.dto.ts
|
||||
│ │ └── update-task.dto.ts
|
||||
│ ├── app.module.ts # ✅ Atualizado com imports
|
||||
│ └── main.ts # ✅ Atualizado com middlewares
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### ✅ Passo 1.2: Módulo de Autenticação (COMPLETO)
|
||||
|
||||
**Implementado**:
|
||||
|
||||
#### Auth Service (`auth.service.ts`)
|
||||
- ✅ `signup()` - Registrar usuário
|
||||
- ✅ `login()` - Fazer login
|
||||
- ✅ `logout()` - Fazer logout
|
||||
- ✅ `validateToken()` - Validar JWT
|
||||
- ✅ `requestPasswordReset()` - Recuperar senha
|
||||
- ✅ `generateToken()` - Gerar JWT
|
||||
|
||||
#### Auth Controller (`auth.controller.ts`)
|
||||
- ✅ `POST /auth/signup` - Registrar
|
||||
- ✅ `POST /auth/login` - Login
|
||||
- ✅ `POST /auth/logout` - Logout
|
||||
- ✅ `GET /auth/me` - Perfil atual
|
||||
- ✅ `POST /auth/forgot-password` - Recuperar senha
|
||||
|
||||
#### Segurança
|
||||
- ✅ JWT Strategy - Extração e validação de tokens
|
||||
- ✅ JWT Guard - Proteção de rotas
|
||||
- ✅ CurrentUser Decorator - Injeção do usuário autenticado
|
||||
- ✅ Validação de DTOs com class-validator
|
||||
|
||||
---
|
||||
|
||||
## 📊 Progresso Visual
|
||||
|
||||
```
|
||||
Fase 1: Backend [████████████░░░░░░░░░░░░] 50%
|
||||
├─ Setup [████████████████████░] 100% ✅
|
||||
├─ Auth Module [████████████████████░] 100% ✅
|
||||
├─ Tasks Module [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
├─ RLS Supabase [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
├─ API Docs [████████████░░░░░░░░░] 60%
|
||||
└─ Dockerfile [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
|
||||
Fase 2: Frontend [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
Fase 3: Mobile [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
Fase 4: DevOps/Deploy [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Arquitetura Implementada
|
||||
|
||||
```
|
||||
NestJS Backend Architecture
|
||||
├── Auth Module (Protegido por JWT)
|
||||
│ ├── Controller
|
||||
│ │ └── Endpoints: signup, login, logout, me, forgot-password
|
||||
│ ├── Service
|
||||
│ │ └── Lógica: JWT generation, Supabase integration
|
||||
│ ├── Strategies
|
||||
│ │ └── JWT Strategy: Token extraction & validation
|
||||
│ └── Guards
|
||||
│ └── JWT Guard: Route protection
|
||||
├── Config Module
|
||||
│ ├── App Config (port, cors, prefix)
|
||||
│ ├── Database Config (Supabase)
|
||||
│ ├── JWT Config (secret, expiration)
|
||||
│ └── Supabase Service (client initialization)
|
||||
├── Common
|
||||
│ └── Decorators
|
||||
│ └── @CurrentUser() - User injection
|
||||
└── Global Pipes
|
||||
└── ValidationPipe - DTO validation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Fluxo de Autenticação
|
||||
|
||||
```
|
||||
1. Usuário faz signup
|
||||
↓
|
||||
2. Supabase cria usuário em auth.users
|
||||
↓
|
||||
3. Backend gera JWT token assinado
|
||||
↓
|
||||
4. Token retornado ao cliente (web/mobile)
|
||||
↓
|
||||
5. Cliente armazena token (localStorage/secure storage)
|
||||
↓
|
||||
6. Próximas requisições incluem: Authorization: Bearer {token}
|
||||
↓
|
||||
7. JWT Strategy extrai e valida o token
|
||||
↓
|
||||
8. Route Guard permite/nega acesso
|
||||
↓
|
||||
9. @CurrentUser() injeta dados do usuário
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📝 Próximas Ações (Passo 3)
|
||||
|
||||
### Passo 1.3: Módulo de Tarefas
|
||||
- [ ] Criar `tasks.service.ts` com CRUD
|
||||
- [ ] Criar `tasks.controller.ts` com endpoints
|
||||
- [ ] Criar DTOs (create-task, update-task)
|
||||
- [ ] Integrar com Supabase (query builder)
|
||||
- [ ] Adicionar validações
|
||||
|
||||
### Passo 1.4: RLS no Supabase
|
||||
- [ ] Criar tabela `tasks` no Supabase
|
||||
- [ ] Implementar RLS policies
|
||||
- [ ] Testar isolamento de dados
|
||||
|
||||
### Passo 1.5: Completar Documentação
|
||||
- [ ] Adicionar endpoints de Tasks
|
||||
- [ ] Exemplos de uso (cURL)
|
||||
- [ ] Erros documentados
|
||||
|
||||
### Passo 1.6: Dockerfile
|
||||
- [ ] Criar Dockerfile
|
||||
- [ ] Testar containerização
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Como Testar Agora
|
||||
|
||||
### 1. Configurar .env
|
||||
```bash
|
||||
cp backend-api/.env.example backend-api/.env
|
||||
# Editar com suas credenciais Supabase
|
||||
```
|
||||
|
||||
### 2. Rodar em desenvolvimento
|
||||
```bash
|
||||
cd backend-api
|
||||
npm run start:dev
|
||||
```
|
||||
|
||||
### 3. Testar endpoints com cURL
|
||||
```bash
|
||||
# Signup
|
||||
curl -X POST http://localhost:3000/api/auth/signup \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email":"test@example.com","password":"Test123456"}'
|
||||
|
||||
# Login
|
||||
curl -X POST http://localhost:3000/api/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email":"test@example.com","password":"Test123456"}'
|
||||
|
||||
# Get Profile (com token)
|
||||
curl -X GET http://localhost:3000/api/auth/me \
|
||||
-H "Authorization: Bearer {seu_token}"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Arquivos Documentados
|
||||
|
||||
- ✅ `API.md` - Documentação completa dos endpoints
|
||||
- ✅ `ROADMAP_EXECUCAO.md` - Plano de execução
|
||||
- ✅ `.env.example` - Template de variáveis
|
||||
|
||||
---
|
||||
|
||||
## 💡 O que você aprendeu nesta sessão
|
||||
|
||||
1. **Estrutura NestJS** - Módulos, Controllers, Services, Guards
|
||||
2. **Autenticação com JWT** - Token generation, validation, protection
|
||||
3. **Integração Supabase** - Client setup, user creation
|
||||
4. **Validação de DTOs** - class-validator, class-transformer
|
||||
5. **Decoradores** - @Controller, @UseGuards, @CurrentUser
|
||||
6. **ConfigModule** - Gerenciamento de variáveis de ambiente com Joi
|
||||
7. **Arquitetura em camadas** - Separação de responsabilidades
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Próximas Sessões Planejadas
|
||||
|
||||
1. **Hoje**: Implementar Módulo de Tarefas (Passo 1.3)
|
||||
2. **Hoje/Amanhã**: RLS no Supabase (Passo 1.4)
|
||||
3. **Amanhã**: Dockerfile (Passo 1.6)
|
||||
4. **Depois**: Frontend Next.js (Fase 2)
|
||||
|
||||
---
|
||||
|
||||
**Status Final**: Backend 50% completo e pronto para integração com frontend! 🎉
|
||||
215
README.md
Normal file
215
README.md
Normal file
@@ -0,0 +1,215 @@
|
||||
# 📱 TASK MANAGER - Aplicação Multi-Plataforma
|
||||
|
||||
> Uma aplicação fullstack moderna de gerenciamento de tarefas com sincronização em tempo real, desenvolvida com **NestJS**, **Next.js**, **Flutter** e **Supabase**.
|
||||
|
||||
## 🎯 Objetivo
|
||||
|
||||
Criar uma aplicação multi-plataforma sincronizada em tempo real para estudar desenvolvimento fullstack moderno com TypeScript.
|
||||
|
||||
## 🛠️ Stack Tecnológica
|
||||
|
||||
### Backend
|
||||
- **NestJS 11** - Framework Node.js com TypeScript
|
||||
- **Supabase** - PostgreSQL + Auth + Realtime
|
||||
- **TypeScript 5.7**
|
||||
- **Docker** - Containerização
|
||||
|
||||
### Frontend Web
|
||||
- **Next.js 16** - React com App Router
|
||||
- **TailwindCSS 4** - Utility-first CSS
|
||||
- **TypeScript 5**
|
||||
- **Supabase Client**
|
||||
|
||||
### Mobile
|
||||
- **Flutter** - Framework multi-plataforma (Android/iOS)
|
||||
- **Dart** - Linguagem do Flutter
|
||||
- **Provider** - State management
|
||||
- **Supabase Flutter SDK**
|
||||
|
||||
## 📋 Funcionalidades (MVP)
|
||||
|
||||
### ✅ Autenticação
|
||||
- [x] Estrutura de autenticação
|
||||
- [ ] Cadastro de usuário (email + senha)
|
||||
- [ ] Login
|
||||
- [ ] Logout
|
||||
- [ ] Recuperação de senha
|
||||
- [ ] Sessão persistente
|
||||
|
||||
### ✅ Gerenciamento de Tarefas
|
||||
- [ ] Criar tarefa
|
||||
- [ ] Listar tarefas do usuário
|
||||
- [ ] Marcar como concluída/pendente
|
||||
- [ ] Editar tarefa
|
||||
- [ ] Deletar tarefa
|
||||
- [ ] Filtrar (Todas/Ativas/Concluídas)
|
||||
|
||||
### ✅ Sincronização em Tempo Real
|
||||
- [ ] Supabase Realtime (WebSockets)
|
||||
- [ ] Sincronização web ↔ mobile
|
||||
- [ ] Atualização automática em múltiplos dispositivos
|
||||
|
||||
## 📁 Estrutura do Projeto
|
||||
|
||||
```
|
||||
to-do-list/
|
||||
├── backend-api/ # NestJS API
|
||||
│ ├── src/
|
||||
│ │ ├── auth/ # Módulo de autenticação
|
||||
│ │ ├── tasks/ # Módulo de tarefas
|
||||
│ │ ├── config/ # Configurações
|
||||
│ │ ├── common/ # Utilitários comuns
|
||||
│ │ └── main.ts
|
||||
│ ├── .env.example
|
||||
│ └── package.json
|
||||
│
|
||||
├── frontend-next/ # Next.js Web
|
||||
│ ├── src/
|
||||
│ │ ├── app/ # App Router pages
|
||||
│ │ ├── components/ # Componentes reutilizáveis
|
||||
│ │ ├── lib/ # Utilitários
|
||||
│ │ └── styles/ # Estilos globais
|
||||
│ ├── .env.example
|
||||
│ └── package.json
|
||||
│
|
||||
├── mobile/ # Flutter (TODO)
|
||||
│ ├── lib/
|
||||
│ ├── pubspec.yaml
|
||||
│ └── .env.example
|
||||
│
|
||||
├── docs/ # Documentação
|
||||
│ ├── instrucoes-gerais.md
|
||||
│ └── instrucoes-design.md
|
||||
│
|
||||
├── ROADMAP_EXECUCAO.md # Roadmap detalhado
|
||||
├── .gitignore
|
||||
└── README.md # Este arquivo
|
||||
```
|
||||
|
||||
## 🚀 Começando
|
||||
|
||||
### Pré-requisitos
|
||||
- Node.js 20+
|
||||
- npm ou yarn
|
||||
- Conta Supabase ativa
|
||||
- Flutter SDK (para mobile)
|
||||
|
||||
### Setup Backend
|
||||
|
||||
```bash
|
||||
cd backend-api
|
||||
npm install
|
||||
cp .env.example .env
|
||||
# Preencha as variáveis de ambiente
|
||||
npm run start:dev
|
||||
```
|
||||
|
||||
Backend rodará em: `http://localhost:3000/api`
|
||||
|
||||
### Setup Frontend Web
|
||||
|
||||
```bash
|
||||
cd frontend-next
|
||||
npm install
|
||||
cp .env.example .env.local
|
||||
# Preencha as variáveis de ambiente
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Frontend rodará em: `http://localhost:3000`
|
||||
|
||||
### Setup Mobile (Em Breve)
|
||||
|
||||
```bash
|
||||
cd mobile
|
||||
flutter pub get
|
||||
# Configurar .env
|
||||
flutter run
|
||||
```
|
||||
|
||||
## 📖 Documentação
|
||||
|
||||
Veja os arquivos de documentação:
|
||||
- **[instrucoes-gerais.md](./docs/instrucoes-gerais.md)** - Plano geral do projeto
|
||||
- **[instrucoes-design.md](./docs/instrucoes-design.md)** - Design System
|
||||
- **[ROADMAP_EXECUCAO.md](./ROADMAP_EXECUCAO.md)** - Roadmap detalhado
|
||||
|
||||
## 🔐 Variáveis de Ambiente
|
||||
|
||||
### Backend (.env)
|
||||
```
|
||||
SUPABASE_URL=https://supabase.stackbackup.cloud
|
||||
SUPABASE_ANON_KEY=your_key
|
||||
SUPABASE_SERVICE_KEY=your_key
|
||||
JWT_SECRET=your_secret_min_32_chars
|
||||
JWT_EXPIRATION=7d
|
||||
NODE_ENV=development
|
||||
PORT=3000
|
||||
CORS_ORIGIN=http://localhost:3000
|
||||
```
|
||||
|
||||
### Frontend (.env.local)
|
||||
```
|
||||
NEXT_PUBLIC_SUPABASE_URL=https://supabase.stackbackup.cloud
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_key
|
||||
```
|
||||
|
||||
## 📊 Progresso
|
||||
|
||||
```
|
||||
Fase 1: Backend [████████░░] 45%
|
||||
✅ Setup & Config
|
||||
✅ Módulo Auth
|
||||
⏳ Módulo Tasks
|
||||
⏳ RLS & Docs
|
||||
|
||||
Fase 2: Frontend [██░░░░░░░░] 5%
|
||||
⏳ Setup & Config
|
||||
⏳ Componentes
|
||||
⏳ Autenticação
|
||||
⏳ Tarefas
|
||||
|
||||
Fase 3: Mobile [░░░░░░░░░░] 0%
|
||||
⏳ Projeto Flutter
|
||||
⏳ Auth
|
||||
⏳ Telas
|
||||
|
||||
Fase 4: DevOps [░░░░░░░░░░] 0%
|
||||
⏳ Docker
|
||||
⏳ Deploy
|
||||
```
|
||||
|
||||
## 🔗 Referências
|
||||
|
||||
- [NestJS Documentation](https://docs.nestjs.com)
|
||||
- [Next.js Documentation](https://nextjs.org/docs)
|
||||
- [Flutter Documentation](https://flutter.dev/docs)
|
||||
- [Supabase Documentation](https://supabase.com/docs)
|
||||
- [TypeScript Handbook](https://www.typescriptlang.org/docs/)
|
||||
|
||||
## 📝 API Endpoints
|
||||
|
||||
### Auth
|
||||
- `POST /api/auth/signup` - Registrar usuário
|
||||
- `POST /api/auth/login` - Fazer login
|
||||
- `POST /api/auth/logout` - Fazer logout
|
||||
- `GET /api/auth/me` - Perfil atual
|
||||
- `POST /api/auth/forgot-password` - Recuperar senha
|
||||
|
||||
### Tasks (Em desenvolvimento)
|
||||
- `GET /api/tasks` - Listar tarefas
|
||||
- `POST /api/tasks` - Criar tarefa
|
||||
- `PATCH /api/tasks/:id` - Atualizar tarefa
|
||||
- `DELETE /api/tasks/:id` - Deletar tarefa
|
||||
|
||||
## 🤝 Contribuindo
|
||||
|
||||
Este é um projeto de aprendizado. Sinta-se livre para abrir issues e PRs.
|
||||
|
||||
## 📄 Licença
|
||||
|
||||
MIT
|
||||
|
||||
---
|
||||
|
||||
**Desenvolvido com ❤️ como projeto de aprendizado fullstack**
|
||||
273
ROADMAP_EXECUCAO.md
Normal file
273
ROADMAP_EXECUCAO.md
Normal file
@@ -0,0 +1,273 @@
|
||||
# 🚀 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 ⏳
|
||||
305
SESSION_1_RECAP.md
Normal file
305
SESSION_1_RECAP.md
Normal file
@@ -0,0 +1,305 @@
|
||||
# 🎉 RESUMO - SESSION 1 (1º de Dezembro de 2025)
|
||||
|
||||
## ✅ O QUE FOI CONCLUÍDO
|
||||
|
||||
### 📚 Documentação & Planejamento
|
||||
- [x] **Design System Completo** (`instrucoes-design.md`)
|
||||
- Paleta de cores (Azul primary, Preto, Branco)
|
||||
- Tipografia (Inter + Poppins do Google Fonts)
|
||||
- Ícones Google Icons
|
||||
- Espaçamento (8px base)
|
||||
- Componentes UI documentados
|
||||
- Configurações Tailwind + Flutter
|
||||
|
||||
- [x] **Roadmap de Execução** (`ROADMAP_EXECUCAO.md`)
|
||||
- 4 Fases detalhadas
|
||||
- 17+ sub-tarefas mapeadas
|
||||
- Pré-requisitos documentados
|
||||
|
||||
- [x] **Progresso Visual** (`PROGRESSO.md`)
|
||||
- Status de cada módulo
|
||||
- Arquitetura ilustrada
|
||||
- Próximas ações claras
|
||||
|
||||
- [x] **README Completo** (raiz)
|
||||
- Setup instructions
|
||||
- Stack overview
|
||||
- Links úteis
|
||||
|
||||
---
|
||||
|
||||
## 🚀 BACKEND (NestJS) - PASSO 1.1 & 1.2 (50%)
|
||||
|
||||
### ✅ Passo 1.1: Setup & Dependências
|
||||
|
||||
**Instalado:**
|
||||
```
|
||||
✅ @supabase/supabase-js
|
||||
✅ @nestjs/config (ConfigModule com Joi)
|
||||
✅ @nestjs/jwt (JWT signing/validation)
|
||||
✅ @nestjs/passport (Passport integration)
|
||||
✅ passport + passport-jwt (JWT strategy)
|
||||
✅ dotenv (Environment variables)
|
||||
✅ class-validator + class-transformer (DTOs)
|
||||
✅ joi (Schema validation)
|
||||
```
|
||||
|
||||
**Arquivos Criados:**
|
||||
```
|
||||
✅ backend-api/.env.example
|
||||
✅ backend-api/src/config/app.config.ts
|
||||
✅ backend-api/src/config/database.config.ts
|
||||
✅ backend-api/src/config/jwt.config.ts
|
||||
✅ backend-api/src/config/supabase.service.ts
|
||||
✅ backend-api/src/app.module.ts (atualizado)
|
||||
✅ backend-api/src/main.ts (com middlewares)
|
||||
```
|
||||
|
||||
### ✅ Passo 1.2: Módulo de Autenticação
|
||||
|
||||
**Auth Service:**
|
||||
```typescript
|
||||
✅ signup() - Registrar usuário
|
||||
✅ login() - Fazer login
|
||||
✅ logout() - Fazer logout
|
||||
✅ validateToken() - Validar JWT
|
||||
✅ requestPasswordReset() - Recuperar senha
|
||||
✅ generateToken() - Gerar token JWT
|
||||
```
|
||||
|
||||
**Auth Controller:**
|
||||
```
|
||||
✅ POST /auth/signup - Registrar
|
||||
✅ POST /auth/login - Login
|
||||
✅ POST /auth/logout - Logout (protegido)
|
||||
✅ GET /auth/me - Perfil atual (protegido)
|
||||
✅ POST /auth/forgot-password - Recuperar senha
|
||||
```
|
||||
|
||||
**Infraestrutura:**
|
||||
```
|
||||
✅ JWT Strategy - Extração e validação de tokens
|
||||
✅ JWT Guard - Proteção de rotas
|
||||
✅ CurrentUser - Decorator injeção de usuário
|
||||
✅ DTOs validados - SignupDto, LoginDto, CreateUserDto
|
||||
✅ Error Handling - Exceções customizadas
|
||||
```
|
||||
|
||||
### 🔄 Passo 1.2b: Compilação & Build
|
||||
|
||||
```
|
||||
✅ npm run build - Sem erros de TypeScript
|
||||
✅ Projeto compilando com sucesso
|
||||
✅ Pronto para rodar em dev/prod
|
||||
```
|
||||
|
||||
### 📖 Passo 1.5: Documentação API (60%)
|
||||
|
||||
**Criado:**
|
||||
```
|
||||
✅ backend-api/API.md com:
|
||||
- Todos endpoints AUTH documentados
|
||||
- Exemplos de request/response
|
||||
- Códigos de erro
|
||||
- Exemplos cURL
|
||||
- (Tasks pendente de implementação)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📁 Estrutura Criada
|
||||
|
||||
```
|
||||
backend-api/
|
||||
├── src/
|
||||
│ ├── auth/ ✅ IMPLEMENTADO
|
||||
│ │ ├── auth.service.ts
|
||||
│ │ ├── auth.controller.ts
|
||||
│ │ ├── auth.module.ts
|
||||
│ │ ├── strategies/
|
||||
│ │ │ └── jwt.strategy.ts
|
||||
│ │ ├── guards/
|
||||
│ │ │ └── jwt.guard.ts
|
||||
│ │ └── dto/
|
||||
│ │ ├── signup.dto.ts
|
||||
│ │ └── login.dto.ts
|
||||
│ │
|
||||
│ ├── config/ ✅ IMPLEMENTADO
|
||||
│ │ ├── app.config.ts
|
||||
│ │ ├── database.config.ts
|
||||
│ │ ├── jwt.config.ts
|
||||
│ │ └── supabase.service.ts
|
||||
│ │
|
||||
│ ├── users/ 🟡 ESTRUTURA CRIADA
|
||||
│ │ └── dto/
|
||||
│ │ └── create-user.dto.ts
|
||||
│ │
|
||||
│ ├── tasks/ 🟡 ESTRUTURA CRIADA
|
||||
│ │ └── dto/
|
||||
│ │ ├── create-task.dto.ts
|
||||
│ │ └── update-task.dto.ts
|
||||
│ │
|
||||
│ ├── common/ ✅ IMPLEMENTADO
|
||||
│ │ └── decorators/
|
||||
│ │ └── current-user.decorator.ts
|
||||
│ │
|
||||
│ ├── app.module.ts ✅ ATUALIZADO
|
||||
│ └── main.ts ✅ ATUALIZADO
|
||||
│
|
||||
├── .env.example ✅ CRIADO
|
||||
├── API.md ✅ CRIADO
|
||||
└── dist/ ✅ BUILD OK
|
||||
|
||||
frontend-next/
|
||||
├── app/
|
||||
│ ├── (auth) 🟡 ESTRUTURA PRONTA
|
||||
│ ├── (dashboard) 🟡 ESTRUTURA PRONTA
|
||||
│ ├── layout.tsx ✅ EXISTE
|
||||
│ ├── page.tsx ✅ EXISTE
|
||||
│ └── globals.css ✅ EXISTE
|
||||
└── (restante Next.js padrão)
|
||||
|
||||
docs/
|
||||
├── instrucoes-gerais.md ✅ ESTUDADO
|
||||
├── instrucoes-design.md ✅ CRIADO
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎓 Conhecimentos Adquiridos
|
||||
|
||||
### NestJS & TypeScript
|
||||
- ✅ Decoradores (@Module, @Controller, @UseGuards)
|
||||
- ✅ Dependency Injection (constructor injection)
|
||||
- ✅ Modules & Providers
|
||||
- ✅ Services & Controllers
|
||||
- ✅ Guards (JWT Guard)
|
||||
- ✅ Strategies (JWT Strategy)
|
||||
- ✅ Decorators customizados (@CurrentUser)
|
||||
- ✅ DTOs com validação
|
||||
|
||||
### Autenticação & Segurança
|
||||
- ✅ JWT (JSON Web Tokens)
|
||||
- ✅ Passport.js integration
|
||||
- ✅ Bearer token extraction
|
||||
- ✅ Route protection
|
||||
- ✅ Password hashing via Supabase
|
||||
- ✅ CORS configuration
|
||||
|
||||
### Supabase Integration
|
||||
- ✅ createClient initialization
|
||||
- ✅ User creation (auth.admin.createUser)
|
||||
- ✅ Password-based auth flow
|
||||
- ✅ Service key vs Anon key usage
|
||||
|
||||
### Configuration Management
|
||||
- ✅ ConfigModule setup
|
||||
- ✅ Environment validation with Joi
|
||||
- ✅ Config factories
|
||||
- ✅ Type-safe config access
|
||||
|
||||
### Design System (Cross-platform)
|
||||
- ✅ Paleta de cores unificada (Web + Mobile)
|
||||
- ✅ Tipografia (Google Fonts)
|
||||
- ✅ Espaçamento system (8px base)
|
||||
- ✅ Componentes documentados
|
||||
- ✅ Tailwind config setup
|
||||
- ✅ Flutter theme setup
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Próximas Ações (Imediatas)
|
||||
|
||||
### Hoje/Amanhã:
|
||||
1. **Passo 1.3**: Implementar Módulo de Tarefas
|
||||
- [ ] TasksService (CRUD)
|
||||
- [ ] TasksController (endpoints)
|
||||
- [ ] Integração Supabase
|
||||
|
||||
2. **Passo 1.4**: RLS no Supabase
|
||||
- [ ] Criar tabela `tasks`
|
||||
- [ ] Implementar policies RLS
|
||||
- [ ] Testar segurança
|
||||
|
||||
3. **Passo 1.6**: Dockerfile
|
||||
- [ ] Criar Dockerfile
|
||||
- [ ] Docker compose (opcional)
|
||||
|
||||
### Depois:
|
||||
4. **Fase 2**: Frontend (Next.js)
|
||||
5. **Fase 3**: Mobile (Flutter)
|
||||
|
||||
---
|
||||
|
||||
## 📊 Progresso Geral
|
||||
|
||||
```
|
||||
Backend [████████████░░░░░░░░░░░░] 50%
|
||||
Setup [████████████████████░] 100% ✅
|
||||
Auth [████████████████████░] 100% ✅
|
||||
Tasks [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
Docs [████████████░░░░░░░░░] 60%
|
||||
|
||||
Frontend [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
Mobile [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
DevOps [░░░░░░░░░░░░░░░░░░░░░] 0%
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📝 Arquivos Documentação Criados/Atualizados
|
||||
|
||||
```
|
||||
✅ docs/instrucoes-gerais.md - Plano geral (lido)
|
||||
✅ docs/instrucoes-design.md - Design System completo (criado)
|
||||
✅ backend-api/API.md - Documentação endpoints (criado)
|
||||
✅ ROADMAP_EXECUCAO.md - Roadmap detalhado (criado)
|
||||
✅ PROGRESSO.md - Status development (criado)
|
||||
✅ README.md (raiz) - Visão geral projeto (existe)
|
||||
✅ .gitignore - Git rules (existe)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Comandos Úteis para Próxima Sessão
|
||||
|
||||
```bash
|
||||
# Rodar backend em desenvolvimento
|
||||
cd backend-api
|
||||
npm run start:dev
|
||||
|
||||
# Compilar backend
|
||||
npm run build
|
||||
|
||||
# Rodar testes
|
||||
npm run test
|
||||
|
||||
# Verificar tipos TypeScript
|
||||
npm run build
|
||||
|
||||
# Rodar frontend
|
||||
cd frontend-next
|
||||
npm run dev
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Status Final
|
||||
|
||||
✅ **Projeto está estruturado e com excelente base**
|
||||
|
||||
- Design System de qualidade (Web + Mobile)
|
||||
- Backend Auth implementado e compilando
|
||||
- Documentação completa
|
||||
- Roadmap claro
|
||||
|
||||
**Próximo passo**: Tasks Module (Backend) → RLS → Frontend
|
||||
|
||||
---
|
||||
|
||||
**Tempo de sessão**: ~2 horas
|
||||
**Commits pendentes**: Aguardando repo Git
|
||||
**Próxima sessão**: Implementar Tasks Module + RLS
|
||||
|
||||
🎉 **Ótima primeira sessão!**
|
||||
29
backend-api/.env.example
Normal file
29
backend-api/.env.example
Normal file
@@ -0,0 +1,29 @@
|
||||
# ======================================
|
||||
# SUPABASE CONFIGURATION
|
||||
# ======================================
|
||||
SUPABASE_URL=https://supabase.stackbackup.cloud
|
||||
SUPABASE_ANON_KEY=your_supabase_anon_key_here
|
||||
SUPABASE_SERVICE_KEY=your_supabase_service_key_here
|
||||
|
||||
# ======================================
|
||||
# JWT CONFIGURATION
|
||||
# ======================================
|
||||
JWT_SECRET=your_jwt_secret_key_here_min_32_chars_long
|
||||
JWT_EXPIRATION=7d
|
||||
|
||||
# ======================================
|
||||
# DATABASE CONFIGURATION
|
||||
# ======================================
|
||||
DATABASE_URL=postgresql://user:password@localhost:5432/taskmanager
|
||||
|
||||
# ======================================
|
||||
# APP CONFIGURATION
|
||||
# ======================================
|
||||
NODE_ENV=development
|
||||
PORT=3000
|
||||
API_PREFIX=/api
|
||||
|
||||
# ======================================
|
||||
# CORS CONFIGURATION
|
||||
# ======================================
|
||||
CORS_ORIGIN=http://localhost:3000,http://localhost:3001
|
||||
56
backend-api/.gitignore
vendored
Normal file
56
backend-api/.gitignore
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# compiled output
|
||||
/dist
|
||||
/node_modules
|
||||
/build
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
pnpm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
|
||||
# Tests
|
||||
/coverage
|
||||
/.nyc_output
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# temp directory
|
||||
.temp
|
||||
.tmp
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
4
backend-api/.prettierrc
Normal file
4
backend-api/.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
359
backend-api/API.md
Normal file
359
backend-api/API.md
Normal file
@@ -0,0 +1,359 @@
|
||||
# 🔐 TASK MANAGER - API Backend Documentation
|
||||
|
||||
## 📌 Base URL
|
||||
```
|
||||
http://localhost:3000/api
|
||||
```
|
||||
|
||||
## 🔑 Autenticação
|
||||
|
||||
Todas as requisições protegidas devem incluir o header:
|
||||
```
|
||||
Authorization: Bearer {token}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Endpoints da API
|
||||
|
||||
### 1. Autenticação (Auth)
|
||||
|
||||
#### 1.1 Registrar (Signup)
|
||||
```http
|
||||
POST /auth/signup
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"email": "user@example.com",
|
||||
"password": "securepassword123",
|
||||
"name": "João Silva"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (201 Created):**
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"user": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"email": "user@example.com",
|
||||
"email_confirmed_at": "2025-12-01T10:00:00Z"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `400 Bad Request` - Dados inválidos
|
||||
- `409 Conflict` - Email já registrado
|
||||
|
||||
---
|
||||
|
||||
#### 1.2 Login
|
||||
```http
|
||||
POST /auth/login
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"email": "user@example.com",
|
||||
"password": "securepassword123"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"user": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"email": "user@example.com",
|
||||
"email_confirmed_at": "2025-12-01T10:00:00Z"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `401 Unauthorized` - Email ou senha incorretos
|
||||
- `400 Bad Request` - Dados inválidos
|
||||
|
||||
---
|
||||
|
||||
#### 1.3 Logout
|
||||
```http
|
||||
POST /auth/logout
|
||||
Authorization: Bearer {token}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"message": "Logout realizado com sucesso"
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `401 Unauthorized` - Token inválido ou expirado
|
||||
|
||||
---
|
||||
|
||||
#### 1.4 Obter Perfil Atual
|
||||
```http
|
||||
GET /auth/me
|
||||
Authorization: Bearer {token}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"userId": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"email": "user@example.com",
|
||||
"iat": 1701427200,
|
||||
"exp": 1702032000
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `401 Unauthorized` - Token inválido ou expirado
|
||||
|
||||
---
|
||||
|
||||
#### 1.5 Recuperar Senha
|
||||
```http
|
||||
POST /auth/forgot-password
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"email": "user@example.com"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"message": "Email de recuperação enviado. Verifique sua caixa de entrada."
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2. Tarefas (Tasks) - Em Desenvolvimento
|
||||
|
||||
#### 2.1 Listar Tarefas
|
||||
```http
|
||||
GET /tasks
|
||||
Authorization: Bearer {token}
|
||||
|
||||
# Query params opcionais:
|
||||
?status=all|completed|pending
|
||||
?sort=created_at|updated_at
|
||||
?order=asc|desc
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "6b1f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
|
||||
"user_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"title": "Fazer compras",
|
||||
"description": "Ir ao supermercado",
|
||||
"completed": false,
|
||||
"created_at": "2025-12-01T10:00:00Z",
|
||||
"updated_at": "2025-12-01T10:00:00Z"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"page": 1
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 2.2 Obter Tarefa Específica
|
||||
```http
|
||||
GET /tasks/:id
|
||||
Authorization: Bearer {token}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"id": "6b1f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
|
||||
"user_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"title": "Fazer compras",
|
||||
"description": "Ir ao supermercado",
|
||||
"completed": false,
|
||||
"created_at": "2025-12-01T10:00:00Z",
|
||||
"updated_at": "2025-12-01T10:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `404 Not Found` - Tarefa não encontrada
|
||||
- `401 Unauthorized` - Token inválido
|
||||
|
||||
---
|
||||
|
||||
#### 2.3 Criar Tarefa
|
||||
```http
|
||||
POST /tasks
|
||||
Authorization: Bearer {token}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"title": "Fazer compras",
|
||||
"description": "Ir ao supermercado"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (201 Created):**
|
||||
```json
|
||||
{
|
||||
"id": "6b1f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
|
||||
"user_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"title": "Fazer compras",
|
||||
"description": "Ir ao supermercado",
|
||||
"completed": false,
|
||||
"created_at": "2025-12-01T10:00:00Z",
|
||||
"updated_at": "2025-12-01T10:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `400 Bad Request` - Título obrigatório
|
||||
- `401 Unauthorized` - Token inválido
|
||||
|
||||
---
|
||||
|
||||
#### 2.4 Atualizar Tarefa
|
||||
```http
|
||||
PATCH /tasks/:id
|
||||
Authorization: Bearer {token}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"title": "Fazer compras (atualizado)",
|
||||
"description": "Ir ao supermercado e padaria",
|
||||
"completed": true
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"id": "6b1f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
|
||||
"user_id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"title": "Fazer compras (atualizado)",
|
||||
"description": "Ir ao supermercado e padaria",
|
||||
"completed": true,
|
||||
"created_at": "2025-12-01T10:00:00Z",
|
||||
"updated_at": "2025-12-01T10:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `404 Not Found` - Tarefa não encontrada
|
||||
- `400 Bad Request` - Dados inválidos
|
||||
- `401 Unauthorized` - Token inválido
|
||||
|
||||
---
|
||||
|
||||
#### 2.5 Deletar Tarefa
|
||||
```http
|
||||
DELETE /tasks/:id
|
||||
Authorization: Bearer {token}
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
```json
|
||||
{
|
||||
"message": "Tarefa deletada com sucesso"
|
||||
}
|
||||
```
|
||||
|
||||
**Erros:**
|
||||
- `404 Not Found` - Tarefa não encontrada
|
||||
- `401 Unauthorized` - Token inválido
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Real-time (WebSocket)
|
||||
|
||||
### Conectar ao Realtime
|
||||
```javascript
|
||||
const subscription = supabase
|
||||
.channel('tasks')
|
||||
.on('postgres_changes',
|
||||
{ event: '*', schema: 'public', table: 'tasks' },
|
||||
(payload) => console.log(payload)
|
||||
)
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
### Eventos
|
||||
- `INSERT` - Nova tarefa criada
|
||||
- `UPDATE` - Tarefa atualizada
|
||||
- `DELETE` - Tarefa deletada
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Códigos de Erro
|
||||
|
||||
| Código | Significado |
|
||||
|--------|-------------|
|
||||
| `200` | OK - Requisição bem-sucedida |
|
||||
| `201` | Created - Recurso criado |
|
||||
| `400` | Bad Request - Dados inválidos |
|
||||
| `401` | Unauthorized - Token inválido/expirado |
|
||||
| `404` | Not Found - Recurso não encontrado |
|
||||
| `409` | Conflict - Recurso já existe |
|
||||
| `500` | Internal Server Error - Erro do servidor |
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Exemplo Completo (cURL)
|
||||
|
||||
### 1. Registrar
|
||||
```bash
|
||||
curl -X POST http://localhost:3000/api/auth/signup \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email": "user@example.com",
|
||||
"password": "securepassword123",
|
||||
"name": "João"
|
||||
}'
|
||||
```
|
||||
|
||||
### 2. Login
|
||||
```bash
|
||||
curl -X POST http://localhost:3000/api/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email": "user@example.com",
|
||||
"password": "securepassword123"
|
||||
}'
|
||||
```
|
||||
|
||||
### 3. Criar Tarefa (com token)
|
||||
```bash
|
||||
curl -X POST http://localhost:3000/api/tasks \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
|
||||
-d '{
|
||||
"title": "Fazer compras",
|
||||
"description": "Ir ao supermercado"
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Referências
|
||||
|
||||
- **Supabase Docs**: https://supabase.com/docs
|
||||
- **NestJS Docs**: https://docs.nestjs.com
|
||||
- **JWT**: https://jwt.io
|
||||
|
||||
---
|
||||
|
||||
**API Status**: ✅ Pronta para Desenvolvimento
|
||||
**Última Atualização**: 1 de dezembro de 2025
|
||||
98
backend-api/README.md
Normal file
98
backend-api/README.md
Normal file
@@ -0,0 +1,98 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
|
||||
## Description
|
||||
|
||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
||||
|
||||
## Project setup
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
## Compile and run the project
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ npm run start
|
||||
|
||||
# watch mode
|
||||
$ npm run start:dev
|
||||
|
||||
# production mode
|
||||
$ npm run start:prod
|
||||
```
|
||||
|
||||
## Run tests
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ npm run test
|
||||
|
||||
# e2e tests
|
||||
$ npm run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ npm run test:cov
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
||||
|
||||
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
||||
|
||||
```bash
|
||||
$ npm install -g @nestjs/mau
|
||||
$ mau deploy
|
||||
```
|
||||
|
||||
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
||||
|
||||
## Resources
|
||||
|
||||
Check out a few resources that may come in handy when working with NestJS:
|
||||
|
||||
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
||||
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
||||
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
||||
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
||||
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
||||
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
||||
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
||||
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
||||
35
backend-api/eslint.config.mjs
Normal file
35
backend-api/eslint.config.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
// @ts-check
|
||||
import eslint from '@eslint/js';
|
||||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: ['eslint.config.mjs'],
|
||||
},
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
eslintPluginPrettierRecommended,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.jest,
|
||||
},
|
||||
sourceType: 'commonjs',
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-floating-promises': 'warn',
|
||||
'@typescript-eslint/no-unsafe-argument': 'warn',
|
||||
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
||||
},
|
||||
},
|
||||
);
|
||||
8
backend-api/nest-cli.json
Normal file
8
backend-api/nest-cli.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/nest-cli",
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src",
|
||||
"compilerOptions": {
|
||||
"deleteOutDir": true
|
||||
}
|
||||
}
|
||||
10381
backend-api/package-lock.json
generated
Normal file
10381
backend-api/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
81
backend-api/package.json
Normal file
81
backend-api/package.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "backend-api",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"build": "nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^11.0.1",
|
||||
"@nestjs/config": "^4.0.2",
|
||||
"@nestjs/core": "^11.0.1",
|
||||
"@nestjs/jwt": "^11.0.1",
|
||||
"@nestjs/passport": "^11.0.5",
|
||||
"@nestjs/platform-express": "^11.0.1",
|
||||
"@supabase/supabase-js": "^2.86.0",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.3",
|
||||
"dotenv": "^17.2.3",
|
||||
"joi": "^18.0.2",
|
||||
"passport": "^0.7.0",
|
||||
"passport-jwt": "^4.0.1",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.2.0",
|
||||
"@eslint/js": "^9.18.0",
|
||||
"@nestjs/cli": "^11.0.0",
|
||||
"@nestjs/schematics": "^11.0.0",
|
||||
"@nestjs/testing": "^11.0.1",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^22.10.7",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-prettier": "^5.2.2",
|
||||
"globals": "^16.0.0",
|
||||
"jest": "^30.0.0",
|
||||
"prettier": "^3.4.2",
|
||||
"source-map-support": "^0.5.21",
|
||||
"supertest": "^7.0.0",
|
||||
"ts-jest": "^29.2.5",
|
||||
"ts-loader": "^9.5.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.20.0"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"rootDir": "src",
|
||||
"testRegex": ".*\\.spec\\.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
},
|
||||
"collectCoverageFrom": [
|
||||
"**/*.(t|j)s"
|
||||
],
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
}
|
||||
22
backend-api/src/app.controller.spec.ts
Normal file
22
backend-api/src/app.controller.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
describe('AppController', () => {
|
||||
let appController: AppController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const app: TestingModule = await Test.createTestingModule({
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
}).compile();
|
||||
|
||||
appController = app.get<AppController>(AppController);
|
||||
});
|
||||
|
||||
describe('root', () => {
|
||||
it('should return "Hello World!"', () => {
|
||||
expect(appController.getHello()).toBe('Hello World!');
|
||||
});
|
||||
});
|
||||
});
|
||||
12
backend-api/src/app.controller.ts
Normal file
12
backend-api/src/app.controller.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
}
|
||||
48
backend-api/src/app.module.ts
Normal file
48
backend-api/src/app.module.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import appConfig from './config/app.config';
|
||||
import databaseConfig from './config/database.config';
|
||||
import jwtConfig from './config/jwt.config';
|
||||
import { SupabaseService } from './config/supabase.service';
|
||||
import { JwtStrategy } from './auth/strategies/jwt.strategy';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
load: [appConfig, databaseConfig, jwtConfig],
|
||||
validationSchema: Joi.object({
|
||||
NODE_ENV: Joi.string()
|
||||
.valid('development', 'production', 'test')
|
||||
.default('development'),
|
||||
PORT: Joi.number().default(3000),
|
||||
SUPABASE_URL: Joi.string().required(),
|
||||
SUPABASE_ANON_KEY: Joi.string().required(),
|
||||
SUPABASE_SERVICE_KEY: Joi.string().required(),
|
||||
JWT_SECRET: Joi.string().min(32).required(),
|
||||
}),
|
||||
}),
|
||||
PassportModule.register({ defaultStrategy: 'jwt' }),
|
||||
JwtModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
inject: [ConfigService],
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
secret: configService.get<string>('jwt.secret'),
|
||||
signOptions: {
|
||||
expiresIn: '7d' as const,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
AuthModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService, SupabaseService, JwtStrategy],
|
||||
exports: [SupabaseService, JwtModule],
|
||||
})
|
||||
export class AppModule {}
|
||||
8
backend-api/src/app.service.ts
Normal file
8
backend-api/src/app.service.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
75
backend-api/src/auth/auth.controller.ts
Normal file
75
backend-api/src/auth/auth.controller.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import {
|
||||
Controller,
|
||||
Post,
|
||||
Body,
|
||||
Get,
|
||||
UseGuards,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
} from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { SignupDto } from './dto/signup.dto';
|
||||
import { LoginDto } from './dto/login.dto';
|
||||
import { JwtAuthGuard } from './guards/jwt.guard';
|
||||
import { CurrentUser } from '../common/decorators/current-user.decorator';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
/**
|
||||
* POST /auth/signup
|
||||
* Registrar novo usuário
|
||||
*/
|
||||
@Post('signup')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
async signup(@Body() signupDto: SignupDto) {
|
||||
return this.authService.signup(signupDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /auth/login
|
||||
* Fazer login
|
||||
*/
|
||||
@Post('login')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async login(@Body() loginDto: LoginDto) {
|
||||
return this.authService.login(loginDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /auth/logout
|
||||
* Fazer logout
|
||||
*/
|
||||
@Post('logout')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async logout(@CurrentUser() user: any) {
|
||||
return this.authService.logout(user.userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /auth/me
|
||||
* Obter dados do usuário autenticado
|
||||
*/
|
||||
@Get('me')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
async getProfile(@CurrentUser() user: any) {
|
||||
return {
|
||||
userId: user.userId,
|
||||
email: user.email,
|
||||
iat: user.iat,
|
||||
exp: user.exp,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /auth/forgot-password
|
||||
* Solicitar reset de senha
|
||||
*/
|
||||
@Post('forgot-password')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async forgotPassword(@Body('email') email: string) {
|
||||
return this.authService.requestPasswordReset(email);
|
||||
}
|
||||
}
|
||||
11
backend-api/src/auth/auth.module.ts
Normal file
11
backend-api/src/auth/auth.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { JwtStrategy } from './strategies/jwt.strategy';
|
||||
|
||||
@Module({
|
||||
controllers: [AuthController],
|
||||
providers: [AuthService, JwtStrategy],
|
||||
exports: [AuthService],
|
||||
})
|
||||
export class AuthModule {}
|
||||
145
backend-api/src/auth/auth.service.ts
Normal file
145
backend-api/src/auth/auth.service.ts
Normal file
@@ -0,0 +1,145 @@
|
||||
import { Injectable, UnauthorizedException, ConflictException } from '@nestjs/common';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { SupabaseService } from '../config/supabase.service';
|
||||
import { SignupDto } from './dto/signup.dto';
|
||||
import { LoginDto } from './dto/login.dto';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
constructor(
|
||||
private readonly supabaseService: SupabaseService,
|
||||
private readonly jwtService: JwtService,
|
||||
private readonly configService: ConfigService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Registrar novo usuário
|
||||
*/
|
||||
async signup(signupDto: SignupDto) {
|
||||
try {
|
||||
// Criar usuário no Supabase Auth
|
||||
const user = await this.supabaseService.createUser(
|
||||
signupDto.email,
|
||||
signupDto.password,
|
||||
);
|
||||
|
||||
// Criar registro do usuário na tabela users (opcional)
|
||||
// await this.usersService.create({
|
||||
// id: user.id,
|
||||
// email: user.email,
|
||||
// name: signupDto.name,
|
||||
// });
|
||||
|
||||
// Gerar token JWT
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
|
||||
return {
|
||||
access_token: token,
|
||||
user: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
email_confirmed_at: user.email_confirmed_at,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.message?.includes('already registered')) {
|
||||
throw new ConflictException('Email já está registrado');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fazer login
|
||||
*/
|
||||
async login(loginDto: LoginDto) {
|
||||
try {
|
||||
const supabase = this.supabaseService.getClient();
|
||||
|
||||
const { data, error } = await supabase.auth.signInWithPassword({
|
||||
email: loginDto.email,
|
||||
password: loginDto.password,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw new UnauthorizedException('Email ou senha incorretos');
|
||||
}
|
||||
|
||||
// Gerar token JWT customizado
|
||||
const token = this.generateToken(data.user.id, data.user.email);
|
||||
|
||||
return {
|
||||
access_token: token,
|
||||
user: {
|
||||
id: data.user.id,
|
||||
email: data.user.email,
|
||||
email_confirmed_at: data.user.email_confirmed_at,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
throw new UnauthorizedException('Email ou senha incorretos');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fazer logout (validação do token)
|
||||
*/
|
||||
async logout(userId: string) {
|
||||
// Em um sistema real, você poderia adicionar o token a uma blacklist
|
||||
// Por enquanto, apenas validamos que o usuário tem um token válido
|
||||
return { message: 'Logout realizado com sucesso' };
|
||||
}
|
||||
|
||||
/**
|
||||
* Validar token e retornar dados do usuário
|
||||
*/
|
||||
async validateToken(token: string) {
|
||||
try {
|
||||
const decoded = this.jwtService.verify(token);
|
||||
return decoded;
|
||||
} catch (error) {
|
||||
throw new UnauthorizedException('Token inválido ou expirado');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gerar token JWT
|
||||
*/
|
||||
private generateToken(userId: string, email: string): string {
|
||||
const payload = {
|
||||
sub: userId,
|
||||
email: email,
|
||||
iat: Math.floor(Date.now() / 1000),
|
||||
};
|
||||
|
||||
return this.jwtService.sign(payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recuperar senha (envia email com link de reset)
|
||||
*/
|
||||
async requestPasswordReset(email: string) {
|
||||
try {
|
||||
const supabase = this.supabaseService.getClient();
|
||||
|
||||
const { error } = await supabase.auth.resetPasswordForEmail(email, {
|
||||
redirectTo: `${process.env.FRONTEND_URL || 'http://localhost:3000'}/reset-password`,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return {
|
||||
message: 'Email de recuperação enviado. Verifique sua caixa de entrada.',
|
||||
};
|
||||
} catch (error) {
|
||||
// Não revelar se o email existe ou não por segurança
|
||||
return {
|
||||
message: 'Se o email existir, você receberá um link de recuperação.',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
10
backend-api/src/auth/dto/login.dto.ts
Normal file
10
backend-api/src/auth/dto/login.dto.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { IsEmail, IsString, MinLength } from 'class-validator';
|
||||
|
||||
export class LoginDto {
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@IsString()
|
||||
@MinLength(8)
|
||||
password: string;
|
||||
}
|
||||
13
backend-api/src/auth/dto/signup.dto.ts
Normal file
13
backend-api/src/auth/dto/signup.dto.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { IsEmail, IsString, MinLength } from 'class-validator';
|
||||
|
||||
export class SignupDto {
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@IsString()
|
||||
@MinLength(8)
|
||||
password: string;
|
||||
|
||||
@IsString()
|
||||
name?: string;
|
||||
}
|
||||
5
backend-api/src/auth/guards/jwt.guard.ts
Normal file
5
backend-api/src/auth/guards/jwt.guard.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Injectable()
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {}
|
||||
24
backend-api/src/auth/strategies/jwt.strategy.ts
Normal file
24
backend-api/src/auth/strategies/jwt.strategy.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||
|
||||
@Injectable()
|
||||
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
constructor(private configService: ConfigService) {
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
ignoreExpiration: false,
|
||||
secretOrKey: configService.get<string>('jwt.secret'),
|
||||
});
|
||||
}
|
||||
|
||||
async validate(payload: any) {
|
||||
return {
|
||||
userId: payload.sub,
|
||||
email: payload.email,
|
||||
iat: payload.iat,
|
||||
exp: payload.exp,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
||||
|
||||
export const CurrentUser = createParamDecorator(
|
||||
(data: unknown, ctx: ExecutionContext) => {
|
||||
const request = ctx.switchToHttp().getRequest();
|
||||
return request.user;
|
||||
},
|
||||
);
|
||||
11
backend-api/src/config/app.config.ts
Normal file
11
backend-api/src/config/app.config.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('app', () => ({
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
port: parseInt(process.env.PORT || '3000', 10),
|
||||
apiPrefix: process.env.API_PREFIX || '/api',
|
||||
cors: {
|
||||
origin: process.env.CORS_ORIGIN?.split(',') || ['http://localhost:3000'],
|
||||
credentials: true,
|
||||
},
|
||||
}));
|
||||
8
backend-api/src/config/database.config.ts
Normal file
8
backend-api/src/config/database.config.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('database', () => ({
|
||||
supabaseUrl: process.env.SUPABASE_URL,
|
||||
supabaseAnonKey: process.env.SUPABASE_ANON_KEY,
|
||||
supabaseServiceKey: process.env.SUPABASE_SERVICE_KEY,
|
||||
databaseUrl: process.env.DATABASE_URL,
|
||||
}));
|
||||
6
backend-api/src/config/jwt.config.ts
Normal file
6
backend-api/src/config/jwt.config.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('jwt', () => ({
|
||||
secret: process.env.JWT_SECRET,
|
||||
expiresIn: process.env.JWT_EXPIRATION || '7d',
|
||||
}));
|
||||
40
backend-api/src/config/supabase.service.ts
Normal file
40
backend-api/src/config/supabase.service.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Injectable()
|
||||
export class SupabaseService {
|
||||
private supabaseClient;
|
||||
|
||||
constructor(private configService: ConfigService) {
|
||||
const supabaseUrl = this.configService.get<string>('database.supabaseUrl');
|
||||
const supabaseKey = this.configService.get<string>('database.supabaseServiceKey');
|
||||
|
||||
if (!supabaseUrl || !supabaseKey) {
|
||||
throw new Error('SUPABASE_URL and SUPABASE_SERVICE_KEY must be defined');
|
||||
}
|
||||
|
||||
this.supabaseClient = createClient(supabaseUrl, supabaseKey);
|
||||
}
|
||||
|
||||
getClient() {
|
||||
return this.supabaseClient;
|
||||
}
|
||||
|
||||
// Helper para criar usuario
|
||||
async createUser(email: string, password: string) {
|
||||
const { data, error } = await this.supabaseClient.auth.admin.createUser({
|
||||
email,
|
||||
password,
|
||||
email_confirm: true,
|
||||
});
|
||||
|
||||
if (error) throw error;
|
||||
return data.user;
|
||||
}
|
||||
|
||||
// Helper para fazer queries
|
||||
async query(table: string, method: 'select' | 'insert' | 'update' | 'delete' = 'select') {
|
||||
return this.supabaseClient.from(table)[method]();
|
||||
}
|
||||
}
|
||||
32
backend-api/src/main.ts
Normal file
32
backend-api/src/main.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
// Validação global
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
}),
|
||||
);
|
||||
|
||||
// CORS
|
||||
app.enableCors({
|
||||
origin: process.env.CORS_ORIGIN?.split(',') || 'http://localhost:3000',
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
// API Prefix
|
||||
const port = process.env.PORT ?? 3000;
|
||||
const apiPrefix = process.env.API_PREFIX ?? '/api';
|
||||
|
||||
app.setGlobalPrefix(apiPrefix);
|
||||
await app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`🚀 Server running on http://localhost:${port}${apiPrefix}`);
|
||||
});
|
||||
}
|
||||
bootstrap();
|
||||
9
backend-api/src/users/dto/create-user.dto.ts
Normal file
9
backend-api/src/users/dto/create-user.dto.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { IsString, IsEmail } from 'class-validator';
|
||||
|
||||
export class CreateUserDto {
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@IsString()
|
||||
name?: string;
|
||||
}
|
||||
25
backend-api/test/app.e2e-spec.ts
Normal file
25
backend-api/test/app.e2e-spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import request from 'supertest';
|
||||
import { App } from 'supertest/types';
|
||||
import { AppModule } from './../src/app.module';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let app: INestApplication<App>;
|
||||
|
||||
beforeEach(async () => {
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
imports: [AppModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it('/ (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Hello World!');
|
||||
});
|
||||
});
|
||||
9
backend-api/test/jest-e2e.json
Normal file
9
backend-api/test/jest-e2e.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"moduleFileExtensions": ["js", "json", "ts"],
|
||||
"rootDir": ".",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
||||
4
backend-api/tsconfig.build.json
Normal file
4
backend-api/tsconfig.build.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
||||
}
|
||||
25
backend-api/tsconfig.json
Normal file
25
backend-api/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
"resolvePackageJsonExports": true,
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"target": "ES2023",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"strictNullChecks": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": false,
|
||||
"strictBindCallApply": false,
|
||||
"noFallthroughCasesInSwitch": false
|
||||
}
|
||||
}
|
||||
773
docs/instrucoes-design.md
Normal file
773
docs/instrucoes-design.md
Normal file
@@ -0,0 +1,773 @@
|
||||
# 🎨 TASK MANAGER - Design System & Guia de Interface
|
||||
|
||||
## 🌈 Paleta de Cores
|
||||
|
||||
### Cores Principais
|
||||
- **Primary (Azul)**: `#2563EB` - Ações principais, links, seleção
|
||||
- **Primary Dark**: `#1D4ED8` - Estados hover/ativo
|
||||
- **Primary Light**: `#DBEAFE` - Backgrounds, estados desabilitados
|
||||
- **White**: `#FFFFFF` - Backgrounds principal
|
||||
- **Black**: `#000000` - Texto principal, contrastes fortes
|
||||
- **Gray 50**: `#F9FAFB` - Backgrounds secundários
|
||||
- **Gray 100**: `#F3F4F6` - Borders leves
|
||||
- **Gray 200**: `#E5E7EB` - Borders padrão
|
||||
- **Gray 400**: `#9CA3AF` - Texto secundário, placeholders
|
||||
- **Gray 600**: `#4B5563` - Texto terciário
|
||||
|
||||
### Cores de Status
|
||||
- **Success**: `#10B981` - Tarefas concluídas
|
||||
- **Warning**: `#F59E0B` - Alertas
|
||||
- **Error**: `#EF4444` - Erros, deletar
|
||||
- **Info**: `#06B6D4` - Informações
|
||||
|
||||
---
|
||||
|
||||
## 🔤 Tipografia (Google Fonts)
|
||||
|
||||
### Fonte Principal: **Inter**
|
||||
- Link: https://fonts.google.com/specimen/Inter
|
||||
- Uso: Corpo de texto, UI, labels
|
||||
|
||||
### Fonte Secundária: **Poppins**
|
||||
- Link: https://fonts.google.com/specimen/Poppins
|
||||
- Uso: Títulos, headings, destaque
|
||||
|
||||
### Escala Tipográfica
|
||||
|
||||
| Nome | Tamanho | Weight | Line Height | Letra-espaçamento | Uso |
|
||||
|------|---------|--------|-------------|------------------|-----|
|
||||
| **H1** | 32px | 700 (Bold) | 40px | -0.5px | Títulos principais |
|
||||
| **H2** | 24px | 700 (Bold) | 32px | -0.3px | Subtítulos |
|
||||
| **H3** | 18px | 600 (SemiBold) | 28px | -0.2px | Seções |
|
||||
| **Body Large** | 16px | 400 (Regular) | 24px | 0px | Texto principal |
|
||||
| **Body Normal** | 14px | 400 (Regular) | 22px | 0px | Descrições |
|
||||
| **Body Small** | 12px | 400 (Regular) | 18px | 0.2px | Ajuda, captions |
|
||||
| **Label** | 12px | 600 (SemiBold) | 18px | 0.5px | Labels de campos |
|
||||
| **Button** | 14px | 600 (SemiBold) | 20px | 0.5px | Texto de botões |
|
||||
|
||||
### Importação no CSS/Next.js
|
||||
```css
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700&display=swap');
|
||||
|
||||
:root {
|
||||
--font-inter: 'Inter', sans-serif;
|
||||
--font-poppins: 'Poppins', sans-serif;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Espaçamento (8px Base)
|
||||
|
||||
Seguindo o padrão Material Design + Tailwind, usando múltiplos de 8px:
|
||||
|
||||
| Token | Valor | Uso |
|
||||
|-------|-------|-----|
|
||||
| **xs** | 4px | Micro-espaçamentos |
|
||||
| **sm** | 8px | Padding pequeno |
|
||||
| **md** | 12px | Padding padrão |
|
||||
| **lg** | 16px | Espaçamento interno |
|
||||
| **xl** | 24px | Separação entre elementos |
|
||||
| **2xl** | 32px | Separação entre seções |
|
||||
| **3xl** | 48px | Grandes divisores |
|
||||
| **4xl** | 64px | Muito grandes |
|
||||
|
||||
### Exemplos de Aplicação
|
||||
- **Padding de Botão**: 12px (vertical) × 16px (horizontal)
|
||||
- **Padding de Card**: 24px
|
||||
- **Gap entre inputs**: 16px
|
||||
- **Margin entre seções**: 32px
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Componentes - Design System
|
||||
|
||||
### 1️⃣ **BOTÕES**
|
||||
|
||||
#### Botão Primary (Padrão)
|
||||
```
|
||||
Tamanho: 48px altura
|
||||
Padding: 12px vertical × 16px horizontal
|
||||
Background: #2563EB
|
||||
Text: White, 14px Bold
|
||||
Border Radius: 8px
|
||||
Font Weight: 600
|
||||
```
|
||||
|
||||
**Estados:**
|
||||
- **Default**: Background #2563EB
|
||||
- **Hover**: Background #1D4ED8, Sombra leve
|
||||
- **Active**: Background #1D4ED8, sem sombra
|
||||
- **Disabled**: Background #E5E7EB, Text #9CA3AF, sem cursor
|
||||
|
||||
#### Botão Secondary
|
||||
```
|
||||
Background: #F3F4F6
|
||||
Text: #000000, 14px Bold
|
||||
Border: 1px #E5E7EB
|
||||
Border Radius: 8px
|
||||
```
|
||||
|
||||
#### Botão Tertiary (Text only)
|
||||
```
|
||||
Background: transparent
|
||||
Text: #2563EB, 14px Bold
|
||||
Padding: 12px 16px
|
||||
```
|
||||
|
||||
#### Botão Danger
|
||||
```
|
||||
Background: #EF4444
|
||||
Text: White, 14px Bold
|
||||
Sombra: 0px 4px 12px rgba(239, 68, 68, 0.2)
|
||||
```
|
||||
|
||||
#### Botão com Ícone
|
||||
```
|
||||
Spacing entre ícone e texto: 8px
|
||||
Ícone tamanho: 20px × 20px
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2️⃣ **CAMPOS DE ENTRADA (Inputs)**
|
||||
|
||||
#### Input Padrão
|
||||
```
|
||||
Altura: 44px
|
||||
Padding: 12px 16px
|
||||
Border: 1px #E5E7EB
|
||||
Border Radius: 8px
|
||||
Font: Inter 14px
|
||||
Background: #FFFFFF
|
||||
```
|
||||
|
||||
**Estados:**
|
||||
- **Default**: Border #E5E7EB, Background #FFFFFF
|
||||
- **Focus**: Border #2563EB (2px), Background #FFFFFF, Box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1)
|
||||
- **Filled**: Border #2563EB
|
||||
- **Error**: Border #EF4444, Background #FEF2F2
|
||||
- **Disabled**: Border #E5E7EB, Background #F9FAFB, Text #9CA3AF
|
||||
|
||||
#### Placeholder
|
||||
```
|
||||
Color: #9CA3AF
|
||||
Font Style: Regular
|
||||
```
|
||||
|
||||
#### Label
|
||||
```
|
||||
Font: Poppins 12px SemiBold
|
||||
Color: #000000
|
||||
Margin Bottom: 8px
|
||||
Required indicator (*): Color #EF4444
|
||||
```
|
||||
|
||||
#### Help Text
|
||||
```
|
||||
Font: Inter 12px Regular
|
||||
Color: #6B7280
|
||||
Margin Top: 4px
|
||||
```
|
||||
|
||||
#### Error Message
|
||||
```
|
||||
Font: Inter 12px Regular
|
||||
Color: #EF4444
|
||||
Icon: 16px × 16px (⚠️)
|
||||
Margin Top: 4px
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3️⃣ **CARDS**
|
||||
|
||||
```
|
||||
Background: #FFFFFF
|
||||
Border: 1px #E5E7EB
|
||||
Border Radius: 12px
|
||||
Padding: 24px
|
||||
Box Shadow: 0px 1px 3px rgba(0, 0, 0, 0.1)
|
||||
```
|
||||
|
||||
**Hover (Interactive):**
|
||||
```
|
||||
Box Shadow: 0px 4px 12px rgba(0, 0, 0, 0.08)
|
||||
Transition: 150ms
|
||||
```
|
||||
|
||||
#### Task Card
|
||||
```
|
||||
Padding: 16px
|
||||
Border Radius: 12px
|
||||
Background: #FFFFFF
|
||||
Border: 1px #E5E7EB
|
||||
|
||||
Estrutura:
|
||||
├── Checkbox (20px × 20px)
|
||||
├── Conteúdo (Flex: 1)
|
||||
│ ├── Título: 14px Bold, #000000
|
||||
│ └── Descrição: 13px Regular, #6B7280
|
||||
└── Menu/Delete: 24px × 24px (Right)
|
||||
|
||||
Spacing: 12px entre elementos
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 4️⃣ **CHECKBOX & RADIO**
|
||||
|
||||
#### Checkbox
|
||||
```
|
||||
Tamanho: 20px × 20px
|
||||
Border: 2px #E5E7EB
|
||||
Border Radius: 4px
|
||||
Background: #FFFFFF
|
||||
Padding: 2px (interno)
|
||||
```
|
||||
|
||||
**Estados:**
|
||||
- **Unchecked**: Border #E5E7EB, Background #FFFFFF
|
||||
- **Checked**: Border #2563EB, Background #2563EB, Ícone ✓ branco
|
||||
- **Focus**: Box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1)
|
||||
- **Disabled**: Border #E5E7EB, Background #F3F4F6
|
||||
|
||||
---
|
||||
|
||||
### 5️⃣ **TABS**
|
||||
|
||||
```
|
||||
Height: 48px
|
||||
Font: Inter 14px SemiBold
|
||||
Color: #6B7280 (inactive), #2563EB (active)
|
||||
Border Bottom: 2px #2563EB (active)
|
||||
Padding: 16px horizontal
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 6️⃣ **MODALS/DIALOGS**
|
||||
|
||||
```
|
||||
Background: #FFFFFF
|
||||
Border Radius: 16px
|
||||
Padding: 32px
|
||||
Width: 90% (mobile), 520px (desktop)
|
||||
Max Height: 90vh
|
||||
Box Shadow: 0px 20px 25px rgba(0, 0, 0, 0.15)
|
||||
Overlay: rgba(0, 0, 0, 0.5)
|
||||
```
|
||||
|
||||
**Estrutura:**
|
||||
```
|
||||
├── Header
|
||||
│ ├── Título: H2
|
||||
│ └── Close button: 24px (top right)
|
||||
├── Content
|
||||
│ └── Padding: 24px 0
|
||||
└── Footer (Actions)
|
||||
├── Button Secondary (Cancel): Left
|
||||
└── Button Primary (Confirm): Right
|
||||
└── Spacing: 12px entre botões
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 7️⃣ **ÍCONES (Google Icons)**
|
||||
|
||||
Link: https://fonts.google.com/icons
|
||||
|
||||
**Tamanhos Padrão:**
|
||||
- **Small**: 16px - Lado de inputs, help text
|
||||
- **Normal**: 20px - Ícones em botões, menus
|
||||
- **Large**: 24px - Ícones principais, headers
|
||||
- **XL**: 32px - Ícones de estado vazio, sucesso
|
||||
|
||||
**Cor Principal**: #2563EB
|
||||
**Cor Secundária**: #6B7280
|
||||
**Cor Erro**: #EF4444
|
||||
|
||||
**Ícones Recomendados:**
|
||||
- check_circle (Concluído)
|
||||
- radio_button_unchecked (Não concluído)
|
||||
- delete (Deletar)
|
||||
- edit (Editar)
|
||||
- close (Fechar)
|
||||
- menu (Menu)
|
||||
- search (Buscar)
|
||||
- add (Adicionar)
|
||||
- logout (Sair)
|
||||
- login (Entrar)
|
||||
- person (Perfil)
|
||||
- error (Erro)
|
||||
- warning (Aviso)
|
||||
- info (Info)
|
||||
|
||||
---
|
||||
|
||||
## 📱 **NEXT.JS - Estrutura de Componentes**
|
||||
|
||||
### Diretório
|
||||
```
|
||||
frontend-next/
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ │ ├── ui/
|
||||
│ │ │ ├── Button.tsx
|
||||
│ │ │ ├── Input.tsx
|
||||
│ │ │ ├── Card.tsx
|
||||
│ │ │ ├── Checkbox.tsx
|
||||
│ │ │ ├── Modal.tsx
|
||||
│ │ │ ├── Toast.tsx
|
||||
│ │ │ └── Spinner.tsx
|
||||
│ │ ├── forms/
|
||||
│ │ │ ├── TaskForm.tsx
|
||||
│ │ │ ├── LoginForm.tsx
|
||||
│ │ │ └── SignupForm.tsx
|
||||
│ │ ├── tasks/
|
||||
│ │ │ ├── TaskItem.tsx
|
||||
│ │ │ ├── TaskList.tsx
|
||||
│ │ │ └── TaskFilters.tsx
|
||||
│ │ ├── layout/
|
||||
│ │ │ ├── Header.tsx
|
||||
│ │ │ ├── Sidebar.tsx
|
||||
│ │ │ └── Footer.tsx
|
||||
│ │ └── common/
|
||||
│ │ ├── EmptyState.tsx
|
||||
│ │ └── LoadingState.tsx
|
||||
│ ├── lib/
|
||||
│ │ ├── styles/
|
||||
│ │ │ ├── colors.ts
|
||||
│ │ │ ├── spacing.ts
|
||||
│ │ │ ├── typography.ts
|
||||
│ │ │ └── shadows.ts
|
||||
│ │ └── utils.ts
|
||||
│ ├── app/
|
||||
│ │ ├── globals.css
|
||||
│ │ ├── layout.tsx
|
||||
│ │ ├── page.tsx
|
||||
│ │ ├── (auth)/
|
||||
│ │ │ ├── login/page.tsx
|
||||
│ │ │ └── signup/page.tsx
|
||||
│ │ └── (dashboard)/
|
||||
│ │ └── tasks/page.tsx
|
||||
│ └── styles/
|
||||
│ └── tailwind.config.ts
|
||||
```
|
||||
|
||||
### Configuração Tailwind (tailwind.config.ts)
|
||||
```typescript
|
||||
import type { Config } from 'tailwindcss'
|
||||
|
||||
export default {
|
||||
content: [
|
||||
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: {
|
||||
DEFAULT: '#2563EB',
|
||||
dark: '#1D4ED8',
|
||||
light: '#DBEAFE',
|
||||
},
|
||||
gray: {
|
||||
50: '#F9FAFB',
|
||||
100: '#F3F4F6',
|
||||
200: '#E5E7EB',
|
||||
400: '#9CA3AF',
|
||||
600: '#4B5563',
|
||||
},
|
||||
status: {
|
||||
success: '#10B981',
|
||||
warning: '#F59E0B',
|
||||
error: '#EF4444',
|
||||
info: '#06B6D4',
|
||||
},
|
||||
},
|
||||
fontFamily: {
|
||||
inter: ['var(--font-inter)', 'sans-serif'],
|
||||
poppins: ['var(--font-poppins)', 'sans-serif'],
|
||||
},
|
||||
fontSize: {
|
||||
'h1': ['32px', { lineHeight: '40px', fontWeight: '700', letterSpacing: '-0.5px' }],
|
||||
'h2': ['24px', { lineHeight: '32px', fontWeight: '700', letterSpacing: '-0.3px' }],
|
||||
'h3': ['18px', { lineHeight: '28px', fontWeight: '600', letterSpacing: '-0.2px' }],
|
||||
'body-lg': ['16px', { lineHeight: '24px', fontWeight: '400' }],
|
||||
'body': ['14px', { lineHeight: '22px', fontWeight: '400' }],
|
||||
'body-sm': ['12px', { lineHeight: '18px', fontWeight: '400', letterSpacing: '0.2px' }],
|
||||
'label': ['12px', { lineHeight: '18px', fontWeight: '600', letterSpacing: '0.5px' }],
|
||||
'btn': ['14px', { lineHeight: '20px', fontWeight: '600', letterSpacing: '0.5px' }],
|
||||
},
|
||||
spacing: {
|
||||
'xs': '4px',
|
||||
'sm': '8px',
|
||||
'md': '12px',
|
||||
'lg': '16px',
|
||||
'xl': '24px',
|
||||
'2xl': '32px',
|
||||
'3xl': '48px',
|
||||
'4xl': '64px',
|
||||
},
|
||||
borderRadius: {
|
||||
'sm': '4px',
|
||||
'md': '8px',
|
||||
'lg': '12px',
|
||||
'xl': '16px',
|
||||
},
|
||||
boxShadow: {
|
||||
'sm': '0px 1px 3px rgba(0, 0, 0, 0.1)',
|
||||
'md': '0px 4px 12px rgba(0, 0, 0, 0.08)',
|
||||
'lg': '0px 20px 25px rgba(0, 0, 0, 0.15)',
|
||||
'focus': '0 0 0 3px rgba(37, 99, 235, 0.1)',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
} satisfies Config
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 **FLUTTER - Design System**
|
||||
|
||||
### Diretório
|
||||
```
|
||||
mobile/
|
||||
├── lib/
|
||||
│ ├── config/
|
||||
│ │ ├── theme.dart
|
||||
│ │ ├── colors.dart
|
||||
│ │ ├── typography.dart
|
||||
│ │ └── spacing.dart
|
||||
│ ├── widgets/
|
||||
│ │ ├── buttons/
|
||||
│ │ │ ├── primary_button.dart
|
||||
│ │ │ ├── secondary_button.dart
|
||||
│ │ │ └── tertiary_button.dart
|
||||
│ │ ├── inputs/
|
||||
│ │ │ ├── text_input.dart
|
||||
│ │ │ ├── checkbox_input.dart
|
||||
│ │ │ └── form_field.dart
|
||||
│ │ ├── cards/
|
||||
│ │ │ ├── task_card.dart
|
||||
│ │ │ └── card.dart
|
||||
│ │ ├── common/
|
||||
│ │ │ ├── modal.dart
|
||||
│ │ │ ├── empty_state.dart
|
||||
│ │ │ └── loading_state.dart
|
||||
│ │ └── app/
|
||||
│ │ ├── app_bar.dart
|
||||
│ │ └── bottom_nav.dart
|
||||
│ ├── screens/
|
||||
│ │ ├── auth/
|
||||
│ │ │ ├── login_screen.dart
|
||||
│ │ │ └── signup_screen.dart
|
||||
│ │ ├── tasks/
|
||||
│ │ │ ├── tasks_screen.dart
|
||||
│ │ │ ├── task_detail_screen.dart
|
||||
│ │ │ └── create_task_screen.dart
|
||||
│ │ └── profile/
|
||||
│ │ └── profile_screen.dart
|
||||
│ └── main.dart
|
||||
```
|
||||
|
||||
### Colors (colors.dart)
|
||||
```dart
|
||||
abstract class AppColors {
|
||||
// Primary
|
||||
static const Color primary = Color(0xFF2563EB);
|
||||
static const Color primaryDark = Color(0xFF1D4ED8);
|
||||
static const Color primaryLight = Color(0xFFDBEAFE);
|
||||
|
||||
// Base
|
||||
static const Color white = Color(0xFFFFFFFF);
|
||||
static const Color black = Color(0xFF000000);
|
||||
|
||||
// Gray
|
||||
static const Color gray50 = Color(0xFFF9FAFB);
|
||||
static const Color gray100 = Color(0xFFF3F4F6);
|
||||
static const Color gray200 = Color(0xFFE5E7EB);
|
||||
static const Color gray400 = Color(0xFF9CA3AF);
|
||||
static const Color gray600 = Color(0xFF4B5563);
|
||||
|
||||
// Status
|
||||
static const Color success = Color(0xFF10B981);
|
||||
static const Color warning = Color(0xFFF59E0B);
|
||||
static const Color error = Color(0xFFEF4444);
|
||||
static const Color info = Color(0xFF06B6D4);
|
||||
}
|
||||
```
|
||||
|
||||
### Theme (theme.dart)
|
||||
```dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'colors.dart';
|
||||
|
||||
final ThemeData appTheme = ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: ColorScheme(
|
||||
brightness: Brightness.light,
|
||||
primary: AppColors.primary,
|
||||
onPrimary: AppColors.white,
|
||||
secondary: AppColors.gray600,
|
||||
onSecondary: AppColors.white,
|
||||
error: AppColors.error,
|
||||
onError: AppColors.white,
|
||||
background: AppColors.white,
|
||||
onBackground: AppColors.black,
|
||||
surface: AppColors.white,
|
||||
onSurface: AppColors.black,
|
||||
),
|
||||
fontFamily: 'Inter',
|
||||
textTheme: TextTheme(
|
||||
displayLarge: TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: -0.5,
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
displayMedium: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: -0.3,
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
headlineSmall: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.2,
|
||||
fontFamily: 'Poppins',
|
||||
),
|
||||
bodyLarge: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.5,
|
||||
),
|
||||
bodyMedium: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.57,
|
||||
),
|
||||
bodySmall: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: 0.2,
|
||||
height: 1.5,
|
||||
),
|
||||
labelMedium: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
);
|
||||
```
|
||||
|
||||
### Spacing (spacing.dart)
|
||||
```dart
|
||||
abstract class AppSpacing {
|
||||
static const double xs = 4.0;
|
||||
static const double sm = 8.0;
|
||||
static const double md = 12.0;
|
||||
static const double lg = 16.0;
|
||||
static const double xl = 24.0;
|
||||
static const double xxl = 32.0;
|
||||
static const double xxxl = 48.0;
|
||||
static const double xxxxl = 64.0;
|
||||
}
|
||||
```
|
||||
|
||||
### Exemplo de Componente - Primary Button
|
||||
```dart
|
||||
class PrimaryButton extends StatelessWidget {
|
||||
final String label;
|
||||
final VoidCallback onPressed;
|
||||
final bool isLoading;
|
||||
final bool isEnabled;
|
||||
final IconData? icon;
|
||||
|
||||
const PrimaryButton({
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
this.isLoading = false,
|
||||
this.isEnabled = true,
|
||||
this.icon,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: isEnabled && !isLoading ? onPressed : null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primary,
|
||||
disabledBackgroundColor: AppColors.gray200,
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: AppSpacing.md,
|
||||
horizontal: AppSpacing.lg,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: isLoading
|
||||
? SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
isEnabled ? AppColors.white : AppColors.gray400,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
Icon(icon, size: 20),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
],
|
||||
Text(label),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 **PADRÕES DE LAYOUT**
|
||||
|
||||
### Responsividade Next.js
|
||||
|
||||
```
|
||||
Mobile: < 640px (default)
|
||||
Tablet: 640px - 1024px
|
||||
Desktop: > 1024px
|
||||
```
|
||||
|
||||
### Breakpoints (Tailwind)
|
||||
```typescript
|
||||
sm: '640px'
|
||||
md: '768px'
|
||||
lg: '1024px'
|
||||
xl: '1280px'
|
||||
2xl: '1536px'
|
||||
```
|
||||
|
||||
### Safe Area (Flutter)
|
||||
```dart
|
||||
Scaffold(
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
child: YourContent(),
|
||||
),
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📐 **ANIMAÇÕES & TRANSIÇÕES**
|
||||
|
||||
### Next.js (Tailwind)
|
||||
```
|
||||
Duration padrão: 150ms
|
||||
Easing: cubic-bezier(0.4, 0, 0.2, 1)
|
||||
Propriedades: transform, opacity, color, box-shadow
|
||||
```
|
||||
|
||||
**Exemplo:**
|
||||
```css
|
||||
.button {
|
||||
@apply transition-all duration-150 ease-in-out;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
@apply scale-105 shadow-md;
|
||||
}
|
||||
```
|
||||
|
||||
### Flutter
|
||||
```dart
|
||||
Duration animationDuration = Duration(milliseconds: 150);
|
||||
Curve animationCurve = Curves.easeInOut;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ **ACESSIBILIDADE**
|
||||
|
||||
### Contraste de Cores (WCAG AA)
|
||||
- Ratio mínimo: 4.5:1 para textos normais
|
||||
- Ratio mínimo: 3:1 para textos grandes
|
||||
|
||||
### Next.js
|
||||
- Usar `<label htmlFor="">` para inputs
|
||||
- Alt text em imagens
|
||||
- Semantic HTML (button, form, etc)
|
||||
|
||||
### Flutter
|
||||
- Semantics widget para leitura de tela
|
||||
- Sufficient touch targets (mínimo 48x48 dp)
|
||||
|
||||
---
|
||||
|
||||
## 📋 **CHECKLIST DE DESIGN**
|
||||
|
||||
- [ ] Cores aplicadas conforme paleta
|
||||
- [ ] Tipografia usando Inter e Poppins
|
||||
- [ ] Espaçamento em múltiplos de 8px
|
||||
- [ ] Componentes com 4 estados (default, hover, active, disabled)
|
||||
- [ ] Ícones do Google Icons (20px padrão)
|
||||
- [ ] Botões com altura mínima de 48px
|
||||
- [ ] Inputs com altura de 44px
|
||||
- [ ] Cards com border-radius 12px
|
||||
- [ ] Box shadows consistentes
|
||||
- [ ] Responsive design funcional
|
||||
- [ ] Acessibilidade testada
|
||||
- [ ] Loading states em todas as ações
|
||||
- [ ] Error states claros
|
||||
- [ ] Empty states amigáveis
|
||||
|
||||
---
|
||||
|
||||
## 🔗 **REFERÊNCIAS & RECURSOS**
|
||||
|
||||
### Ferramentas
|
||||
- **Figma**: Para prototipar (opcional)
|
||||
- **Google Fonts**: https://fonts.google.com
|
||||
- **Google Icons**: https://fonts.google.com/icons
|
||||
- **Color Checker**: https://webaim.org/resources/contrastchecker/
|
||||
|
||||
### Documentação
|
||||
- **Tailwind CSS**: https://tailwindcss.com/docs
|
||||
- **Next.js**: https://nextjs.org/docs
|
||||
- **Flutter**: https://flutter.dev/docs
|
||||
- **Material Design 3**: https://m3.material.io/
|
||||
|
||||
---
|
||||
|
||||
## 💾 **IMPLEMENTAÇÃO IMEDIATA**
|
||||
|
||||
### Next.js - Setup Inicial
|
||||
1. Configurar Tailwind config com tokens
|
||||
2. Criar componentes base (Button, Input, Card)
|
||||
3. Importar Google Fonts em globals.css
|
||||
4. Testar componentes em storybook (opcional)
|
||||
|
||||
### Flutter - Setup Inicial
|
||||
1. Adicionar Google Fonts package
|
||||
2. Criar arquivos de theme
|
||||
3. Implementar componentes customizados
|
||||
4. Testar em multiple devices
|
||||
|
||||
---
|
||||
|
||||
**Mantém Fidelidade ao Design em TODAS as screens! 🎯**
|
||||
238
docs/instrucoes-gerais.md
Normal file
238
docs/instrucoes-gerais.md
Normal file
@@ -0,0 +1,238 @@
|
||||
# 📱 TASK MANAGER - Plano de Desenvolvimento
|
||||
|
||||
## 🎯 Objetivo
|
||||
|
||||
Criar uma aplicação **multi-plataforma sincronizada em tempo real** de gerenciamento de tarefas para estudar desenvolvimento fullstack moderno com TypeScript.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Stack Tecnológica
|
||||
|
||||
### Backend
|
||||
- **NestJS** - Framework Node.js com TypeScript
|
||||
- **Supabase** (`https://supabase.stackbackup.cloud`) - PostgreSQL + Auth + Realtime
|
||||
- **PostgreSQL** - Banco de dados relacional
|
||||
- **Docker** - Containerização
|
||||
|
||||
### Frontend Web
|
||||
- **Next.js 14** - Framework React com App Router
|
||||
- **TailwindCSS** - Framework CSS utility-first
|
||||
- **TypeScript** - Linguagem principal
|
||||
- **Supabase Client** - Cliente JavaScript
|
||||
|
||||
### Mobile
|
||||
- **Flutter** - Framework multi-plataforma (Android/iOS)
|
||||
- **Dart** - Linguagem do Flutter
|
||||
- **Provider** - State management
|
||||
- **Supabase Flutter** - Cliente Dart
|
||||
|
||||
### Ferramentas
|
||||
- **Git/GitHub** - Controle de versão
|
||||
- **VS Code** - IDE
|
||||
|
||||
---
|
||||
|
||||
## 📋 Funcionalidades (MVP)
|
||||
|
||||
### Autenticação
|
||||
- [ ] Cadastro de usuário (email + senha)
|
||||
- [ ] Login
|
||||
- [ ] Logout
|
||||
- [ ] Recuperação de senha
|
||||
- [ ] Sessão persistente
|
||||
|
||||
### Gerenciamento de Tarefas (CRUD)
|
||||
- [ ] Criar tarefa (título + descrição opcional)
|
||||
- [ ] Listar tarefas do usuário
|
||||
- [ ] Marcar como concluída/pendente
|
||||
- [ ] Editar tarefa
|
||||
- [ ] Deletar tarefa
|
||||
- [ ] Filtrar (Todas/Ativas/Concluídas)
|
||||
|
||||
### Sincronização em Tempo Real
|
||||
- [ ] Supabase Realtime (WebSockets)
|
||||
- [ ] Sincronização instantânea entre web e mobile
|
||||
- [ ] Atualização automática em múltiplos dispositivos
|
||||
|
||||
---
|
||||
|
||||
## 🗄️ Banco de Dados
|
||||
|
||||
### Tabela: `tasks`
|
||||
```
|
||||
id (UUID) - Chave primária
|
||||
user_id (UUID) - Referência ao usuário (RLS habilitado)
|
||||
title (TEXT) - Título da tarefa
|
||||
description (TEXT) - Descrição opcional
|
||||
completed (BOOLEAN) - Status da tarefa
|
||||
created_at (TIMESTAMP) - Data de criação
|
||||
updated_at (TIMESTAMP) - Data de atualização
|
||||
```
|
||||
|
||||
### Segurança
|
||||
- Row Level Security (RLS) habilitado
|
||||
- Usuário só acessa suas próprias tarefas
|
||||
|
||||
---
|
||||
|
||||
## 📦 Estrutura do Projeto
|
||||
|
||||
```
|
||||
task-manager/
|
||||
├── backend/
|
||||
│ ├── src/
|
||||
│ │ ├── auth/
|
||||
│ │ ├── tasks/
|
||||
│ │ ├── common/
|
||||
│ │ └── main.ts
|
||||
│ ├── .env
|
||||
│ ├── Dockerfile
|
||||
│ └── package.json
|
||||
├── frontend-web/
|
||||
│ ├── src/
|
||||
│ │ ├── app/
|
||||
│ │ ├── components/
|
||||
│ │ ├── lib/
|
||||
│ │ └── styles/
|
||||
│ ├── .env.local
|
||||
│ └── next.config.js
|
||||
├── mobile/
|
||||
│ ├── lib/
|
||||
│ │ ├── models/
|
||||
│ │ ├── services/
|
||||
│ │ ├── screens/
|
||||
│ │ ├── widgets/
|
||||
│ │ └── main.dart
|
||||
│ └── pubspec.yaml
|
||||
├── docker-compose.yml
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Roadmap de Desenvolvimento
|
||||
|
||||
### Fase 1: Backend (NestJS + Supabase)
|
||||
- [ ] Configurar projeto NestJS com TypeScript
|
||||
- [ ] Integrar Supabase SDK
|
||||
- [ ] Criar módulo de Autenticação
|
||||
- [ ] Criar módulo de Tarefas
|
||||
- [ ] Implementar RLS no banco
|
||||
- [ ] Documentar API
|
||||
- [ ] Dockerfile para backend
|
||||
|
||||
### Fase 2: Frontend Web (Next.js)
|
||||
- [ ] Criar projeto Next.js 14
|
||||
- [ ] Configurar Supabase Client
|
||||
- [ ] Implementar layout e componentes
|
||||
- [ ] Integrar autenticação
|
||||
- [ ] Criar páginas de tarefas
|
||||
- [ ] Implementar Realtime
|
||||
- [ ] Responsividade com Tailwind
|
||||
- [ ] Dockerfile para frontend
|
||||
|
||||
### Fase 3: Mobile (Flutter)
|
||||
- [ ] Criar projeto Flutter
|
||||
- [ ] Integrar Supabase Flutter SDK
|
||||
- [ ] Implementar autenticação
|
||||
- [ ] Criar telas de tarefas
|
||||
- [ ] State management com Provider
|
||||
- [ ] Sincronização em tempo real
|
||||
- [ ] Build para Android e iOS
|
||||
|
||||
### Fase 4: DevOps e Deploy
|
||||
- [ ] Docker Compose para local
|
||||
- [ ] CI/CD pipeline
|
||||
- [ ] Deploy backend (Railway/Render)
|
||||
- [ ] Deploy frontend (Vercel)
|
||||
- [ ] Deploy mobile (App Store/Play Store)
|
||||
|
||||
---
|
||||
|
||||
## 📚 Conhecimentos a Adquirir
|
||||
|
||||
### TypeScript
|
||||
- [ ] Tipos básicos e avançados
|
||||
- [ ] Interfaces e tipos genéricos
|
||||
- [ ] Decoradores (usado no NestJS)
|
||||
|
||||
### NestJS
|
||||
- [ ] Módulos e Providers
|
||||
- [ ] Controllers e Services
|
||||
- [ ] Middleware e Guards
|
||||
- [ ] Integração com banco de dados
|
||||
|
||||
### Supabase
|
||||
- [ ] Row Level Security (RLS)
|
||||
- [ ] Autenticação com JWT
|
||||
- [ ] Realtime Subscriptions
|
||||
- [ ] Migrations SQL
|
||||
|
||||
### Next.js 14
|
||||
- [ ] App Router vs Pages Router
|
||||
- [ ] Server Components e Client Components
|
||||
- [ ] API Routes
|
||||
- [ ] Deployment na Vercel
|
||||
|
||||
### Flutter
|
||||
- [ ] Widgets e layouts
|
||||
- [ ] State management (Provider)
|
||||
- [ ] HTTP client
|
||||
- [ ] Navegação
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Variáveis de Ambiente
|
||||
|
||||
### Backend (.env)
|
||||
```
|
||||
SUPABASE_URL=https://supabase.stackbackup.cloud
|
||||
SUPABASE_KEY=[SUPABASE_ANON_KEY]
|
||||
JWT_SECRET=[SEU_JWT_SECRET]
|
||||
DATABASE_URL=[CONNECTION_STRING]
|
||||
```
|
||||
|
||||
### Frontend Web (.env.local)
|
||||
```
|
||||
NEXT_PUBLIC_SUPABASE_URL=https://supabase.stackbackup.cloud
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=[SUPABASE_ANON_KEY]
|
||||
```
|
||||
|
||||
### Mobile (flutter_dotenv)
|
||||
```
|
||||
SUPABASE_URL=https://supabase.stackbackup.cloud
|
||||
SUPABASE_ANON_KEY=[SUPABASE_ANON_KEY]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Referências Úteis
|
||||
|
||||
- **Supabase**: https://supabase.stackbackup.cloud
|
||||
- **NestJS Docs**: https://docs.nestjs.com
|
||||
- **Next.js Docs**: https://nextjs.org/docs
|
||||
- **Flutter Docs**: https://flutter.dev/docs
|
||||
- **Supabase Flutter**: https://supabase.com/docs/reference/flutter/introduction
|
||||
|
||||
---
|
||||
|
||||
## ✅ Checklist de Início
|
||||
|
||||
- [ ] Criar repositório GitHub
|
||||
- [ ] Clonar e configurar localmente
|
||||
- [ ] Testar acesso ao Supabase
|
||||
- [ ] Instalar dependências
|
||||
- [ ] Executar docker-compose
|
||||
- [ ] Rodar servidor local
|
||||
- [ ] Validar fluxo de autenticação
|
||||
|
||||
---
|
||||
|
||||
## 📌 Próximos Passos
|
||||
|
||||
1. **Hoje**: Revisar este plano
|
||||
2. **Amanhã**: Começar pelo Backend (NestJS)
|
||||
3. **Depois**: Frontend Web (Next.js)
|
||||
4. **Então**: Mobile (Flutter)
|
||||
|
||||
Tudo em TypeScript, tudo integrado, tudo em tempo real! 🔥
|
||||
41
frontend-next/.gitignore
vendored
Normal file
41
frontend-next/.gitignore
vendored
Normal file
@@ -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
|
||||
36
frontend-next/README.md
Normal file
36
frontend-next/README.md
Normal file
@@ -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.
|
||||
BIN
frontend-next/app/favicon.ico
Normal file
BIN
frontend-next/app/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
26
frontend-next/app/globals.css
Normal file
26
frontend-next/app/globals.css
Normal file
@@ -0,0 +1,26 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
34
frontend-next/app/layout.tsx
Normal file
34
frontend-next/app/layout.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
65
frontend-next/app/page.tsx
Normal file
65
frontend-next/app/page.tsx
Normal file
@@ -0,0 +1,65 @@
|
||||
import Image from "next/image";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
18
frontend-next/eslint.config.mjs
Normal file
18
frontend-next/eslint.config.mjs
Normal file
@@ -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
frontend-next/next.config.ts
Normal file
7
frontend-next/next.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
6557
frontend-next/package-lock.json
generated
Normal file
6557
frontend-next/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
frontend-next/package.json
Normal file
26
frontend-next/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "frontend-next",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "16.0.6",
|
||||
"react": "19.2.0",
|
||||
"react-dom": "19.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.0.6",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
7
frontend-next/postcss.config.mjs
Normal file
7
frontend-next/postcss.config.mjs
Normal file
@@ -0,0 +1,7 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
1
frontend-next/public/file.svg
Normal file
1
frontend-next/public/file.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||
|
After Width: | Height: | Size: 391 B |
1
frontend-next/public/globe.svg
Normal file
1
frontend-next/public/globe.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
1
frontend-next/public/next.svg
Normal file
1
frontend-next/public/next.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
frontend-next/public/vercel.svg
Normal file
1
frontend-next/public/vercel.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||
|
After Width: | Height: | Size: 128 B |
1
frontend-next/public/window.svg
Normal file
1
frontend-next/public/window.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||
|
After Width: | Height: | Size: 385 B |
34
frontend-next/tsconfig.json
Normal file
34
frontend-next/tsconfig.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-jsx",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts",
|
||||
"**/*.mts"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user