Self-host OpenMat
OpenMat is a static web app that stores data in the browser, plus a few optional server endpoints. Host the front end anywhere and connect only the server features you need.
How a self-hosted OpenMat fits together #
OpenMat has two layers:
- The front end: a single-page progressive web app (HTML, CSS and JavaScript). All training data is stored in each user's browser in the openmat.json format. There's no application database to run.
- Optional server endpoints: a handful of HTTPS webhooks for features that need a server: registration, Google sign-in, payment confirmation, the Sensei AI proxy and analytics. The hosted version runs these as n8n workflows, but any backend that accepts JSON over HTTPS works.
Without any endpoints, a self-hosted copy still logs sessions, runs the timer and trackers, and exports data. Features that need a server simply don't respond.
Coming soon: the public repository is being prepared. This guide explains the architecture so you can plan a deployment. Exact build commands and configuration names will be in the repository's README.
What you need #
- A domain with HTTPS
- Required to install the app to a home screen and for browser storage features such as OPFS.
- Static hosting
- Any web server, CDN or static host that can serve files.
- SPA fallback
- Every path under the app's base path (for example
/app/log-session) must return the app's index file, so deep links work. - Web app manifest
- Serve
/manifest.jsonso browsers can install the app. - Optional backend
- n8n or any server that accepts JSON POST requests over HTTPS, for the endpoints below.
How to deploy the front end #
- Get the code from github.com/openmat-ai/openmat once it's public.
- Choose a base path. The hosted app uses real URL paths under
/app, such as/app/beacon. - Point each server feature at your own endpoint, or leave it unset to run local-only. Never reuse endpoint URLs or keys from someone else's deployment.
- If you'll sell plans, create your own Stripe Payment Links and set them in the configuration. Otherwise hide the paid plans.
- Upload the files to your host and add the SPA fallback rule (example below).
- Test on a phone: sign up, log a session, run the timer, then export and re-import openmat.json.
Example SPA fallback (nginx) #
# Serve the app; send every unknown /app/ path to the app shell
location /app/ {
try_files $uri $uri/ /app/index.html;
}
location = /manifest.json {
default_type application/manifest+json;
}
Other hosts have equivalent "rewrite all routes to index.html" settings.
Server endpoints the app expects #
All endpoints are optional. Each one powers one feature. The app sends JSON over HTTPS POST.
| Purpose | When the app calls it | What it receives | What it should do |
|---|---|---|---|
| Registration | When a user finishes sign-up | Email, name, handle, role, disciplines, avatar, optional Google profile fields, IP, session ID and user agent | Store or forward the new user, for example to your CRM or mailing list. |
| Google sign-in exchange | After "Continue with Google" | The OAuth authorization code | Exchange the code with Google using your own OAuth client (scopes: openid, email, profile) and return the profile. |
| Payment complete | Polled every 10 seconds for up to 6 minutes after checkout opens | Email, name, handle, plan and amount | Report whether Stripe has confirmed payment for that user and plan. |
| Sensei AI proxy | Each Sensei message | A context line (name, rank, stripes, streak, sessions, mat hours) and the conversation history | Call your AI provider with your own key, model and system prompt, then return the reply text. |
| Analytics | Session start and session end | Device, usage and account summary events | Optional. Store or discard. Leave unset to send nothing. |
Privacy tip: if your members are in a region with consent rules for analytics, add a consent step before you enable the analytics endpoint, or leave it off.
Security checklist for your deployment #
- Everything in the front end is public. Keep AI provider keys, OAuth client secrets and Stripe secret keys on the server. Treat any value shipped to the browser as visible to everyone.
- Protect your endpoints. Validate request bodies, rate-limit them and restrict allowed origins, especially the Sensei proxy, which spends money per call.
- Confirm payments on the server. Grant paid plans only after a verified Stripe webhook event, never on a signal from the browser.
- Enforce access server-side for any shared data you add.
- Minimize what you collect. Registration and analytics payloads include personal data. Keep only what you need and publish your own privacy policy.
Self-hosting questions #
Do I need n8n to self-host?
No. The hosted version uses n8n workflows, but any server that accepts JSON over HTTPS can provide the endpoints. You can also run with no endpoints at all.
Can members move between openmat.ai and my instance?
Yes. Browser storage is separate for each domain, so members export openmat.json from one and import it on the other.
Can I put my academy's brand on it?
Self-hosting runs it on your own domain. For commercial redistribution under your own brand, see the business license.