Before you start
You need a website in the Dashboard and a frontend key from SDK keys (
pk_… for production or dk_… for local/staging). See Where credentials come from and Keys model. Install packages
Add the SDK and overlay to your site project.
pnpm add @macrocontent/sdk @macrocontent/overlayCreate macro.config.js
Put credentials in the site root. This file is for frontend keys only — never put a secret key or management token here.
export const macroConfig = { apiBaseUrl: 'https://api.macrocontent.dev', websiteId: 'your-website-uuid', publicKey: 'pk_...', // or dk_... for local/staging editorLogin: { shortcut: 'Mod+Shift+M' }, overlay: { enabled: true, theme: 'dark' }, }Editor shortcutSign-in opens an in-page modal via ⌘⇧M / Ctrl+Shift+M (Mod+Shift+M). There is no separate/loginpage.Add the Vite plugin
Macro injects on every HTML page automatically. You do not need a
main.jsbootstrap or per-page script tags.import { defineConfig } from 'vite' import { macro } from '@macrocontent/sdk/vite' export default defineConfig({ plugins: [macro({ config: '/macro.config.js' })], })Mark your first key
Add
data-macro-keyon any element you want editors to change. Type is optional —<img>is detected asimage.<h1 data-macro-key="hero.title">Build faster</h1> <img data-macro-key="hero.image" data-macro-type="image" src="/hero.jpg" alt="Hero" />More types and patterns: Marking basics.
Run the site and open the editor
Start your Vite (or framework) dev server, open the page, then press the editor shortcut.
pnpm dev- Press ⌘⇧M / Ctrl+Shift+M.
- Sign in with a website editor account from the Dashboard.
- Click the marked element and edit — changes autosave to draft.
Recommended project layout
macro.config.js
vite.config.ts
index.html
macro-nodes.ts
main.ts
What happens under the hood
- The Vite plugin (or layout loader) boots the SDK with your config.
- Installed Store components load automatically via
loadStoreComponents(). - The SDK scans
data-macro-keynodes and hydrates live values. - After editor login, the overlay enables inline editing and the sidebar.