Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Aston2710/mc-modeler/llms.txt

Use this file to discover all available pages before exploring further.

MC Modeler is a static SPA — the build output is a folder of HTML, CSS, and JavaScript that can be served from any web host. In local-only mode it works with no backend at all. Connecting it to your own Supabase project unlocks cloud persistence, authentication, real-time collaboration, comments, notifications, and the shared image library. This guide covers the complete self-hosting path: provisioning Supabase, running the database migrations, configuring environment variables, building the app, and deploying to Vercel (or any other static host).

Prerequisites

  • Node.js 18 or later (check with node --version)
  • A Supabase project — create one free at supabase.com. You need the project URL and the anon public key.
  • Vercel account (optional) — or any static web host that can serve a single-page application (Netlify, Cloudflare Pages, an S3 + CloudFront distribution, etc.)
  • The MC Modeler source code cloned locally

Environment Variables

MC Modeler reads two environment variables at build time. These are the exact variable names used in src/lib/supabase.ts:
VariableDescription
VITE_SUPABASE_URLYour Supabase project URL, e.g. https://xyzcompany.supabase.co
VITE_SUPABASE_ANON_KEYYour Supabase project’s anon / public API key
When both variables are present, isSupabaseConfigured becomes true and the Supabase client is initialised with persistSession, autoRefreshToken, and detectSessionInUrl all enabled. When either variable is absent or empty, the client is null and the app operates in local-only mode using IndexedDB.
# Set variables on the Vercel project (run once, before deploying)
vercel env add VITE_SUPABASE_URL production
vercel env add VITE_SUPABASE_ANON_KEY production

# To add to preview and development environments as well:
vercel env add VITE_SUPABASE_URL preview
vercel env add VITE_SUPABASE_URL development
vercel env add VITE_SUPABASE_ANON_KEY preview
vercel env add VITE_SUPABASE_ANON_KEY development
Never commit real Supabase credentials to version control. Add .env and .env.local to your .gitignore. The anon key is safe to expose to browsers (it is the public key), but your service_role key must never appear in the client bundle.

Running the Supabase Migrations

MC Modeler includes 18 incremental SQL migrations in supabase/migrations/. They must be applied in order to a fresh Supabase project. Each migration is idempotent (create … if not exists, on conflict do nothing) so re-running a migration does not break anything.
# Link the CLI to your remote project (one-time setup)
npx supabase link --project-ref your-project-ref

# Push all local migrations to the remote database
npx supabase db push

Apply manually via the SQL editor

If you prefer the Supabase dashboard, open SQL Editor in your project and run each file in order:
#FileWhat it creates
10001_init.sqlCore tables: profiles, folders, diagrams, diagram_collaborators, diagram_invites, yjs_documents; RLS policies; triggers; thumbnails storage bucket
20002_harden_functions.sqlSecurity hardening for trigger functions
30003_move_helpers_to_private_schema.sqlMoves RLS helper functions to private schema
40004_redeem_invite_rpc.sqlredeem_invite RPC for accepting diagram invitations
50005_yjs_state_as_text.sqlChanges Yjs document state column type
60006_add_subprocess_columns.sqlAdds subprocess metadata columns to diagrams
70007_projects_collaboration.sqlprojects and project_collaborators tables; project-level access inheritance for diagrams
80008_comment_delete_policies.sqlDelete policies for comments
90009_notifications.sqlNotifications system tables and triggers
100010_collaborator_visibility.sqlPolicies for collaborator profile visibility
110011_mention_thread_deeplink.sqlDeep-link support for comment mentions and threads
120012_notification_inbox.sqlIn-app notification inbox table
130013_notification_prefs.sqlPer-user notification preferences
140014_notification_digest.sqlDigest email scheduling support
150015_readonly_comment_access.sqlRead-only comment access for viewer-role collaborators
160016_image_library.sqlimage_folders and images tables; diagram-images storage bucket; image library RLS policies
170017_image_library_realtime.sqlRealtime publication for image library tables
180018_drop_yjs_tables.sqlRemoves legacy Yjs tables superseded by the current CRDT implementation

Storage Bucket Setup

Two private Storage buckets are created automatically by the migrations. No manual configuration is needed if you use the Supabase CLI. If you applied migrations manually via the SQL editor, verify that both buckets exist in your project’s Storage section:
BucketCreated byPurpose
thumbnails0001_init.sqlAuto-generated PNG previews of diagrams. Path convention: <diagram_id>/thumb.png
diagram-images0016_image_library.sqlImages uploaded through the in-app image library. Path convention: <scopeId>/imglib/<uuid>.<ext>
Both buckets are private (public = false). Access is controlled by Row Level Security policies defined in the migrations — users can only read or write objects they have permission to access via the diagram or project access model.
If you need to create the buckets manually, set them to private (not public). The RLS policies in the migrations will not work correctly on a public bucket.

Build the Application

With your environment variables in place, build the production bundle:
# Install dependencies
npm install

# Type-check and build
npm run build
The build output is written to the dist/ directory. It contains a single index.html entry point plus hashed JS and CSS chunks. The Vite config splits the bundle into two named chunks to reduce initial load time:
  • bpmn-js — the BPMN modeling engine
  • react-vendor — React and React DOM

Deploy to Vercel

The repository includes a vercel.json that configures the build command, output directory, and the SPA catch-all rewrite rule:
{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "vite",
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}
The rewrites rule is critical — it ensures that direct navigation to any route (e.g. /diagram/abc123) returns index.html instead of a 404, which is required for any client-side router.
# Deploy to Vercel (environment variables must already be set)
vercel --prod

Deploy to Other Static Hosts

If you use a host other than Vercel, you must configure an equivalent catch-all rewrite to index.html. Examples:
Create a public/_redirects file or add to netlify.toml:
[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

Local-Only Mode (No Supabase)

If you want to self-host MC Modeler purely as a local diagramming tool without any cloud backend, simply do not set VITE_SUPABASE_URL or VITE_SUPABASE_ANON_KEY. The app detects their absence at runtime:
// src/lib/supabase.ts
export const isSupabaseConfigured = Boolean(url && anonKey)

export const supabase: SupabaseClient | null = isSupabaseConfigured
  ? createClient(url as string, anonKey as string, { ... })
  : null
When supabase is null, the app falls back to localforage (IndexedDB) for all persistence. No network requests are made. The build and deploy steps are identical — just skip the Supabase project setup.
Local-only mode still provides the full modeling experience: canvas, palette, properties panel, undo/redo, auto-save, thumbnails, and all export formats. What it does not include is user authentication, cloud sync, real-time collaboration, comments, notifications, and the image library. Those features all require a configured Supabase project.
In local-only mode, all diagram data lives in the browser’s IndexedDB. Clearing browser storage, switching browsers, or uninstalling the browser permanently deletes all diagrams. Export any important diagrams as .bpmn files regularly, and inform users of this limitation if you are deploying for a team.

Enabling Supabase Auth Providers (Optional)

MC Modeler uses Supabase Auth for user accounts. By default, email/password sign-up is enabled. To add social providers (Google, GitHub, etc.):
  1. Open your Supabase project dashboard → AuthenticationProviders.
  2. Enable the desired provider and supply the OAuth credentials from that provider’s developer console.
  3. Add your MC Modeler deployment URL to the provider’s list of authorised redirect URIs.
  4. Add your deployment URL to AuthenticationURL ConfigurationRedirect URLs in Supabase.
No code changes are required — the Supabase client is initialised with detectSessionInUrl: true, which handles OAuth callback URL parsing automatically.

Build docs developers (and LLMs) love