How vandilsonbrito/find-a-friend works
Find A Friend connects animal-welfare organizations with prospective pet adopters. The user workflow is to browse and filter available pets by city and characteristics, view a pet’s details, then contact its organization directly via WhatsApp; organizations register, authenticate, and manage pet listings and profiles. The backend exposes these capabilities through Fastify routes, with repository-backed persistence and Cloudinary image uploads. Edges reflect the sampled routing and client calls or README-described behavior; some controller-to-use-case links are not shown in the excerpts.
Main entry points: App.tsx Web application · app.ts Fastify API · pets/routes.ts Pet routes · orgs/routes.ts Organization routes
Components 22
Adopter and organization web app
- Web application
frontend/src/App.tsx - Pet browsing
frontend/src/pages/Pets.tsx - Pet details
frontend/src/pages/PetDetails.tsx - Organization directory
frontend/src/pages/Organizations.tsx - Organization dashboard
frontend/src/pages/Dashboard.tsx - Organization signup
frontend/src/pages/SignUp.tsx - HTTP client
frontend/src/axios/index.ts - Available-pet query
frontend/src/services/hooks/useGetAvailablePets.ts
API and domain operations
- Fastify API
backend/src/app.ts - Pet routes
backend/src/http/controllers/pets/routes.ts - Organization routes
backend/src/http/controllers/orgs/routes.ts - Auth routes
backend/src/http/controllers/auth/routes.ts - Pet operations
backend/src/use-cases/pets - Organization operations
backend/src/use-cases/orgs
Persistence and media
- Pet repository
backend/src/repositories/prisma/prisma-pets-repository.ts - Organization repository
backend/src/repositories/prisma/prisma-orgs-repository.ts - PostgreSQL database
- Cloudinary image storage
backend/src/services/cloudinary-storage.ts
Authentication
- Session state
frontend/src/context/AuthProvider.tsx - JWT verification
backend/src/http/middlewares/verify-jwt.ts
Other components
- Prospective adopter
- Organization user
Connections 26
- Prospective adopter → Pet browsing: browses pets
- Pet browsing → Available-pet query: loads filters
frontend/src/pages/Pets.tsx - Available-pet query → HTTP client: requests pets
frontend/src/services/hooks/useGetAvailablePets.ts - HTTP client → Fastify API: calls API
- Prospective adopter → Pet details: views details
- Pet details → Organization directory: contacts organization
- Organization user → Organization signup: registers
- Organization user → Organization dashboard: manages listings
- Web application → Session state: provides session
frontend/src/App.tsx - Web application → Pet browsing: routes to
frontend/src/App.tsx - Web application → Pet details: routes to
frontend/src/App.tsx - Web application → Organization directory: routes to
frontend/src/App.tsx - Web application → Organization dashboard: protects route
frontend/src/App.tsx - Fastify API → Pet routes: registers routes
backend/src/app.ts - Fastify API → Organization routes: registers routes
backend/src/app.ts - Fastify API → Auth routes: registers routes
backend/src/app.ts - Pet routes → JWT verification: guards mutations
backend/src/http/controllers/pets/routes.ts - Organization routes → JWT verification: guards profile routes
backend/src/http/controllers/orgs/routes.ts - Auth routes → JWT verification: guards logout
backend/src/http/controllers/auth/routes.ts - Pet routes → Pet operations: dispatches operations
- Organization routes → Organization operations: dispatches operations
- Pet operations → Pet repository: uses repository
- Organization operations → Organization repository: uses repository
- Pet repository → PostgreSQL database: reads and writes
backend/src/repositories/prisma/prisma-pets-repository.ts - Organization repository → PostgreSQL database: persists organizations
- Pet operations → Cloudinary image storage: uploads pet photos