NotiVet is a comprehensive platform that connects pharmaceutical companies with veterinary professionals through targeted drug information and notifications. Built with Next.js, Prisma, and PostgreSQL.
Prerequisites:
- Docker Desktop running
- ngrok installed and authenticated (ngrok config add-authtoken )
Run this from the project root to spin up everything (DB, Prisma, Next.js, and ngrok) and print a public URL you can open on two laptops:
bash scripts/run_demo.shWhat it does:
- Starts a local PostgreSQL in Docker on host port 6543 (container: notivet-postgres)
- Applies the Prisma schema and seeds demo users/drugs
- Starts Next.js in production on 127.0.0.1:3000
- Starts ngrok and prints the HTTPS URL to use for your demo
Demo users:
- Pharma: [email protected] / password123
- HCP: [email protected] / password123
- Dual User Types: Separate authentication and features for HCPs and pharmaceutical companies
- Drug Database: Comprehensive searchable database with species, delivery methods, and FARAD information
- Targeted Notifications: Pharmaceutical companies can send notifications to HCPs based on species specialties
- Analytics Dashboard: Track message engagement, open rates, and click-through rates
- Saved Drugs: HCPs can save drugs for quick reference
- JWT Authentication: Secure token-based authentication
- Frontend: Next.js 14, React, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, Prisma ORM
- Database: PostgreSQL
- Authentication: JWT tokens with bcryptjs
- Validation: Zod schemas
- Icons: Lucide React
- Node.js 18+ and npm
- PostgreSQL database
- Git
- Clone the repository:
git clone <repository-url>
cd notivet- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.localEdit .env.local with your database connection string and secrets.
Add your OpenAI API key:
OPENAI_API_KEY={OPENAI_API_KEY}
- Set up the database:
# Generate Prisma client
npm run db:generate
# Push schema to database
npm run db:push
# Seed the database with sample data
npm run db:seed- Start the development server:
npm run devThe application will be available at http://localhost:3000.
POST /api/auth/register/hcp- Register HCP userPOST /api/auth/register/pharma- Register pharmaceutical companyPOST /api/auth/login- Login for all user types
GET /api/user/profile- Get user profile (authenticated)PUT /api/user/profile- Update user profile (authenticated)
GET /api/drugs- Search and list drugs (authenticated)POST /api/drugs- Create new drug (pharma only)GET /api/drugs/[id]- Get specific drug (authenticated)PUT /api/drugs/[id]- Update drug (pharma only)DELETE /api/drugs/[id]- Delete drug (pharma only)
GET /api/drugs/saved- Get saved drugsPOST /api/drugs/saved- Save a drugDELETE /api/drugs/saved/[id]- Remove saved drug
GET /api/notifications- Get notifications (HCP: received, Pharma: sent)POST /api/notifications- Send notification (pharma only)POST /api/notifications/[id]/track- Track notification engagement (HCP only)
GET /api/analytics- Get engagement analytics and metrics
The application uses the following main models:
- User: Base user model with UserType (HCP or PHARMA)
- HCPProfile: Extended profile for veterinary professionals
- PharmaProfile: Extended profile for pharmaceutical companies
- Drug: Drug information with species, delivery methods, and FARAD data
- Notification: Messages sent from pharma to HCPs
- NotificationActivity: Tracking for opens/clicks
- Analytics: Aggregated engagement metrics
- SavedDrug: HCP's saved drug references
# Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
# Database
npm run db:generate # Generate Prisma client
npm run db:push # Push schema changes
npm run db:migrate # Create and run migrations
npm run db:studio # Open Prisma Studio
npm run db:seed # Seed database with sample dataAfter running npm run db:seed, you can use these test accounts:
HCP User:
- Email: [email protected]
- Password: password123
- Specialties: Canine, Feline
Pharma User:
- Email: [email protected]
- Password: password123
- Company: PharmaCo Veterinary Solutions
Required environment variables:
DATABASE_URL: PostgreSQL connection stringJWT_SECRET: Secret key for JWT tokensNEXTAUTH_SECRET: Secret for Next.js authNODE_ENV: Environment (development/production)
All protected endpoints require a Bearer token in the Authorization header:
Authorization: Bearer <jwt_token>
Get the token from the login endpoint response.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.