create-mf2-app
v2.4.0
Published
Create a production-ready SaaS app with Next.js, Convex, and AI
Readme
mf²
The startup-in-a-command monorepo built for the agent era.
bunx create-mf2-appQuick Start
bunx create-mf2-app my-app
cd my-app
bun run devThe CLI scaffolds a Turborepo monorepo with six apps and 20+ shared packages. It prompts for a project name and package manager, copies the template, sets up environment files, installs dependencies, and creates an initial git commit.
Fill in your .env.local files with API keys and start building.
What You Get
Six independently deployable apps that share typed packages:
apps/
app/ Main SaaS application (Next.js 15, App Router)
web/ Marketing website
api/ Webhooks, cron jobs, external integrations
docs/ Documentation (Mintlify)
email/ Email templates (React Email)
storybook/ Component workshop
packages/
backend/ Convex database, auth sync, AI agents, workflows
design-system/ 50+ shadcn/ui components with dark mode
auth/ Clerk authentication and route protection
payments/ Stripe via @convex-dev/stripe
ai/ Vercel AI SDK, multi-model routing, RAG
analytics/ PostHog event tracking and sessions
observability/ Sentry error tracking, BetterStack logging
security/ Arcjet bot detection, Nosecone secure headers
rate-limit/ Upstash Redis rate limiting
storage/ Convex file storage and Vercel Blob
email/ Resend transactional email
cms/ BaseHub headless CMS
seo/ Metadata, JSON-LD, Open Graph
notifications/ Knock in-app notification feeds
collaboration/ Liveblocks cursors and presence
webhooks/ Svix outbound webhook delivery
feature-flags/ Vercel feature flags with overrides
internationalization/ next-intl translations
convex/ Convex + Clerk React provider
next-config/ Shared Next.js configuration
typescript-config/ Shared tsconfigEach app imports only the packages it needs. The main app uses auth, payments, backend, and AI. The marketing site uses CMS, SEO, and analytics. The API layer uses auth, rate-limit, and security.
Stack
| Layer | Technology |
|-------|-----------|
| Framework | Next.js 15 with App Router |
| Language | TypeScript end-to-end |
| Database | Convex — real-time, reactive, serverless |
| Auth | Clerk — 80+ OAuth providers, webhook sync to Convex |
| Payments | Stripe via @convex-dev/stripe |
| Styling | Tailwind CSS v4 + shadcn/ui |
| AI | Vercel AI SDK — multi-model routing, RAG, streaming |
| Email | Resend + React Email |
| Analytics | PostHog — events, sessions, feature flags |
| Error Tracking | Sentry + BetterStack |
| Security | Arcjet — bot detection, rate limiting, DDoS protection |
| Monorepo | Turborepo + Bun |
| Deployment | Vercel |
| Code Quality | Biome via Ultracite |
Convex Components
Five Convex Components ship pre-installed — sandboxed TypeScript modules that manage their own tables and functions inside your Convex backend.
| Component | Package | Purpose |
|-----------|---------|---------|
| Stripe | @convex-dev/stripe | Checkout sessions, subscriptions, customer management, webhook sync |
| Resend | @convex-dev/resend | Transactional email delivery with event tracking |
| Workflow | @convex-dev/workflow | Durable, long-running flows with retries and delays |
| Action Retrier | @convex-dev/action-retrier | Automatic retry with backoff for unreliable external calls |
| Migrations | @convex-dev/migrations | Schema migrations for live data without downtime |
Install more from the component directory:
bun add @convex-dev/rate-limiterThen register in packages/backend/convex/convex.config.ts:
import rateLimiter from "@convex-dev/rate-limiter/convex.config.js";
app.use(rateLimiter);Commands
All commands run from the project root.
Development
bun run dev # Start all apps
turbo dev --filter=app # Start a single app
bunx convex dev # Start Convex backendCode Quality
bun run check # Lint and format check (Biome)
bun run fix # Auto-fix issues
bun run convex-lint # Lint Convex functions (ESLint)Build and Test
bun run build # Build all apps
bun run test # Run tests (Vitest)
turbo build --filter=app # Build a single appEnvironment Variables
bun run env:init # Create .env.local + .env.production from .env.example
bun run env:check # Validate all env files
bun run env:push # Sync env vars to Vercel and ConvexUpgrading
bun run bump-deps # Update all npm dependencies
bun run bump-ui # Update all shadcn/ui components
bun run clean # Remove all node_modulesCLI
Pass flags to skip interactive prompts:
bunx create-mf2-app --name my-app --package-manager bun
bunx create-mf2-app --name my-app --disable-git| Flag | Effect |
|------|--------|
| --name <name> | Set project name |
| --package-manager <manager> | bun (default), npm, yarn, or pnpm |
| --disable-git | Skip git initialization |
For npm, yarn, or pnpm, the CLI converts workspace:* dependencies and adjusts configuration files.
Deploy
Each app deploys as a separate Vercel project:
- Import your repo at vercel.com/new
- Set the root directory (
apps/app,apps/web, orapps/api) - Add environment variables from
.env.production - Push to
main— Vercel rebuilds only affected apps
Documentation (apps/docs) deploys via Mintlify, not Vercel.
Documentation
Full docs at mf2.dev/docs.
Contributing
- Fork the repository
- Create a feature branch
- Commit with conventional commits
- Open a pull request
License
MIT — Ocarina Labs
