Trust is a foundational requirement for a B2B2C mobility marketplace. Before a vendor can list a vehicle, an organization must be verified. Before a corporate organization can make bookings, its authorized representative must be confirmed. Before a vehicle enters service, its registration, insurance, and fitness certificate must all clear review. KaroKar models this not as a simpleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Codefied-CodePix/Karokar-backend/llms.txt
Use this file to discover all available pages before exploring further.
isVerified: boolean flag on each entity, but as a fully independent Verification Domain that maintains complete lifecycle records — who was verified, what was verified, how it was verified, when it was verified, when it expires, and who approved it. This design supports auditing, expiry tracking, document references, and future integration with external authorities without touching any other domain’s schema.
Why Not Boolean Flags?
The alternative — addingisVerified fields directly to Vendor, Vehicle, and User entities — was explicitly considered and rejected. Boolean flags provide no history, no expiry support, no auditability, and no path to multiple verification types. They make external integration painful and compliance reporting impossible. Verification is a business process, not an entity attribute.
In Phase 01, all verifications are performed manually by Platform Admins. A platform administrator reviews uploaded documents and transitions the verification through its lifecycle states. The architecture is designed so that future external integrations (NADRA, driving license authorities, insurance providers, biometric systems) can feed into the same framework without any structural changes.
Verifiable Entity Types
The verification framework is generic. Any domain entity can be verified by recording aVerification row that points to it via entityType + entityId.
DRIVER, BOOKING, CONTRACT, and INSURANCE_POLICY are anticipated and require only a new enum value — no schema changes.
Verification Types by Entity
Each entity type carries its own set of domain-specific verification requirements.Organization
OrganizationVerificationType
COMPANY_REGISTRATIONTAX_REGISTRATIONAUTHORIZED_REPRESENTATIVE
User
UserVerificationType
EMAILPHONEIDENTITY
Vehicle
VehicleVerificationType
REGISTRATIONINSURANCEFITNESS_CERTIFICATE
The Verification Entity
TheVerification entity is the central record of the domain. Its verificationType column is stored as a plain string rather than a single enum, which allows all three type enums to feed into the same table without a discriminated union schema.
(organizationId, entityType, entityId) and (entityType, entityId, verificationType) ensure that looking up all verifications for a given entity — a common access pattern during gatekeeping checks — is performant even at large scale.
Verification Statuses
Verification Lifecycle
Requested → PENDING
An entity (Vendor, Corporate, or Vehicle owner) submits documents. A
Verification record is created with status: PENDING and requestedAt is stamped. A VerificationRequested domain event is emitted, which notifies the Notification and Audit domains.PENDING → UNDER_REVIEW
A Platform Admin picks up the verification case. The status transitions to
UNDER_REVIEW as the admin examines the attached documents.UNDER_REVIEW → VERIFIED or REJECTED
- Approved:
statusbecomesVERIFIED,verifiedAtandverifiedByare stamped. If the verification type requires an expiry (e.g., vehicle insurance),expiresAtis set. AVerificationApprovedevent is emitted. - Declined:
statusbecomesREJECTED. The submitter is notified via theVerificationRejectedevent so they can correct and resubmit.
VERIFIED → EXPIRED
A background job monitors
expiresAt for all VERIFIED records. When the validity period elapses, the status transitions to EXPIRED and a VerificationExpired domain event is emitted. The Fleet Domain and Compliance Domain subscribe to this event to restrict the entity’s capabilities.Verification Document References
Supporting documents (CNIC, business registration certificates, insurance certificates, vehicle registration papers) are uploaded to and owned by the Document Domain. The Verification Domain references them without owning them.Expiry Tracking and Domain Events
Not all verification types expire. Email and phone verifications are indefinite. Vehicle insurance and fitness certificates have strict validity windows. TheexpiresAt field is nullable — it is populated only when the specific verification type requires it.
| Verification Type | Expiry Required | Renewal Required |
|---|---|---|
COMPANY_REGISTRATION | No | No |
TAX_REGISTRATION | No | No |
AUTHORIZED_REPRESENTATIVE | No | No |
EMAIL | No | No |
PHONE | No | No |
IDENTITY | No | No |
REGISTRATION | No | No |
INSURANCE | Yes | Yes |
FITNESS_CERTIFICATE | Yes | Yes |
VerificationExpired event fires, the following domains react:
- Fleet Domain — may suspend the vehicle from availability
- Notification Domain — alerts the relevant organization
- Compliance Domain — logs the expiry for regulatory reporting
Verification Gatekeeping
Certain platform actions are gated behind specific verification requirements. These rules are configurable — they must not be hardcoded into service logic.Vendor listing a vehicle
Vendor listing a vehicle
Requires:
OrganizationVerificationType.COMPANY_REGISTRATION → VERIFIEDVehicle activation for bookings
Vehicle activation for bookings
Requires all of:
VehicleVerificationType.REGISTRATION→VERIFIEDVehicleVerificationType.INSURANCE→VERIFIEDVehicleVerificationType.FITNESS_CERTIFICATE→VERIFIED
Corporate organization booking a vehicle
Corporate organization booking a vehicle
Requires: Organization-level verification for the corporate tenant →
VERIFIEDFuture External Integrations
Phase 01 is manual-only, but the framework is deliberately integration-ready. External providers update verification records through the same domain model — they do not bypass it. Planned future integrations include:- NADRA — automated national identity verification
- Driving License Authority — license validation for drivers
- Insurance Providers — real-time policy status checks
- FBR — tax registration number validation
- Biometric Providers — liveness and identity matching
VerificationApproved or VerificationRejected events through the same lifecycle, ensuring audit trails and downstream reactions remain consistent regardless of whether a human or an external API performed the review.