A comprehensive full-stack application for managing pharmacovigilance alerts in compounding pharmacies. Built with Laravel (backend) and Vue.js (frontend) in a monorepo structure.
- Overview
- Features
- Tech Stack
- Architecture
- Installation
- Usage
- API Documentation
- Database Schema
- Design Decisions
- Docker Deployment
This system enables compounding pharmacies to:
- Identify customers who purchased medications with specific lot numbers
- Send email alerts to affected customers
- Track alert history with audit logging
- Manage customer and order information
- β User authentication (Laravel Sanctum)
- β Medication search by lot number and date range
- β Order retrieval with filtering
- β Customer management
- β Individual and bulk email alerts
- β Alert audit logging
- β Responsive UI with Vue.js
- β Pagination support
- β Docker containerization
- β Clean architecture (MVC)
- β Input validation and error handling
- β Reusable Vue components
- β RESTful API design
- Framework: Laravel 13.x
- Authentication: Laravel Sanctum
- Database: MySQL 8.0
- Mail: SMTP (Mailhog for development)
- Framework: Vue 3 (Composition API)
- Build Tool: Vite
- State Management: Pinia
- Routing: Vue Router 4
- HTTP Client: Axios
- Containerization: Docker & Docker Compose
- Database UI: phpMyAdmin
pharmaco-vigilance-alert/
βββ backend/ # Laravel API
β βββ app/
β β βββ Http/Controllers/Api/
β β βββ Mail/
β β βββ Models/
β βββ database/
β β βββ migrations/
β β βββ seeders/
β βββ routes/api.php
βββ frontend/ # Vue.js SPA
β βββ src/
β β βββ components/
β β βββ views/
β β βββ services/
β β βββ stores/
β β βββ router/
β βββ package.json
βββ docker-compose.yml
βββ README.md
- PHP 8.2+
- Composer
- Node.js 18+
- MySQL 8.0
- Docker (optional)
- Navigate to backend directory:
cd backend- Install dependencies:
composer install- Create database:
mysql -u root -p
CREATE DATABASE pharmacovigilance;
exit;- Configure environment (already configured):
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pharmacovigilance
DB_USERNAME=root
DB_PASSWORD=- Run migrations and seed data:
php artisan migrate --seed- Start the server:
php artisan serveBackend will run on http://localhost:8000
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Start development server:
npm run devFrontend will run on http://localhost:5173
- Build and start containers:
docker-compose up -d- Run migrations inside container:
docker exec -it pharmacovigilance_backend php artisan migrate --seedServices:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- phpMyAdmin: http://localhost:8080
- MySQL: localhost:3306
Admin Account:
- Email:
admin@pharmacovigilance.com - Password:
password123
Manager Account:
- Email:
manager@pharmacovigilance.com - Password:
password123
- Login - Access the system with provided credentials
- Search - Navigate to Search page
- Filter - Enter lot number (e.g., 951357) and optional date range
- Review - View list of affected orders
- Alert - Send individual or bulk alerts
- Audit - Check Alert History for sent notifications
Login and get access token
Request:
{
"email": "admin@pharmacovigilance.com",
"password": "password123"
}Response:
{
"message": "Login successful",
"user": {
"id": 1,
"name": "Pharmacovigilance Admin",
"email": "admin@pharmacovigilance.com"
},
"token": "1|abc123..."
}Search medications by lot number
Parameters:
lot_number(required): Medication lot numberstart_date(optional): Start of date rangeend_date(optional): End of date range
Send alert to single customer
Request:
{
"customer_id": 1,
"order_id": 5,
"lot_number": "951357"
}Send bulk alerts
- id, name, email, password, timestamps
- id, name, email, phone, timestamps
- id, name, lot_number (indexed), description, timestamps
- id, customer_id (FK), purchase_date, total_amount, status, timestamps
- id, order_id (FK), medication_id (FK), quantity, unit_price, subtotal, timestamps
- id, customer_id (FK), order_id (FK), user_id (FK), alert_type, message, sent_at, timestamps
- Monorepo Structure: Keeps frontend and backend together for easier development
- RESTful API: Follows REST principles for clean endpoints
- Token-Based Auth: Laravel Sanctum provides secure authentication
- Composition API: Vue 3 for better code organization
- Service Layer: Frontend services abstract API calls
- Password hashing with bcrypt
- Token-based authentication
- Input validation on both sides
- SQL injection prevention through Eloquent ORM
- Database indexing on lot_number
- Pagination support
- Eager loading to prevent N+1 queries
- Axios interceptors for token management
docker-compose up -ddocker-compose downdocker exec -it pharmacovigilance_backend php artisan migrate:fresh --seedThe system comes pre-seeded with:
- 2 users (admin and manager)
- 10 customers
- 8 medications (including lot #951357)
- 20 orders from the last 45 days