An all-in-one multi-role pet care and pet services platform.
Connects pet owners, veterinarians, sellers, and event organizers in a unified, modern mobile ecosystem.
PetMate simplifies pet parenting by bringing essential pet-related services together under one roof. Instead of relying on disparate channels for breeding connections, veterinary consultations, supplies, and community gatherings, PetMate delivers a secure, role-based platform designed with an initial focus on the Nepalese market.
- Pet Dating & Matching: Swipe-based matching ("Mating to Dating") for pet breeding and playdates with two-way consent verification.
- Veterinary Appointments: Discover certified veterinarians, check real-time availability slots, and book non-conflicting consultations.
- Multi-Vendor Marketplace: Shop verified pet food, supplements, and accessories with server-enforced pricing.
- Community Events: Register and participate in pet competitions, vaccination drives, and meetups with capacity tracking.
- End-to-End Security: JWT authentication, strict role-based access control (RBAC), and server-verified workflows.
PetMate operates on a granular multi-role authorization model:
| Role | Primary Responsibilities & Capabilities |
|---|---|
| Pet Owner | Manage pet profiles, discover pet partners via swipe matching, chat with confirmed matches, browse & buy products, schedule vet visits, and sign up for community events. |
| Seller | Manage pet supply store profiles, publish product listings, track inventory, and process incoming customer orders upon admin verification. |
| Veterinarian | Set up clinical profiles and credentials, manage availability schedules, specify consultation charges, and conduct booked appointments once verified. |
| Administrator | Moderate platform content, verify seller applications and veterinarian licenses, monitor transactions, oversee platform statistics, and enforce account suspensions. |
- Framework: Flutter (Stable channel) with Dart 3
- Architecture: Feature-first modular organization
- State Management: Riverpod 3 (
Notifier/NotifierProvider) - Navigation: GoRouter
- Networking: HTTP Client with typed error envelopes and automated JWT Bearer token injection
- Persistence:
shared_preferencesfor secure local session caching - UI System: Material 3 with customized PetCare design tokens
- Runtime & Language: Node.js with TypeScript (
tsxruntime execution) - Web Framework: Express.js 5
- ORM & Database: Prisma ORM 7 with PostgreSQL (leveraging
@prisma/adapter-pg) - Authentication: JSON Web Tokens (JWT) &
bcryptjspassword hashing - File & Media Storage: Cloudinary (secure server-side asset handling)
- Real-Time Communication: Socket.IO for real-time messaging
The project is maintained as a cohesive monorepo with the Flutter mobile application at the root and the TypeScript backend service encapsulated in backend/:
petmatee/
βββ android/ # Native Android platform configurations
βββ backend/ # Node.js TypeScript API service
β βββ prisma/
β β βββ migrations/ # Database migration history
β β βββ schema.prisma # Prisma schema models & enums
β βββ src/
β β βββ config/ # Environment and database client configs
β β β βββ db.ts # PrismaClient instance
β β β βββ env.ts # Typed environment loader
β β βββ generated/prisma/ # Generated Prisma Client
β β βββ middleware/ # Auth & error handling middlewares
β β β βββ auth.middleware.ts # JWT & role authorization guards
β β β βββ errorHandler.ts # Centralized error handler
β β βββ modules/ # Modular feature domains
β β β βββ auth/ # Authentication module
β β β βββ auth.controller.ts
β β β βββ auth.routes.ts
β β β βββ auth.service.ts
β β β βββ auth.types.ts
β β β βββ auth.validation.ts
β β βββ utils/ # Standard API response builders
β β βββ app.ts # Express application setup
β β βββ server.ts # Server entry point & graceful shutdown
β βββ package.json
β βββ prisma7.config.ts
β βββ tsconfig.json
βββ lib/ # Flutter mobile application
β βββ core/ # Shared cross-cutting infrastructure
β β βββ config/ # App constants & platform-aware API base URLs
β β βββ constants/ # Color palettes & UI tokens
β β βββ errors/ # Typed exception definitions
β β βββ router/ # GoRouter configuration
β β βββ services/ # ApiClient & StorageService
β β βββ theme/ # Material 3 theme data
β βββ features/ # Feature-first slices
β β βββ auth/ # Auth data, domain & presentation
β β βββ home/ # Landing dashboard & platform navigation
β βββ app.dart # Root ConsumerWidget
β βββ main.dart # Application entry point & ProviderScope setup
βββ test/ # Unit & widget tests
βββ pubspec.yaml # Flutter dependencies
- Flutter SDK (v3.47+ recommended)
- Node.js (v20+ or v24+) &
npm - PostgreSQL (v15+) running locally or remotely
-
Navigate to the backend directory:
cd backend -
Install dependencies:
npm install
-
Configure Environment Variables:
Create or verify.envinbackend/.env:PORT=5000 NODE_ENV=development DATABASE_URL="postgresql://<user>:<password>@localhost:5432/petmate_db?schema=public" JWT_SECRET="your_secure_jwt_secret_key" JWT_EXPIRES_IN="7d" CLOUDINARY_CLOUD_NAME="your_cloud_name" CLOUDINARY_API_KEY="your_api_key" CLOUDINARY_API_SECRET="your_api_secret"
-
Run Database Migrations & Generate Prisma Client:
npx prisma migrate dev npx prisma generate
-
Start the Development Server:
npm run dev
- Server runs at:
http://localhost:5000 - Health check:
http://localhost:5000/api/v1/health
- Server runs at:
-
Navigate to the repository root:
cd .. -
Install Flutter packages:
flutter pub get
-
Verify API Base URL:
Inlib/core/config/app_config.dart, PetMate automatically routes requests:- Android Emulator:
http://10.0.2.2:5000/api/v1 - Web / Desktop / iOS Simulator:
http://localhost:5000/api/v1 - Physical devices: Update with your local machine's IP address (e.g.,
http://192.168.x.x:5000/api/v1).
- Android Emulator:
-
Launch the application:
flutter run
All API routes follow standard RESTful conventions prefixed by /api/v1.
{
"success": true,
"message": "Operation completed successfully",
"data": {
"user": {
"id": "6f26ba44-b606-4cfa-84a2-fc67f4963bea",
"email": "user@example.com",
"fullName": "Jane Doe",
"role": "PET_OWNER",
"status": "ACTIVE"
},
"token": "eyJhbGciOi..."
}
}{
"success": false,
"message": "Validation failed",
"errors": [
"Password must be at least 6 characters long"
]
}| Method | Endpoint | Access | Description |
|---|---|---|---|
GET |
/api/v1/health |
Public | System status and health monitor |
POST |
/api/v1/auth/register |
Public | Register new PET_OWNER, SELLER, or VETERINARIAN |
POST |
/api/v1/auth/login |
Public | Authenticate user and obtain JWT |
GET |
/api/v1/auth/me |
Bearer Token | Fetch authenticated user profile |
- Strict Role Isolation: Public registration is restricted to
PET_OWNER,SELLER, andVETERINARIAN. InitialADMINaccounts are provisioned via secure administrative seed scripts. - Consent-Gated Matching: A right-swipe indicates interest. Both owners must accept before a match is confirmed and real-time chat unlocks.
- Double-Booking Prevention: Veterinary booking slots are verified via transactional locking to eliminate race conditions.
- Server-Side Financial Calculations: Product prices and order totals are calculated exclusively on the backend from trusted database state.
- Session Safety: Suspended accounts are immediately blocked at the authentication middleware level.
# Analyze code quality and formatting
flutter analyze
# Execute Flutter widget and unit tests
flutter testcd backend
# Run TypeScript type verification
npm run typecheck- Branching Strategy: Work on designated feature branches (
feature/<name>) and coordinate Prisma schema changes before applying migrations. - Secrets Protection: Never commit
.envor production credentials. Use local environment files for development. - Commit Standards: Write descriptive, imperative commit messages (e.g.,
feat(auth): add role validation to registration flow).
This project is developed under an academic and proprietary license for PetMate. All rights reserved.