Skip to content

feat: Theme Marketplace & Theme Editor as Next.js multi-zone apps#320

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-theme-picker-and-editor
Draft

feat: Theme Marketplace & Theme Editor as Next.js multi-zone apps#320
Copilot wants to merge 3 commits intomainfrom
copilot/add-theme-picker-and-editor

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

Adds a fully functional Theme Marketplace and Theme Editor as separate Next.js zone apps, routed from the main StormCom app via multi-zone rewrites. Store owners can browse categorised themes, install them to their storefront, and customise every visual token with live preview before publishing.


Multi-Zone Architecture

Main App (:3000)
  /themes/*         ──rewrite──▶  apps/theme-marketplace  (:3001, basePath /themes)
  /themes/editor/*  ──rewrite──▶  apps/theme-editor        (:3002, basePath /themes/editor)
  /api/marketplace/themes/*       (stays in main app)

Zone URLs are configurable via THEME_MARKETPLACE_URL / THEME_EDITOR_URL env vars.


Changes

Database (prisma/schema.prisma)

  • MarketplaceTheme — theme catalog with config (JSON), category, tags, ratings, download count
  • ThemeInstallation — tracks per-store installs
  • ThemeRating — star ratings + optional reviews
  • ThemeCategory / ThemeStatus enums
  • Migration SQL: prisma/migrations/20260305000000_add_theme_marketplace/
  • Seed script: prisma/seed-marketplace.mjs (14 themes)

Theme Templates (src/lib/storefront/theme-templates.ts)

Expanded from 6 → 14 templates; 8 new industry-specific themes:

Slug Name Category
tech-nova TechNova ELECTRONICS
fashion-forward FashionForward FASHION
cafe-bistro CafeBistro FOOD_BEVERAGE
glow-up GlowUp HEALTH_BEAUTY
home-vibes HomeVibes HOME_LIFESTYLE
sport-zone SportZone SPORTS_OUTDOORS
jewel-box JewelBox JEWELRY
bookshelf Bookshelf BOOKS_EDUCATION

Marketplace API (src/app/api/marketplace/themes/)

  • GET /api/marketplace/themes — paginated list with category, q, sort, storeId params; falls back to static templates when DB is empty
  • GET /api/marketplace/themes/:id — detail
  • POST /api/marketplace/themes/:id/install — applies theme as storefront draft, increments download count, records installation; requires OWNER/ADMIN/CONTENT_MANAGER access
  • POST /api/marketplace/themes/:id/rate — upserts rating, recalculates aggregate

Theme Marketplace Zone (apps/theme-marketplace/)

  • Gallery with hero, category pill filters, search, and sort (popular/recent/rating/name)
  • Theme cards render a deterministic CSS colour swatch preview when no screenshot exists
  • Detail page: full swatch, colour palette chips, typography info, install + editor CTA
  • Client-side pagination without full page reload

Theme Editor Zone (apps/theme-editor/)

Full-screen split editor — sidebar + live <iframe> preview. Changes are pushed to the preview frame via postMessage on every keystroke/slider move.

Sidebar tabs:
  Colors     → color picker + hex input for 6 tokens; 8 quick palette presets
  Typography → body/heading font, base size (14–18 px), heading scale sliders
  Layout     → page layout (full-width/boxed/centered) + border radius visual
  CSS        → raw textarea with CSS variable hints

Auto-saves draft after 2 s inactivity via PUT /api/stores/:id/storefront/draft. Publish button writes draft to live config.

Main App / Dashboard

  • next.config.ts: added multi-zone rewrites() (editor rule before marketplace to avoid prefix collision)
  • tsconfig.json: added apps/ to exclude to prevent zone files from being type-checked in the main compilation
  • Storefront Appearance page: added Theme Marketplace and Theme Editor buttons alongside existing Visual Editor
  • ThemeMarketplacePanel: updated helper maps for 14 theme IDs; added Full Marketplace ↗ external link

Docs

  • docs/MULTI_ZONE_SETUP.md — local dev setup, env vars, DB migration, Vercel deployment guide

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stormcomui Error Error Mar 5, 2026 11:31am

- Prisma: Add MarketplaceTheme, ThemeInstallation, ThemeRating models + ThemeCategory/ThemeStatus enums
- types.ts: Add ThemeCategory, MarketplaceThemeMeta types; extend ThemeTemplateId with 8 new themes
- theme-templates.ts: 8 new categorised themes (TechNova, FashionForward, CafeBistro, GlowUp, HomeVibes, SportZone, JewelBox, Bookshelf)
- API: /api/marketplace/themes (GET list), /[id] (GET detail), /[id]/install (POST), /[id]/rate (POST)
- apps/theme-marketplace/: Full Next.js zone (basePath /themes) with gallery, filters, detail page
- apps/theme-editor/: Full Next.js zone (basePath /themes/editor) with live preview, sidebar (colors/typography/layout/CSS)
- next.config.ts: Multi-zone rewrites for /themes/* and /themes/editor/*
- Appearance page: Add Theme Marketplace & Theme Editor buttons
- theme-marketplace-panel.tsx: Add 8 new themes to helper functions + Full Marketplace link

Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
- Add MOCK_DOWNLOAD_COUNTS/MOCK_AVERAGE_RATINGS named constants
- Type themeConfig as ThemeSettings (not object) in install route
- Fix NEXT_PUBLIC_MAIN_APP_URL fallback to 'http://localhost:3000' in zone clients
- Extract headingFontSize calculation variable in typography preview
- Use radiusClasses object lookup instead of nested ternaries
- Remove redundant type assertions in editor page (StorefrontDraft.theme properly typed)
- Add Prisma migration SQL for MarketplaceTheme/ThemeInstallation/ThemeRating
- Add prisma/seed-marketplace.mjs for seeding 14 themes
- Add docs/MULTI_ZONE_SETUP.md with setup guide

Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
Copilot AI changed the title [WIP] Add theme picker and editor for storefront marketplace feat: Theme Marketplace & Theme Editor as Next.js multi-zone apps Mar 5, 2026
@github-actions
Copy link

github-actions bot commented Mar 8, 2026

Automated review (GitHub Models):

All major features, files, and architectural changes described in the PR are present in the repository, strongly suggesting this PR has already been merged or its contents implemented.

Confidence: 0.98

Evidence:

  • apps/theme-marketplace/ : Directory exists, indicating the marketplace zone was created.
  • apps/theme-editor/ : Directory exists, indicating the editor zone was added.
  • prisma/migrations/20260305000000_add_theme_marketplace/ : Migration for marketplace schemas matches the PR description.
  • prisma/seed-marketplace.mjs : Seed script for marketplace themes present.
  • src/lib/storefront/theme-templates.ts : File contains expanded theme templates (14 themes) and category mappings.
  • src/app/api/marketplace/themes/ : API directory exists, matching the endpoints described in the PR.
  • docs/MULTI_ZONE_SETUP.md : Documentation file for multi-zone setup found.
  • next.config.ts : Multi-zone rewrite rules present, as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants