Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

22 stars

Watchers

3 watching

Forks

Repository files navigation

Mast Framework for Sanity (beta)

A Sanity + Next.js implementation of the Mast Framework, originally built for Webflow. This project brings Mast's powerful page-building system to the headless CMS world with real-time visual editing and AI-powered content creation.

What is Mast?

Mast is a component-based design system and page builder framework that provides a structured, flexible approach to building websites. It uses a hierarchical Section → Row → Column → Content Block architecture that gives designers and developers precise control over layout and content.

Features

Page Builder Architecture

  • Sections - Top-level containers with background options, padding controls, and max-width settings
  • Rows - Flexible layouts with horizontal/vertical alignment, gap controls, and wrap options
  • Columns - Responsive width controls (12-column grid), with desktop/tablet/mobile breakpoints
  • Content Blocks - Modular components including headings, rich text, images, buttons, sliders, tabs, accordions, and more

Visual Editing

  • Real-time Preview - Edit content in Sanity Studio and see changes instantly in the presentation view
  • Custom Overlay Labels - Hover over any component to see its type (Section, Row, Column, Heading, etc.)
  • Column Gutter Indicators - Visual SVG pattern showing column padding/gaps in edit mode
  • Drag-and-Drop - Reorder sections, rows, and content blocks with Sanity's visual editing tools

Responsive Design

  • Breakpoint Controls - Set different column widths for desktop, tablet, and mobile
  • Mobile-First - Columns stack vertically on mobile with optional reverse order
  • Flexible Gaps - Configurable spacing between columns using a Bootstrap-style gutter system

Component Library

  • Heading Block
  • Rich Text Block
  • Eyebrow Block
  • Image Block
  • Button Block
  • Spacer Block
  • Divider Block
  • Slider/Carousel Block
  • Tabs Block
  • Accordion Block
  • Card Block
  • Icon Block
  • Modal Block
  • Video Block
  • Marquee Block
  • Breadcrumb Block
  • Table Block
  • Blog Grid Block

Claude AI Assistant

A custom Sanity Studio plugin that provides AI-powered content creation and document operations:

  • Real-time streaming responses from Claude API
  • Document operations — create, update, and delete content via natural language
  • Schema awareness — Claude understands your content structure
  • Conversation persistence — chat history stored in Sanity
  • Custom instructions — configure writing guidelines and brand voice
  • Workflows — reusable prompt templates for common tasks

See the Claude Assistant Porting Guide for instructions on extracting this plugin for use in other projects.

Tech Stack

  • Frontend: Next.js 16 (App Router, Turbopack)
  • CMS: Sanity Studio v6 with Presentation Tool (next-sanity 13)
  • Styling: Tailwind CSS v4
  • UI Components: Radix UI primitives
  • Icons: Phosphor Icons, Lucide React

Project Structure

├── frontend/          # Next.js application
│   ├── app/
│   │   ├── components/
│   │   │   ├── blocks/      # Content block components
│   │   │   ├── overlays/    # Visual editing overlay components
│   │   │   └── ui/          # Reusable UI components
│   │   └── ...
│   └── sanity/              # Sanity client configuration
│
└── studio/            # Sanity Studio
    └── src/
        ├── schemaTypes/     # Content schemas
        └── structure/       # Studio structure configuration

Getting Started

Prerequisites

  • Node.js 22.12+ (required by Sanity Studio v6; Node 22 LTS recommended — Node 24 has been reported to segfault during npm install on macOS)
  • A Sanity account (sanity.io)

Installation

  1. Clone the repository and install dependencies:
npm install
  1. Create environment files:

.env (project root — used by seed scripts)

SANITY_STUDIO_PROJECT_ID="your-project-id"
SANITY_STUDIO_DATASET="production"
SANITY_API_TOKEN="your-write-token"

Create a token with Editor permissions at sanity.io/manage → your project → API → Tokens. The seed script reads SANITY_STUDIO_PROJECT_ID (or NEXT_PUBLIC_SANITY_PROJECT_ID) to know which project to write to.

studio/.env

SANITY_STUDIO_PROJECT_ID="your-project-id"
SANITY_STUDIO_DATASET="production"
SANITY_STUDIO_PREVIEW_URL="http://localhost:3001"

frontend/.env.local

NEXT_PUBLIC_SANITY_PROJECT_ID="your-project-id"
NEXT_PUBLIC_SANITY_DATASET="production"
NEXT_PUBLIC_SANITY_API_VERSION="2025-09-25"
NEXT_PUBLIC_SANITY_STUDIO_URL="http://localhost:3334"
SANITY_API_READ_TOKEN="your-read-token"
ANTHROPIC_API_KEY="your-anthropic-key"  # Optional — enables Claude assistant
  1. Seed starter content:
npm run seed

This single command populates your Sanity dataset with everything you need to get started:

Category What gets created
Singletons Site Settings, Navigation (links + CTA), Footer (link columns + social links)
Pages Home page (hero section) + Mast demo page (all block types)
Blog 3 categories + 5 sample blog posts
People 2 sample authors (Jane Doe, Alex Chen)
Section Templates Hero Center, Features 3-Column, CTA Banner, FAQ Accordion
Content Variables Brand Name, Support Email, Tagline
Claude AI Config API Settings, Training/Instructions, 4 Quick Actions

After seeding, open Sanity Studio and publish all documents so they appear on the frontend.

  1. Start the development servers:
npm run dev

Development

Running Dev Servers

npm run dev           # Run both Studio and Next.js
npm run dev:studio    # Run only Sanity Studio
npm run dev:next      # Run only Next.js frontend

Checks

npm run lint          # ESLint on the frontend
npm run type-check    # TypeScript in both workspaces
npm run format        # Prettier

Type Generation

After changing any Sanity schema, regenerate the schema snapshot and typed query results and commit both generated files (studio/schema.json, frontend/sanity.types.ts) — CI fails if they're stale:

cd frontend && npm run typegen

Documentation

Document Description
Full Project Code Review Comprehensive technical specification of the codebase
Claude Assistant Porting Guide Extract the AI assistant plugin for other projects
CLAUDE.md Project-specific context for Claude Code

This project is configured to work with AI assistants like Claude Code. The .claude/ directory contains performance optimization skills (React and Sanity best practices) that provide context for high-quality code generation.

Contributing

Contributions are welcome! See CONTRIBUTING.md for setup instructions and guidelines. To report a security issue, see SECURITY.md.

Credits

License

This project is open source under the MIT License.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

22 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages