DV
March 20266 min read

How I Built MedTrust

The Spark Behind MedTrust

Every great project starts with a problem worth solving. In the healthcare industry, verifying the credentials of medical professionals is a critical but often slow, manual, and error-prone process. Institutions spend weeks or even months verifying a doctor's education, certifications, and work history before they can begin practicing. I wanted to build something better.

MedTrust was born from a simple question: What if credential verification could be instant, transparent, and trustworthy?

Choosing the Tech Stack

When I started planning MedTrust, I needed a stack that could handle complex data relationships, deliver a fast user experience, and scale as the platform grew. After careful consideration, I landed on:

  • Next.js — For the frontend and API routes. The App Router gave me a clean way to organize pages, layouts, and server-side logic.
  • TypeScript — Non-negotiable for a project of this scale. Type safety caught dozens of bugs before they ever reached production.
  • Prisma — The ORM made working with PostgreSQL feel natural. Schema migrations, type-safe queries, and a great developer experience.
  • PostgreSQL — The backbone of MedTrust's data layer. Relational data was the right fit for credentials, institutions, and verification chains.
  • Tailwind CSS — Rapid UI development with a consistent design system.
// Example Prisma schema for credentials
model Credential {
  id            String   @id @default(cuid())
  type          String
  issuer        String
  issuedAt      DateTime
  expiresAt     DateTime?
  verified      Boolean  @default(false)
  professional  Professional @relation(fields: [professionalId], references: [id])
  professionalId String
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt
}

Architecture & Design Decisions

MedTrust follows a modular architecture. Each domain — professionals, institutions, credentials, verifications — has its own set of server actions, API routes, and UI components.

Database Design

The schema centers around three core entities:

  • Professionals — Doctors, nurses, and specialists with their personal information and career history.
  • Credentials — Degrees, certifications, licenses, and board certifications linked to professionals.
  • Verification Requests — Institutions can submit verification requests that go through a structured workflow.
  • I designed the verification workflow as a state machine:

    Pending → In Review → Verified / Rejected

    Each state transition is logged with timestamps and the user who performed the action, creating a complete audit trail.

    API Layer

    I used Next.js API routes for all backend logic. Server actions handle form submissions, while API routes serve data to client components. Authentication is handled through session-based auth with secure HTTP-only cookies.

    // Server action for submitting verification
    async function submitVerification(formData: FormData) {
      "use server";
      
      const credentialId = formData.get("credentialId") as string;
      
      await prisma.verification.create({
        data: {
          credentialId,
          status: "PENDING",
          submittedAt: new Date(),
        },
      });
      
      revalidatePath("/dashboard/verifications");
    }

    Building the UI

    The user interface needed to feel trustworthy and professional — this is healthcare, after all. I opted for a clean, minimal design with plenty of whitespace, clear typography, and a muted color palette with blue accents for trust signals.

    The dashboard features:

    • Real-time status tracking — Verification requests update live.
    • Search & filtering — Institutions can search professionals by name, specialty, or credential type.
    • Document preview — Uploaded credentials can be viewed inline without downloading.
    • Responsive design — Works seamlessly on desktop and tablet devices.

    Challenges I Faced

    1. Complex Query Performance

    As the dataset grew during testing, some queries slowed down significantly. I solved this with Prisma's include and select options to only fetch the fields I needed, plus strategic database indexing.

    2. File Upload Security

    Handling sensitive medical documents required careful attention to security. I implemented file type validation, size limits, and virus scanning before storing any uploaded documents.

    3. State Management

    The verification workflow had edge cases — what happens if a reviewer starts reviewing but doesn't finish? I added timeout logic and proper locking to prevent multiple reviewers from working on the same request.

    Key Takeaways

    Building MedTrust taught me several important lessons:

    • Start with the data model. Getting the schema right upfront saved me from painful refactors later.
    • TypeScript pays for itself. The initial investment in typing everything properly prevented bugs that would have taken hours to debug.
    • Prisma is a game-changer. Migrations, typed queries, and the Prisma Studio GUI made database work enjoyable.
    • Security is not optional. In healthcare, every decision must consider data privacy and compliance.

    What's Next

    MedTrust is still evolving. Upcoming features include:

    • Blockchain-anchored verification receipts for immutable proof
    • API access for third-party integrators
    • AI-powered document analysis for faster credential review

    Building MedTrust reinforced my belief that the best software solves real problems with elegant, well-crafted code. If you're thinking about building something in healthcare tech, my advice is simple: start small, validate the problem, and never compromise on data integrity.