Documentation
Complete guide to the World of Books Explorer platform.
Quick Start
Get the project running in minutes:
# Clone the repository git clone <repo-url> cd product-explorer # Set up environment cp .env.example .env # Start with Docker docker-compose up -d # Or run manually cd backend && npm install && npm run start:dev cd frontend && npm install && npm run dev
API Documentation
Key endpoints available:
GET /api/navigation- Get all navigation itemsGET /api/categories- Get categoriesGET /api/products- Get productsPOST /api/scrape/navigation- Trigger navigation scrapePOST /api/scrape/product/:id- Refresh product data
Database Schema
Main entities in PostgreSQL:
- navigation - Top-level navigation items
- category - Categories with parent-child relationships
- product - Product information
- product_detail - Extended product details
- review - Customer reviews
- scrape_job - Scraping job tracking
- view_history - User browsing history
Ethical Scraping
We follow strict ethical scraping practices:
- • Respect robots.txt and terms of service
- • Implement rate limiting (3-second delays)
- • Cache results for 24 hours
- • Use exponential backoff for retries
- • Set proper User-Agent headers
- • Queue long-running jobs
Deployment
Deploy to production:
Frontend (Vercel):
# Build command npm run build # Environment variables NEXT_PUBLIC_API_URL=https://your-backend.railway.app
Backend (Railway):
# Start command npm run start:prod # Required services - PostgreSQL - Redis - Environment variables from .env
Development
Development scripts:
npm run dev- Start development servernpm run build- Build for productionnpm run test- Run testsnpm run lint- Check code qualitynpm run type-check- TypeScript validation
Project Structure
product-explorer/ ├── backend/ # NestJS backend │ ├── src/ │ │ ├── modules/ # Feature modules │ │ ├── entities/ # TypeORM entities │ │ └── main.ts # Application entry │ ├── database/ # Schema and migrations │ └── test/ # Backend tests ├── frontend/ # Next.js frontend │ ├── src/ │ │ ├── app/ # App router pages │ │ ├── components/ # React components │ │ ├── lib/ # Utilities and hooks │ │ └── providers/ # Context providers │ ├── cypress/ # E2E tests │ └── public/ # Static assets ├── .github/workflows/ # CI/CD pipelines ├── docker-compose.yml # Local development └── README.md # Project documentation