Mold inventory management application
App: https://mold-inventory-app-production.epicpatka.workers.dev/
MCP Server: https://molds-mcp-production.epicpatka.workers.dev/sse
This is a monorepo powered by Nx.
Auth0, Cloudflare D1, Cloudflare Workers, Hono, Prisma, Next.js
auth0-tenant: Auth0 tenant configurationmold-inventory-api: Cloudflare Worker serving a Hono API backendmold-inventory-app: Cloudflare Worker serving the Next.js appmolds-mcp: Cloudflare Worker Molds MCP server
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:moldspermission for the Mold Inventory API.
UI generated with v0.dev
Install Node.js dependencies.
pnpm installCopy 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-tenantCreate users in Auth0 dashboard.
- Assign permissions to users for the Mold Inventory API.
- Available permissions:
create:molds,read:molds,update:molds, anddelete:molds
- Available permissions:
Define secrets for MoldInventoryPostUserRegistration action.
DOMAIN- Auth0 domainCLIENT_ID- Molds M2M Client IDCLIENT_SECRET- Molds M2M Client Secret
Create mold-inventory-api database in Cloudflare.
pnpm nx db:create mold-inventory-apiSet 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-apiConfigure environment variables in apps/mold-inventory-app/wrangler.jsonc.
Run the API locally.
pnpm nx dev mold-inventory-apiConfigure 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-appRun locally in the Cloudflare workerd runtime, which is more accurate to production.
pnpm nx preview mold-inventory-appOpen http://localhost:3000 in your browser.
Run unit tests for API and App
pnpm nx run-many -t test -p mold-inventory-api mold-inventory-appRun unit tests for API, App, and Auth0 Actions
pnpm nx run-many -t test --allpnpm nx test auth0-tenant- vitest actions single run for Auth0 actionspnpm nx test:watch auth0-tenant- vitest actions watch test suites for changes for Auth0 actionspnpm nx test mold-inventory-api- vitest single run for APIpnpm nx test:watch mold-inventory-api- vitest watch test suites for changes for APIpnpm nx test mold-inventory-app- vitest single run for apppnpm nx test:watch mold-inventory-app- vitest watch test suites for changes for app
Reference Staging Deploy.
Reference Production Deploy.
Create a changeset: Whenever a change is made that warrants a new release (e.g., bug fixes, new features), run:
pnpm changeset
pnpm changeset versionReference available npm scripts in commands.


