DEV Community

Niraj Kumar
Niraj Kumar

Posted on

How I Built an AI-Powered Compliance Marketplace for the Cannabis Industry

The cannabis industry isn't just another e-commerce business.

Every product, every business, and every transaction must comply with strict regulations that vary by state. Unlike traditional marketplaces, selling a product often requires license verification, lab-tested Certificates of Analysis (COAs), age restrictions, and compliance checks before a listing can even become visible.

Recently, I worked on a marketplace that solved many of these technical challenges. This article focuses on the engineering decisions behind the platform rather than the business itself.

The Challenge

Building a regulated marketplace meant solving problems beyond a typical e-commerce application.

Some of the major challenges included:

  • Business verification before sellers could access the platform.
  • License validation for different business types.
  • Product approval workflows.
  • AI-assisted Certificate of Analysis (COA) processing.
  • State-specific compliance rules.
  • Secure marketplace transactions.
  • Multi-role dashboards.
  • Product discovery across verified businesses.

The goal was to build a scalable platform where every product entering the marketplace passed compliance checks before reaching buyers.


Architecture Overview

The platform was designed using a modern full-stack architecture.

Frontend

  • React
  • Next.js
  • TypeScript

Backend

  • Node.js
  • REST APIs
  • PostgreSQL
  • Prisma ORM

Cloud & Infrastructure

  • AWS
  • Object Storage
  • CDN
  • Background processing
  • Secure authentication

AI-Powered COA Processing

One of the most interesting engineering challenges was handling Certificates of Analysis (COAs).

Instead of requiring administrators to manually review every report, AI was used to extract structured information from laboratory documents.

The workflow looked like this:

  1. Business uploads a COA.
  2. AI extracts relevant information.
  3. Important fields are normalized.
  4. Validation rules are applied.
  5. Administrators review extracted data.
  6. Products move into the approval workflow.

This significantly reduced manual processing while improving consistency.


Multi-Step Product Approval

Instead of allowing products to become available immediately, every product followed an approval lifecycle.

Business Registration

License Verification

Account Approval

Product Upload

COA Validation

Administrative Review

Marketplace Listing

Available for Buyers

This workflow ensured that only approved products appeared in the marketplace.


Compliance First

A regulated marketplace requires compliance to be part of the application's architecture.

Some examples included:

  • State-specific business rules.
  • Business license validation.
  • Role-based permissions.
  • Age-restricted access.
  • Administrative approval workflows.
  • Product visibility based on compliance status.

These rules influenced both backend APIs and frontend user experiences.


Lessons Learned

Working on this project reinforced several important engineering principles:

  • Business rules often become the most complex part of an application.
  • AI should automate repetitive tasks, not replace human review.
  • Approval workflows deserve first-class architectural design.
  • Role-based access control becomes increasingly important as platforms grow.
  • Clean backend architecture makes evolving compliance rules much easier.

Final Thoughts

This project demonstrated how modern AI techniques, scalable backend architecture, and well-designed workflows can simplify complex compliance processes while providing a better experience for businesses and administrators.

It was an excellent opportunity to combine full-stack engineering with AI-assisted document processing, workflow automation, and scalable SaaS architecture.


Read the Complete Case Study

This article provides a high-level overview of the engineering approach.

The complete case study includes the project architecture, workflow diagrams, technical decisions, challenges, and implementation details.

Read the Complete Case Study

This article is a condensed overview of the engineering challenges and architecture.

👉 Read the full case study on my website

If you enjoyed this article, follow me on DEV for more content on Full Stack Development, AI Engineering, System Design, and scalable SaaS architecture.

Top comments (0)