A web application for checking cannabis product compliance by uploading product images and Certificate of Analysis (COA) PDF files. The application uses the Lamatic API to analyze the uploaded content and provide detailed compliance reports.
- Multiple Image Upload: Upload multiple product images with drag-and-drop support
- PDF Upload: Upload Certificate of Analysis (COA) documents
- Compliance Analysis: Get detailed compliance reports with compliant and non-compliant items
- Modern UI: Clean, responsive design with visual feedback
- Real-time Preview: See previews of uploaded images before submission
- Backend: Node.js with Express
- Frontend: HTML, CSS, Vanilla JavaScript
- File Handling: Multer for multipart form data
- HTTP Client: Axios for API calls
- Environment Variables: dotenv for configuration
- Node.js (v14 or higher)
- npm (v6 or higher)
- Lamatic API key
-
Clone the repository
git clone https://github.com/raman-1222/cannacore-demo-website.git cd cannacore-demo-website -
Install dependencies
npm install
-
Configure environment variables
Copy the
.env.examplefile to.env:cp .env.example .env
Edit the
.envfile and configure your Lamatic API settings:LAMATIC_API_KEY=your_api_key_here LAMATIC_API_URL=https://cannacore824-cannacore872.lamatic.dev/graphql LAMATIC_WORKFLOW_ID=72552416-8242-4ee3-bbb8-235d7792dd63 LAMATIC_PROJECT_ID=d00a8d95-9196-45f3-8488-10ead508b5f5 PORT=3000
-
Start the server
npm start
For development with auto-restart:
npm run dev
-
Access the application
Open your browser and navigate to:
http://localhost:3000 -
Upload files
- Click or drag-and-drop multiple product images in the Image Upload section
- Click or drag-and-drop a PDF Certificate of Analysis in the PDF Upload section
- Click "Check Compliance" to submit for analysis
-
View results
- Compliant items will be displayed in green cards
- Non-compliant items will be displayed in red cards with:
- Reason for non-compliance
- Evidence from the analysis
- Suggested fixes
The application uses the Lamatic GraphQL API. All API configuration is managed through environment variables:
- LAMATIC_API_KEY: Your Lamatic API authentication key
- LAMATIC_API_URL: The GraphQL endpoint URL (default:
https://cannacore824-cannacore872.lamatic.dev/graphql) - LAMATIC_WORKFLOW_ID: The workflow identifier (default:
72552416-8242-4ee3-bbb8-235d7792dd63) - LAMATIC_PROJECT_ID: The project identifier (default:
d00a8d95-9196-45f3-8488-10ead508b5f5)
cannacore-demo-website/
├── server.js # Express server with API routes
├── public/
│ ├── index.html # Main HTML page
│ ├── styles.css # Styling
│ └── script.js # Frontend JavaScript
├── uploads/ # Temporary file storage (gitignored)
├── package.json # Dependencies and scripts
├── .env.example # Environment variable template
├── .gitignore # Git ignore rules
└── README.md # This file
Uploads images and PDF for compliance checking.
Request: Multipart form data
images: Multiple image files (max 10)pdf: Single PDF file
Response:
{
"status": "success",
"result": {
"compliant_items": [
{
"summary": "Description of compliant item"
}
],
"non_compliant_items": [
{
"reason": "Reason for non-compliance",
"evidence": "Evidence from analysis",
"suggested_fix": "Suggested fix"
}
]
}
}Health check endpoint.
Response:
{
"status": "ok"
}The application handles various error scenarios:
- Missing files
- Invalid file types
- File size limits (10MB per file)
- API connection errors
- Invalid API responses
Errors are displayed in a user-friendly format with clear messages.
test
To run in development mode with auto-restart:
npm run dev- Never commit your
.envfile or API keys to version control - The
uploads/directory is gitignored to prevent temporary files from being committed - Files are stored temporarily and can be automatically cleaned up after processing
ISC
For issues or questions, please open an issue on the GitHub repository.