saveinmed/frontend
2026-03-07 07:49:58 -06:00
..
docs refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
e2e Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
public Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
src refactor(frontend): replace legacy document typing for billing and categories 2026-03-07 07:49:58 -06:00
.env.example Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
.gitignore fix(frontend): align auth docs and ignore generated files 2026-03-07 06:51:58 -06:00
COMO_ADICIONAR_ENTREGADOR_APPWRITE.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
CONFIGURACAO_COLLECTION_EMPRESAS_DADOS.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
CONFIGURACAO_COLLECTION_USUARIOS.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
CONFIGURACAO_COLLECTION_USUARIOS_DATA.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
CONFIGURACAO_COLLECTIONS_APPWRITE.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
CORRECAO_FORMULARIO_EDICAO_PRODUTOS.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
CORRECAO_MODAL_DETALHES_PRODUTO.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
deno.lock Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
DIAGNOSTICO_ERROS_COLLECTIONS.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
Dockerfile URGENT: Fix 502 with Nginx Dockerfile 2026-02-28 10:07:29 -06:00
eslint.config.mjs Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
IMPLEMENTACAO_COMPLETA_MAPEAMENTO.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
IMPLEMENTACAO_DASHBOARD_DADOS_REAIS.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
IMPLEMENTACAO_MERCADOPAGO_CHECKOUT.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
IMPLEMENTACAO_MODAL_EDICAO_PRODUTOS.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
IMPLEMENTACAO_PAGAMENTOS_CHECKOUT.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
index.html Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
INTEGRACAO_PAGAMENTO_SUCESSO_MERCADOPAGO.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
MARKETPLACE.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
MELHORIAS_AUTENTICACAO_AUTH_APPWRITE.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
MELHORIAS_GESTAO_CATALOGO_PRODUTOS.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
MELHORIAS_MODAL_EDICAO_PRODUTOS.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
next-env.d.ts feat: consolidate architecture, remove bff dependency and update backend/frontend modules 2026-03-07 06:40:42 -06:00
next.config.ts Configure Dockerfile and standalone output for frontend (GHJ pattern) 2026-02-28 08:32:59 -06:00
OTIMIZACOES_PERFORMANCE_DASHBOARD.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
package-lock.json refactor(frontend): remove appwrite package dependency 2026-03-07 07:34:37 -06:00
package.json refactor(frontend): remove appwrite package dependency 2026-03-07 07:34:37 -06:00
PERMISSOES_COLLECTION_USUARIOS.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
playwright.config.ts Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
pnpm-lock.yaml Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
postcss.config.cjs Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
postcss.config.mjs Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
PRODUTOS_CATALOGO_IMPLEMENTACAO.md Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
README.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
route.ts Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
SOLUCAO_ERROS_REGISTRO.md refactor(frontend): remove app-router bff references 2026-03-07 07:04:27 -06:00
tailwind.config.ts Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
test-carrinho.js Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
test-completar-registro.js Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
test-pedido.js Update frontend with Next.js version (gohorsejobs pattern) 2026-02-28 08:31:43 -06:00
tsc-errors.txt feat: consolidate architecture, remove bff dependency and update backend/frontend modules 2026-03-07 06:40:42 -06:00
tsconfig.json feat: consolidate architecture, remove bff dependency and update backend/frontend modules 2026-03-07 06:40:42 -06:00
tsconfig.node.json Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00
vite.config.ts Fix Vite config to listen on host 0.0.0.0 and port 8080 (resolve 502) 2026-02-28 08:57:04 -06:00
vitest.config.ts Restore original Vite-based frontend in the monorepo 2026-02-28 08:38:11 -06:00

Nota de atualização

Este documento contém referências históricas a BFF, Appwrite ou papéis legados. No fluxo ativo do frontend, a referência correta é API direta e os papéis válidos são admin, owner, employee e delivery.

Frontend - SaveInMed Marketplace

React + Vite + TypeScript + Tailwind CSS

Estado Atual

  • Fluxo ativo de autenticação: API direta via VITE_API_URL
  • Fluxo ativo não depende de BFF
  • Papéis suportados no frontend ativo: admin, owner, employee, delivery
  • superadmin e aliases antigos (seller, colaborador, entregador, dono) existem apenas como compatibilidade de legado
  • Documento canonico da arquitetura atual: docs/arquitetura-atual.md

Estrutura de src/

src/
|-- assets/         -> Logo, imagens estáticas
|-- components/     -> Componentes reutilizáveis
|-- context/        -> React Context (auth, tema)
|-- hooks/          -> Custom hooks
|-- layouts/        -> Layouts de página
|-- pages/          -> Páginas organizadas por contexto e perfil
|   |-- auth/           -> Login
|   |-- marketplace/    -> Search, Cart, Checkout, Orders, OrderDetails
|   `-- dashboard/
|       |-- admin/      -> Painel administrativo
|       |-- seller/     -> Área do `owner` (nome de pasta legado)
|       |-- employee/   -> Área do `employee`
|       |-- delivery/   -> Área do `delivery`
|       |-- Company.tsx
|       `-- MyProfile.tsx
|-- services/       -> Clientes HTTP por domínio
|-- stores/         -> Zustand (carrinho, filtros, UI global)
|-- types/          -> Tipos TypeScript compartilhados
`-- utils/          -> format, jwt, logger

Importações absolutas

Utilize o alias @/ (aponta para src/):

import { useAuth } from '@/context/AuthContext'

Gerenciamento de estado

Estado Estratégia
Auth (JWT, user) Context API (AuthContext) + apiClient
Tema claro/escuro Context API (ThemeContext)
Carrinho Zustand (cartStore)
Filtros de busca Zustand / usePersistentFilters
Estado UI local useState no componente

Regra: Context apenas para auth e tema. O restante fica em Zustand ou estado local.

Scripts

pnpm dev
pnpm build
pnpm test
pnpm lint

Autenticação e API

VITE_API_URL=https://api-dev.saveinmed.com.br
  • O login ativo chama POST /v1/auth/login
  • O frontend injeta o token JWT em Authorization: Bearer <token>
  • Não usar NEXT_PUBLIC_BFF_API_URL para o app Vite ativo

Roles suportadas

  • admin
  • owner
  • employee
  • delivery

Observação sobre legado

O repositório ainda contém páginas e serviços legados em src/app/... e stubs antigos. Esses arquivos não devem ser usados como referência de arquitetura nova sem revisão.