Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FlasheyEstudi/Oasis-Liquido/llms.txt

Use this file to discover all available pages before exploring further.

Oasis Liquido’s Backend uses SQLite as its database engine, managed through Prisma ORM. The database file lives on disk at the path set by the DATABASE_URL environment variable, requiring no separate database server in development or single-server production deployments. Prisma generates a fully-typed client from the schema, which the Next.js API routes import directly. The schema organises its 16+ models into five domains: identity and role profiles, clinical workflows (clinics, appointments, prescriptions), pharmacy and inventory, sales and delivery logistics, and platform audit logging.

Core models

ModelKey fieldsPurpose
Userid, email, passwordHash, name, role, isActive, emailVerifiedCentral identity record for every person in the system; role drives access control
PatientProfileuserId, dateOfBirth, bloodType, allergies, medicalNotesMedical details attached to users with role patient
DoctorProfileuserId, clinicId, specialty, licenseNumberClinic assignment and credentials for users with role doctor
Appointmentid, patientId, doctorId, clinicId, dateTime, durationMinutes, status, cancellationReasonScheduled consultation between a patient and doctor at a clinic
Prescriptionid, patientId, doctorId, clinicId, appointmentId, status, qrCode, expirationDate, fulfilledPharmacyIdDoctor-issued medication order linked to an appointment; carries a unique QR code for pharmacy scanning
PrescriptionLineid, prescriptionId, medicineId, quantity, dosageInstructions, quantityFulfilledSingle medicine line within a prescription
Pharmacyid, name, address, latitude, longitude, deliveryFee, isActivePhysical pharmacy location that holds inventory and processes sales
Medicineid, name, genericName, dosageForm, concentration, requiresPrescription, isActiveCatalogue entry for a drug or medical product
Inventoryid, pharmacyId, medicineId, quantity, minStock, unitPrice, batchNumber, expirationDateStock record for one medicine at one pharmacy; unique per (pharmacyId, medicineId) pair
InventoryMovementid, inventoryId, userId, type, quantityChange, reasonImmutable ledger entry recording every stock change (restock, sale, adjustment, in, out)
Saleid, pharmacyId, patientId, prescriptionId, appointmentId, isDelivery, deliveryAddress, totalAmount, statusPurchase transaction at a pharmacy or clinic; spawns a DeliveryOrder when isDelivery is true
SaleItemid, saleId, medicineId, quantity, unitPriceLine item within a sale
DeliveryOrderid, saleId, pharmacyId, patientId, deliveryDriverId, status, pickupAddress, deliveryAddress, assignedAt, pickedUpAt, deliveredAtEnd-to-end delivery job linked to a sale; driver location is tracked via DeliveryRoute
DeliveryRouteid, deliveryOrderId, driverLat, driverLng, recordedAtGPS waypoint snapshot appended during active transit
AuditLogid, userId, action, entityType, entityId, details, ipAddress, userAgentAppend-only log of critical platform events; never updated or deleted
RefreshTokenid, userId, tokenHash, expiresAt, revokedAtHashed refresh token stored server-side; revoked on logout or rotation

DB setup commands

1

Set the DATABASE_URL environment variable

Prisma reads the database path from DATABASE_URL. Create a .env file in the Backend directory or export the variable in your shell:
DATABASE_URL="file:./prisma/db/oasis.db"
2

Run migrations

From the Backend directory, apply the schema and generate the Prisma client:
npx prisma migrate dev
3

Seed Nicaragua data

Populate the database with real clinic and pharmacy data using the seed script:
bun prisma/seed.ts
The seed script populates real Nicaragua clinics (Vivian Pellas, Hospital Militar, Bautista) and pharmacy chains (Saba, Kielsa, Medco), along with sample users for every role and a medicine catalogue.

Build docs developers (and LLMs) love