mold-inventory

patkub/mold-inventory

3.3

If you are the rightful owner of mold-inventory and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Mold Inventory system is a comprehensive solution for managing mold inventories, leveraging modern web technologies and cloud services.

Mold Inventory

Mold inventory management application

App: https://mold-inventory-app-production.epicpatka.workers.dev/

MCP Server: https://molds-mcp-production.epicpatka.workers.dev/sse

Architecture

This is a monorepo powered by Nx.

Tech Stack

Auth0, Cloudflare D1, Cloudflare Workers, Hono, Prisma, Next.js

Apps

  • : Auth0 tenant configuration
  • : Cloudflare Worker serving a Hono API backend
  • : Cloudflare Worker serving the Next.js app
  • : Cloudflare Worker Molds MCP server

Implementation Details

auth0-tenant

: Deployable Auth0 tenant configuration for this app.

mold-inventory-api

: Cloudflare Worker Hono API backend

  • A Cloudflare Worker that serves a Hono CRUD API to manage molds.
  • Validates Auth0 JWT access token scope claim for permissions.
  • Uses Prisma ORM to manage a Cloudflare D1 database
mold-inventory-app

: Cloudflare Worker serving the Next.js app

molds-mcp

: Cloudflare Worker Molds MCP server

  • Auth0 for login
  • Allows an LLM to recieve the list of molds on behalf of the user.
  • User must have read:molds permission for the Mold Inventory API.

UI

Screenshot of Light UI

Screenshot of Dark UI

UI generated with v0.dev

MCP Server AI Chat

AI Chat 1

Local Setup

Install Dependencies

Install Node.js dependencies.

pnpm install

Deploy Development Auth0 Configuration

Copy auth0 config from apps/auth0-tenant/auth0-config.json.example to apps/auth0-tenant/auth0-config-dev.json and fill out details using Machine to Machine client.

Deploy development Auth0 configuration.

pnpm nx deploy-dev auth0-tenant
Create Users

Create users in Auth0 dashboard.

  • Assign permissions to users for the Mold Inventory API.
    • Available permissions: create:molds, read:molds, update:molds, and delete:molds
Configure Actions

Define secrets for MoldInventoryPostUserRegistration action.

  • DOMAIN - Auth0 domain
  • CLIENT_ID - Molds M2M Client ID
  • CLIENT_SECRET - Molds M2M Client Secret

Run the API locally

Create mold-inventory-api database in Cloudflare.

pnpm nx db:create mold-inventory-api

Set up local Cloudflare D1 database for the first time.

# set up local Cloudflare D1 database
pnpm nx db:migrate:local mold-inventory-api
pnpm nx db:seed:local mold-inventory-api

# generate prisma database schema
pnpm nx prisma:generate mold-inventory-api

Configure environment variables in apps/mold-inventory-app/wrangler.jsonc.

Run the API locally.

pnpm nx dev mold-inventory-api

Run the App locally

Configure environment variables for development in apps/mold-inventory-app/wrangler.jsonc.

There are two ways to run the app locally, using either the Next.js development server, or the Cloudflare workerd runtime.

Run locally in Node.js using the Next.js development server, with hot-code reloading, error reporting, and more.

pnpm nx dev mold-inventory-app

Run locally in the Cloudflare workerd runtime, which is more accurate to production.

pnpm nx preview mold-inventory-app

Open http://localhost:3000 in your browser.

Unit Testing

Run unit tests for API and App

pnpm nx run-many -t test -p mold-inventory-api mold-inventory-app

Run unit tests for API, App, and Auth0 Actions

pnpm nx run-many -t test --all
  • pnpm nx test auth0-tenant - vitest actions single run for Auth0 actions
  • pnpm nx test:watch auth0-tenant - vitest actions watch test suites for changes for Auth0 actions
  • pnpm nx test mold-inventory-api - vitest single run for API
  • pnpm nx test:watch mold-inventory-api - vitest watch test suites for changes for API
  • pnpm nx test mold-inventory-app - vitest single run for app
  • pnpm nx test:watch mold-inventory-app - vitest watch test suites for changes for app

Staging Environment

Reference .

Production Deploy

Reference .

Changesets

Create a changeset: Whenever a change is made that warrants a new release (e.g., bug fixes, new features), run:

pnpm changeset
pnpm changeset version

Commands

Reference available npm scripts in .