ashishkarki / DijitallNotarer

DijitallNotarer is a digital notarization platform using NestJS (backend), Next.js (frontend), and GraphQL APIs. It integrates LocalStack for AWS services, features a monorepo with Yarn workspaces, and includes CI/CD with GitHub Actions. Ideal for showcasing serverless and modern web tech stacks.
MIT License
0 stars 0 forks source link

Decide how the `Notarization` flow works in terms of doc requirements etc #10

Open ashishkarki opened 1 week ago

ashishkarki commented 1 week ago

How to bring real-world trust and compliance into the Digital Notarization (DN) process. The flow of notarization in the real world is subjective, based on both the document and the identity verification of the individual. Replicating this digitally can definitely go one of two ways:

Option 1: Simple, Randomized Approval

This approach keeps things streamlined:

This would be easy to implement, and it simplifies the user journey. However, the downside is that it doesn’t add any real-world relevance or credibility to the process. It also raises security and trust concerns, especially if someone could use fake documents without proper identity verification. The lack of oversight might make it hard to market as a true "notarization" platform.

Option 2: Real-World-Like Flow with Identity Verification

This approach mimics a real-world notary experience by adding identity verification and subjective approval:

  1. Account Creation: Users first need to create an account.

    • During the account creation, they provide personal details like:
      • Name
      • Date of Birth (DOB)
      • Citizenship
      • Passport or National ID number
    • They must also upload at least two forms of ID with a photo (e.g., passport, driver's license).
  2. Manual Identity Verification:

    • A notary (or an admin) would manually cross-check the provided ID details (name, DOB, document numbers) to ensure they match.
    • You could automate part of this in the future using ID verification APIs like Jumio, Onfido, or other KYC services.
  3. Document Upload for Notarization:

    • Only after the user’s account is verified would they be able to upload documents for notarization.
  4. Document Approval/Rejection:

    • A notary or reviewer can manually check the documents for notarization.
    • Documents could be rejected if they don’t meet certain criteria, if the identity is questionable, or for other reasons.
  5. Platform and Communication:

    • Status Updates: When the document is approved or rejected, the platform updates the document status for the customer.
    • Email Notifications: The customer receives an email notification when the status changes, e.g., "Your document has been notarized" or "Your document has been rejected."

This approach adds a layer of real-world authenticity, providing a more legally sound and credible digital notarization service.

Which Approach is Better?

Additional Considerations

Implementation Steps for Option 2

  1. User Registration and Identity Upload:

    • Set up a user registration flow where the customer provides their details and uploads ID documents.
  2. Manual Review Interface for Notaries:

    • Create an admin panel for notaries or reviewers to approve/reject accounts and later approve/reject documents for notarization.
  3. Document Notarization Submission:

    • After account verification, users are allowed to upload documents for notarization.
    • Notaries can approve/reject documents and update statuses accordingly.
  4. Communication Layer:

    • Integrate an email service (e.g., SendGrid) to notify users when their account is verified or when a document’s status changes.
  5. Tracking and History:

    • Keep track of all uploaded documents, their statuses, and the reason for rejections in a history log visible to the user.

This flow should give the platform a more serious and trustworthy feel, aligning it closely with how notarization works in the physical world.

ashishkarki commented 1 week ago

implementing the second option is definitely the way to go if you want to provide a sense of authenticity for the project. Even though you'll use fake PDFs for testing, having the system in place for manual verification gives you the flexibility to easily transition to real-world use later.

Key Elements of the Flow with Some Simplifications

  1. Restricting Uploads to PDFs:

    • This is simple to implement and makes sense since notarization is most commonly done on documents. You can easily restrict file uploads to PDF format by validating the file type at both the frontend (Next.js) and backend (NestJS). This will prevent users from uploading other file types like images or Word documents.
  2. Manual Cross-Check of Profile Data and ID Documents: Since you're aiming for a manual process (and avoiding the complexity of OCR/PDF scanning for now), the notary can manually review the profile details and uploaded ID documents. Here's how it could work:

    • Notary Workflow:

      1. Access User Profile: The notary logs into the admin panel or a designated review interface where they can access user profiles. The profile would contain key details like:
        • Name
        • Date of Birth (DOB)
        • Citizenship
        • Passport Number or National ID number
      2. View Uploaded ID Documents:
        • The user would have uploaded at least two forms of ID (e.g., passport, driver's license) during registration. The notary can view these documents as PDF files, and to keep it simple:
        • The notary can print the PDFs for comparison, if necessary.
        • Alternatively, they could open the PDF files in a separate tab or window on their computer and visually cross-check the information.
      3. Manual Cross-Check:
        • The notary would manually check the key fields (like name, DOB, passport number, etc.) in the uploaded ID documents against the profile information.
        • Once they confirm that the IDs match the profile details, they can mark the account as "Verified".
    • Profile Verification Status:

      • After the manual cross-check, the notary/admin can update the user profile status to "Verified" or "Rejected" within the admin panel, depending on the results.
      • If rejected, an optional rejection reason could be provided to the user (e.g., “ID mismatch”).

    You won’t need to implement complex PDF scanning at this stage, so this approach keeps things manual but straightforward. Later, you can add OCR functionality to automate the cross-checking process.

Steps for Implementation

Here’s a breakdown of how to implement this flow:

1. User Registration with ID Document Upload

2. Admin/Notary Panel for Profile Review

3. Cross-Checking Workflow

4. Status Update and Notification

5. Allow Document Upload After Verification

Backend Structure to Support This Flow

Frontend and Backend Communication

Example Flow

  1. User Registration:

    • The user submits their details and ID documents for verification.
    • The profile goes into a PENDING state, awaiting verification by the notary.
  2. Notary Cross-Checks Profile:

    • The notary manually views the user's profile and ID documents.
    • After cross-checking, the notary updates the user’s profile to either VERIFIED or REJECTED.
  3. Document Upload and Notarization:

    • Once the user is verified, they can upload documents for notarization.
    • The notary then manually reviews the documents and approves/rejects them, updating the status in the system.

Conclusion

This approach keeps the project simple and manageable while introducing real-world-like identity verification. You're not overcomplicating things by adding OCR or automatic document checks for now, but you’re laying a solid foundation for scalability and adding those features later.

ashishkarki commented 1 week ago

We think more about the storage and api infrastructure/patterns. A few things i was thinking: => the user's ID documents—where will we store them S3? if yes, how will we separate one user's documents with another's? is S3 perfect for this use case since I want to showcase the usage of lot of common AWS services like S3, lambda, SNS, etc, whichever is possible for this project? => When and how will we generate unique IDs for our users? => Should there be an email verification by sending OTP when creating the account, giving the platform more credibility? => the user name, dob, etc. profile info would be saved in Postgres (neon) with Prisma perhaps? or how else?

ashishkarki commented 1 week ago

We think more about the storage and api infrastructure/patterns. A few things i was thinking: => the user's ID documents—where will we store them S3? if yes, how will we separate one user's documents with another's? is S3 perfect for this use case since I want to showcase the usage of lot of common AWS services like S3, lambda, SNS, etc, whichever is possible for this project? => When and how will we generate unique IDs for our users? => Should there be an email verification by sending OTP when creating the account, giving the platform more credibility? => the user name, dob, etc. profile info would be saved in Postgres (neon) with Prisma perhaps? or how else?

step back and think about the storage and API infrastructure patterns. Let's address your questions and suggest an approach that incorporates free, budget-friendly alternatives while still mimicking an AWS-like ecosystem.

1. Storing User ID Documents (S3-like Storage)

Since you want to showcase common AWS services like S3, storing documents in S3 (or its alternative) is a good choice. However, since you're not using AWS directly due to budget constraints, here's a solution that aligns with your goals:

2. Storing Notarized Documents

3. Generating Unique User IDs

4. Email Verification Using OTP

Adding email verification with OTP (One-Time Password) for credibility is a great idea:

This adds a layer of trust and ensures valid email addresses.

5. Storing User Profile Information (PostgreSQL with Prisma)

6. Leveraging Fake AWS Services (IAM, SNS, Lambda Alternatives)

Here’s how you can mimic common AWS services:

Suggested Flow and API Infrastructure

1. User Registration API:

2. OTP Verification API:

3. Document Upload API:

4. Notarization Status API:

5. Admin Panel for Notaries:

Summary of Storage and API Considerations

ashishkarki commented 1 week ago

start with the User Registration Flow as the foundation, and it's perfectly fine to focus on building the backend first. Backend-first development allows you to set up the core infrastructure, database, and logic without worrying about the frontend initially. Once the backend is functional, you can easily plug in the frontend, allowing Next.js to interact with the backend APIs.

That said, here’s a proposed approach for starting with 1. User Registration Flow in the backend, and then we can layer the frontend functionality afterward.

Steps for User Registration Flow (Backend First)

1. Define the Database Schema (PostgreSQL + Prisma)

2. Set Up the User Registration API in NestJS

Create User Registration DTO (Data Transfer Object)

3. OTP Verification API

Once a user receives their OTP via email, they can submit it to verify their account.

4. Integrating SendGrid (for Email Verification)

To send the OTP email, you can use SendGrid, which has a free tier


Frontend Integration (Next.js)

Once the backend is ready and working: