Open
Conversation
Author
|
.env frontend NEXT_PUBLIC_API_URL=http://localhost:3001 |
Author
|
.env backend MONGODB_URI=mongodb://localhost:27017/book_reviews |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🇧🇷 Descrição do Pull Request
✅ O que foi implementado
Backend em NestJS com MongoDB (CRUD completo de livros e avaliações)
Rota de agregação: GET /books/top?limit=10 (com avgRating e reviewCount)
Testes e2e cobrindo as principais rotas, incluindo /books/top
Seed com dados fictícios
Frontend em Next.js (App Router) com React Query e Tailwind CSS
Home exibindo os livros top
Página de detalhes com modal para listar/criar/editar avaliações
Layout responsivo (mobile first)
Estrutura MVVM e boas práticas aplicadas
Cache invalidado após novas avaliações (["books", "top", limit])
Docker configurado para MongoDB
🧪 Como rodar
Backend
cd apps/backend
cp .env.example .env
pnpm install
docker-compose up -d
pnpm seed
pnpm test:e2e
Frontend
cd apps/frontend
pnpm install
Criar arquivo .env com o seguinte valor NEXT_PUBLIC_API_URL=http://localhost:3001
pnpm dev
📝 O que falta / melhorias futuras
🔧 Autenticação para avaliações
🔄 Paginação na listagem de livros
🎨 Melhorias de layout e acessibilidade (ARIA)
🧪 Testes para o frontend (ainda não implementados)
⚙️ Considerações técnicas
React Query com cache otimista para criação de avaliações
Dados agregados (avgRating, reviewCount) calculados em tempo real via $lookup + $map no MongoDB
Monorepo organizado com pnpm, separando frontend e backend
🇺🇸 Pull Request Description
✅ What has been implemented
Backend with NestJS and MongoDB (full CRUD for books and reviews)
Aggregation route: GET /books/top?limit=10 (includes avgRating and reviewCount)
e2e tests covering main routes, including /books/top
Seed with fake data
Frontend with Next.js (App Router), React Query, and Tailwind CSS
Home page showing top books
Detail page with modal for listing/creating/editing reviews
Responsive layout (mobile first)
MVVM structure and best practices applied
Cache invalidation after adding reviews (["books", "top", limit])
Docker configured for MongoDB
🧪 How to run
Backend
cd apps/backend
cp .env.example .env
pnpm install
docker-compose up -d
pnpm seed
pnpm test:e2e
Frontend
bash
cd apps/frontend
pnpm install
create a .env file with => NEXT_PUBLIC_API_URL=http://localhost:3001
pnpm dev
📝 What’s missing / future improvements
🔧 Authentication for reviews
🔄 Pagination for book listing
🎨 Layout and accessibility (ARIA) improvements
🧪 Frontend tests (not implemented yet)
⚙️ Technical considerations
React Query with optimistic cache updates for review creation
Aggregated data (avgRating, reviewCount) computed on the fly via MongoDB $lookup + $map
Monorepo structured with pnpm, clean separation between frontend and backend