How samar-m3/petmate works
PetMate is a Flutter pet-care client backed by an Express/Prisma API. The evidenced end-to-end flow is authentication: an owner registers or logs in through the app, the API validates and handles the request, and the service reads or writes user records before returning a token and safe profile. README capabilities also include veterinary appointments, community events, pet matching, and a marketplace, but their implementation is not present in the supplied source excerpts; those branches are shown as documented, unverified client capabilities.
Main entry points: auth.routes.ts Auth routes · db.ts Prisma client · app.ts Express app · auth.controller.ts Auth controller
Components 22
Mobile app
- App entry
lib/main.dart - Auth screens
lib/features/auth/presentation/pages/login_page.dart - Auth state
lib/features/auth/presentation/providers/auth_provider.dart - Auth repository
lib/features/auth/data/repositories/auth_repository.dart - API client
lib/core/services/api_client.dart - Vet appointments
lib/features/care_events/screens/appointments - Community events
lib/features/care_events/screens/events - Pet matching
lib/features - Marketplace
lib/features
API runtime
- HTTP server
backend/src/server.ts - Express app
backend/src/app.ts - Error handling
backend/src/middleware/errorHandler.ts - Response envelopes
backend/src/utils/apiResponse.ts
Authentication
- Auth routes
backend/src/modules/auth/auth.routes.ts - Input validation
backend/src/modules/auth/auth.validation.ts - Auth controller
backend/src/modules/auth/auth.controller.ts - Auth service
backend/src/modules/auth/auth.service.ts - JWT middleware
backend/src/middleware/auth.middleware.ts
Persistence
- Prisma client
backend/src/config/db.ts - User records
backend/prisma/schema.prisma - Environment config
backend/src/config/env.ts
Other components
- Pet owner
Connections 24
- Pet owner → Auth screens: uses
README.md - App entry → Auth screens: opens
- Auth screens → Auth state: updates
- Auth state → Auth repository: delegates to
- Auth repository → API client: requests through
- API client → HTTP server: calls API
README.md - Pet owner → Vet appointments: books care
- Pet owner → Community events: joins events
- Pet owner → Pet matching: seeks matches
- Pet owner → Marketplace: shops
- HTTP server → Express app: serves
backend/src/server.ts - Express app → Auth routes: mounts
backend/src/app.ts - Auth routes → Input validation: validates with
backend/src/modules/auth/auth.routes.ts - Auth routes → Auth controller: dispatches to
backend/src/modules/auth/auth.routes.ts - Auth routes → JWT middleware: guards profile
backend/src/modules/auth/auth.routes.ts - Auth controller → Auth service: calls
backend/src/modules/auth/auth.controller.ts - Auth service → Prisma client: queries
backend/src/modules/auth/auth.service.ts - Prisma client → User records: persists users
- Auth service → Environment config: reads JWT config
backend/src/modules/auth/auth.service.ts - JWT middleware → Prisma client: loads user
backend/src/middleware/auth.middleware.ts - Express app → Error handling: handles errors
backend/src/app.ts - Error handling → Response envelopes: sends errors
backend/src/middleware/errorHandler.ts - Auth controller → Response envelopes: sends results
backend/src/modules/auth/auth.controller.ts - Prisma client → Environment config: reads database URL
backend/src/config/db.ts