Codebase Summary
Overview of the Pet Service Management System codebase structure and organization.Project Overview
Full-stack web application for managing pet services: boarding, grooming, veterinary care, training, daycare, transportation.Frontend
Next.js 16.0.10 + React 19.2.1
Backend
NestJS 11.0.1 + PostgreSQL
Type Safety
TypeScript 5 Strict Mode
Directory Structure
- Backend
- Frontend
- Documentation
Backend Architecture
Core Modules
auth/ - Authentication & Authorization
auth/ - Authentication & Authorization
bookings/ - Booking Management
bookings/ - Booking Management
- Pet service bookings with status tracking
- Multiple pets per booking support
- Status workflow: PENDING → CONFIRMED → IN_PROGRESS → COMPLETED → CANCELLED
- Pricing calculations and payment tracking
services/ - Service Catalog
services/ - Service Catalog
- 6 categories: BOARDING, GROOMING, VETERINARY, TRAINING, DAYCARE, TRANSPORT
- Multi-language support (JSONB fields)
- Pricing by unit (per day/hour/session)
- Images and descriptions
staff/ - Staff Management
staff/ - Staff Management
- Employee scheduling and availability
- Staff-service proficiency mapping (1-5 skill levels)
- Performance metrics (ratings, booking counts)
- Working hours management
settings/ - Configuration
settings/ - Configuration
- Key-value store with type support
- Grouped settings (GENERAL, PAYMENT, CONTACT)
- Application-wide configuration
dashboard/ - Analytics
dashboard/ - Analytics
- Business metrics and statistics
- User activity monitoring
- Performance reports
prisma/ - Database Service
prisma/ - Database Service
- Database operations via Prisma ORM
- Connection management
- Query optimization
Database Schema
User & Authentication:- User (Better Auth compatible)
- Session (session management)
- Account (OAuth accounts)
- Verification (email verification)
- Pet (medical history, allergies, vaccinations)
- Species: DOG, CAT, BIRD, RABBIT, OTHER
- Service (catalog with JSONB multi-language fields)
- Categories: BOARDING, GROOMING, VETERINARY, TRAINING, DAYCARE, TRANSPORT
- Booking (status tracking, pricing)
- BookingPet (many-to-many: bookings to pets)
- BookingService (many-to-many: bookings to services)
- Status: PENDING, CONFIRMED, IN_PROGRESS, COMPLETED, CANCELLED
- Staff (employee details, availability)
- StaffService (staff-service mapping with proficiency)
- Setting (configuration store)
- AuditLog (user actions, entity changes)
API Endpoints
- Authentication
- Services
- Bookings
- Staff & Settings
Frontend Architecture
Routing Structure
App Router with i18n:- Dynamic locale parameter:
[locale]/ - Supported locales: en, de, fr, ko, ja, vi, lo, km, my, fil
/[locale]/- Home page/[locale]/services- Service listing/[locale]/booking- Booking flow/[locale]/contact- Contact page/[locale]/login- Login/[locale]/register- Registration
/[locale]/dashboard- Dashboard overview/[locale]/dashboard/booking- Booking management/[locale]/dashboard/services- Service management/[locale]/dashboard/staff- Staff management/[locale]/dashboard/settings- Settings
Component Architecture
Layout Components:- Header.tsx - Navigation header
- Footer.tsx - Footer with contact
- DashboardHeader.tsx - Dashboard header
- LanguageSwitcher.tsx - Language selection
- lib/api/ - API client functions
- lib/auth-client.ts - Better Auth config
- lib/auth-helpers.ts - Auth utilities
- lib/transformers.ts - Data transformation
Multi-Language Support
next-intl Implementation:- 10 language support with JSON message files
- Dynamic language switching
- Locale-aware routing
Technology Stack
- Backend
- Frontend
| Package | Version | Purpose |
|---|---|---|
| NestJS | ^11.0.1 | Backend framework |
| Prisma | ^5.22.0 | ORM |
| Better Auth | ^1.4.7 | Authentication |
| TypeScript | ^5.7.3 | Type safety |
Development Patterns
Backend
- Feature-based modules (Auth, Bookings, Services)
- Each module: controller, service, module files
- DTOs for request/response validation
- Guards for authentication/authorization
Frontend
- Functional components with hooks
- Layout components for shared UI
- Page components for routes
- Typed API client functions