A client-only design studio for brochures, visiting cards and 2D social cards. Pick a template, apply your brand, edit the content and export PNG, WebP, JPEG or SVG, all in the browser. No backend, no uploads.
MDesign is a static Vue 3 SPA (Vite, Pinia, Tailwind CSS v4, notform + Zod). The wizard has four steps: Template → Brand → Content → Export.
- Templates are Vue SFCs. Each folder in
templates/(project root) holds aComponent.vue(the design, plain Vue + Tailwind) and anindex.ts(metadata, resolution, Zod schema, sample placeholders,transformPayload).registry.tsdiscovers them withimport.meta.glob, so adding a folder adds a template. - Forms come from the schema.
parseSchemaToJsonSchema()converts a template's Zod schema to JSON Schema with layout hints;SchemaFieldsrenders it and the same schema validates it. - Token previews. Until a field is filled, the design shows its own label as
{{Field Label}}(built from the schema bysrc/domain/tokens.ts; brand fields show{{Business Name}},{{Phone}}, ...), so it is clear what is dynamic and what it will contain. - Multi-page designs. A template can set
pages: 2(or more); its component receives a zero-basedpageprop. The stage shows the pages stacked and scrollable like a PDF, and export produces one tall image with spacing between pages for printing. - Instant preview. The active template component is rendered at its design resolution inside
StageViewportand scaled with CSS. Typing updates it synchronously. - Auto-branded gradients.
generateProceduralGradient(primary, accent)derives a balanced HSL mesh from the brand colours (src/domain/proceduralGradient.ts). - Export in the browser.
exportElementToBlob()serialises the design into an SVG<foreignObject>with the page CSS and used fonts embedded as data URIs, then draws it on a canvas for PNG / WebP / JPEG, or returns the SVG directly (src/domain/imageExport.ts). - Local storage only. The brand profile and the draft live in
localStorage; Google Fonts are fetched on demand and inlined.
| Template ID | Category | Resolution (px) | Purpose |
|---|---|---|---|
trifold-brochure-v1 |
Collateral | 2480 × 1748 | Three-panel landscape company brochure |
business-card-v1 |
Stationery | 1050 × 600 | Visiting card (3.5 × 2 in at 300 DPI) |
terminal-card-v1 |
Social | 1600 × 900 | Developer quiz card styled as a terminal |
director-hud-v1 |
Social | 1920 × 1080 | Camera viewfinder / production HUD |
Export scale is 1x, 2x or 300 DPI (4.17x of the design grid); SVG ignores scale.
business-card-v1 is a two-page card (front, back). The Brand step supplies the logo, colours, font, business name and website; the Content step switches layout and artwork:
| Setting | Dark gradient card (viewfinder QR back) | Plain card (artwork back) |
|---|---|---|
| Design → Background | gradient | plain |
| Design → Emphasis / Name size | regular / large | bold / standard |
| Design → Content start | edge | inset (room for left art) |
| Design → Logo | top-right, small | middle-right, large |
| Design → Contacts | bottom | under-title |
| Artwork → Front | line art, placement cover, subtle | pattern, placement left, full |
| Artwork → Back | (none) | illustration, center-bottom |
| Back → Layout | qr (URL defaults to the website) | artwork (shows the website) |
| Back → QR style / Frame | rounded / viewfinder | (not used) |
Upload the artwork (PNG, JPG, WebP or SVG) with the image pickers.
templates/my-card-v1/
├── Component.vue # props = transformPayload() output, root fills the design size
└── index.ts # export default { id, label, shortLabel, category, description,
# resolution, component, schema, placeholders, transformPayload }
Rules that keep exports faithful:
- The root element fills its box (
size-full) and sets its own text colour andleading-normal. - Use arbitrary colour values (
text-[#334155]) because the app theme resets the Tailwind palette. - Images must be data URIs (the logo and uploads already are;
resolveDecor()handles built-in decor). - Brand props (
organizationName,organizationLogo,colorPrimary,gradient, ...) come frombrandProps(org)intemplates/brand.ts.
bun install
bun run dev # http://localhost:5173
bun run build # static output in dist/
bun run test:unit
bun run lintDeploy dist/ to any static host (Vercel, Cloudflare, Netlify) or use the Docker image (bun run docker:build, nginx on port 8080).
- Exports use the browser's own renderer. Chrome and Edge are the reference; Safari has known
foreignObjectlimitations. - A brand font outside the curated list in
src/domain/fonts.tsis not offered in the picker.
Published under the MIT License.