Skip to content

btwld/mix-docs

Repository files navigation

Mix logo

Mix Docs

Documentation site for Mix — an expressive way to build design systems in Flutter.

fluttermix.com · Mix repo · pub.dev


This repository hosts the source for the Mix documentation website. It pairs a Next.js + Nextra docs frontend with a Flutter preview bundle so every widget example in the docs is a live, interactive Flutter app compiled to WebAssembly.

Tech stack

Layer Stack
Docs site Next.js 15, Nextra 4, React 19, Tailwind CSS 4, TypeScript
Previews Flutter 3.41+, Dart 3.11+, Mix 2+
Search Pagefind
Deployment Vercel + GitHub Actions

Prerequisites

Getting started

Install dependencies for both the website and the Flutter preview package:

pnpm install
(cd packages/mix_docs_preview && flutter pub get)

Build the Flutter preview bundle and copy it into public/previews/:

bash packages/mix_docs_preview/scripts/build_web_previews.sh

Start the Next.js dev server:

pnpm dev

Open http://localhost:3000 to view the docs.

Note

The Flutter bundle only needs to be rebuilt when you change preview code in packages/mix_docs_preview/. Regular MDX and component edits are hot-reloaded by Next.js.

Project structure

.
├── src/
│   ├── app/                    # Next.js app router
│   └── content/                # MDX documentation pages
├── components/                 # React components (FlutterPreview, etc.)
├── packages/
│   └── mix_docs_preview/       # Flutter app that renders the previews
│       ├── lib/                # Preview widgets, mirrors the docs layout
│       ├── scripts/            # build_web_previews.sh
│       └── tool/               # Manifest generator
├── public/previews/            # Built Flutter web bundle (generated)
├── scripts/
│   ├── vercel-build.sh         # Vercel build entrypoint
│   └── check-previews-manifest.mjs
└── .github/workflows/          # CI for validating previews

How previews work

  1. Each preview is a Dart widget under packages/mix_docs_preview/lib/ organized to mirror the docs (overview/, guides/, widgets/, tutorials/, ecosystem/).
  2. Widgets are registered in lib/preview_registry.dart with a doc-scoped previewId (e.g. widgets/box.0).
  3. build_web_previews.sh compiles the Flutter app to WebAssembly, extracts source files, and generates previews-manifest.json.
  4. In MDX, <FlutterPreview previewId="widgets/box.0" /> loads the bundle and displays the widget alongside its source.

See packages/mix_docs_preview/README.md for details on adding a new preview.

Scripts

Command What it does
pnpm dev Run the Next.js dev server with Turbopack
pnpm build Build the docs site for production
pnpm start Serve the production build
pnpm check:previews Validate previews-manifest.json integrity

Deployment

The site is deployed to Vercel. scripts/vercel-build.sh orchestrates the full build: it installs Flutter at the version pinned in .fvmrc, compiles the preview bundle to WASM, copies it into public/previews/, validates the manifest, and finally builds the Next.js app.

A matching GitHub Actions workflow (.github/workflows/preview-docs.yml) runs on pull requests to catch preview or manifest regressions before merge.

Important

Flutter web builds are CPU and memory intensive. Expect the preview build step to dominate CI time.

Community

Releases

No releases published

Packages

 
 
 

Contributors