A production-grade monorepo starter template for building scalable modular SaaS applications with Next.js, TypeScript, and shadcn/ui.
Think: "Create Next App β but for modular enterprise systems."
This monorepo uses Turborepo and pnpm workspaces to manage multiple packages and applications.
web: A Next.js 15 application with App Router, TypeScript, and Tailwind CSS
@workspace/ui: Shared UI component library powered by shadcn/ui and Radix UI@workspace/cli: Command-line tool for project management (inspired by next-forge)@workspace/eslint-config: Shared ESLint configurations for the monorepo@workspace/typescript-config: Shared TypeScript configurations
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Build System: Turborepo
- Package Manager: pnpm
- Version Management: Changesets
- Code Quality: ESLint, Prettier, TypeScript
- Node.js >= 20
- pnpm >= 8
- Clone the repository:
git clone <your-repo-url>
cd monorepo- Install dependencies:
pnpm install- Set up environment variables:
# Copy .env.example to .env.local in apps/web
cp apps/web/.env.example apps/web/.env.local- Start the development server:
pnpm devThe web app will be available at http://localhost:3000
# Start all apps in development mode
pnpm dev
# Start a specific app
pnpm dev --filter web
# Build all apps and packages
pnpm build
# Lint all packages
pnpm lint
# Type check all packages
pnpm check-types
# Format code with Prettier
pnpm format
# Check formatting
pnpm format:check
# Clean all build outputs and node_modules
pnpm clean# Initialize a new project
pnpm cli init
# Update between versions with automatic migrations
pnpm cli update --from 0.1.0 --to 0.4.0
# Add components, pages, or API routes
pnpm cli add --component Card --type ui
pnpm cli add --component dashboard --type page
# Build CLI
pnpm cli:build
# Develop CLI in watch mode
pnpm cli:devπ Full CLI Documentation β
# Create a new changeset
pnpm changeset
# Version packages based on changesets
pnpm version-packages
# Build and release packages
pnpm releaseTo add shadcn/ui components to your project:
pnpm dlx shadcn@latest add button -c apps/webThis will add the component to packages/ui/src/components/, making it available across the entire monorepo.
Import components from the UI package:
import { Button } from "@workspace/ui/components/button"
export default function Page() {
return <Button>Click me</Button>
}This project uses Changesets for version management and changelog generation.
When you make changes, create a changeset:
pnpm changesetFollow the prompts to:
- Select which packages changed
- Choose the version bump type (major/minor/patch)
- Write a description of your changes
When ready to release:
# Update package versions and CHANGELOG.md
pnpm version-packages
# Build and publish (or create release PR)
pnpm release- Major: Breaking changes (e.g., API changes)
- Minor: New features (backward compatible)
- Patch: Bug fixes and minor improvements
monorepo/
βββ .changeset/ # Changeset configuration and files
βββ .github/
β βββ workflows/ # GitHub Actions CI/CD
βββ apps/
β βββ web/ # Next.js application
β βββ app/ # App Router pages and layouts
β βββ components/ # App-specific components
β βββ lib/ # App-specific utilities
βββ packages/
β βββ ui/ # Shared UI components
β β βββ src/
β β βββ components/ # shadcn/ui components
β β βββ lib/ # UI utilities
β βββ eslint-config/ # Shared ESLint configs
β βββ typescript-config/ # Shared TypeScript configs
βββ .cursorrules # AI assistant configuration
βββ CHANGELOG.md # Project changelog
βββ package.json # Root package.json
βββ pnpm-workspace.yaml # pnpm workspace configuration
βββ turbo.json # Turborepo configuration
βββ README.md # This file
Contains comprehensive guidelines for AI-assisted development, including:
- Coding standards and best practices
- TypeScript and React patterns
- Performance optimization guidelines
- Security best practices
Configures the Turborepo build system:
- Task dependencies
- Caching strategies
- Pipeline configurations
Defines the monorepo workspace structure for pnpm.
This project includes GitHub Actions workflows:
Runs on every push and pull request:
- Linting
- Type checking
- Format checking
- Building
Runs on push to main:
- Automatically creates release PRs
- Versions packages using changesets
- Updates CHANGELOG.md
- Keep shared code in
packages/ - Use workspace protocol for internal dependencies (
workspace:*) - Run commands from root using Turbo for caching benefits
- Maintain consistent tooling across packages
- Create a feature branch
- Make your changes
- Create a changeset:
pnpm changeset - Commit your changes with conventional commit messages
- Push and create a pull request
Follow conventional commits:
feat: add new feature
fix: resolve bug
docs: update documentation
chore: update dependencies
refactor: improve code structure
- Connect your repository to Vercel
- Configure the root directory for the web app:
apps/web - Vercel will automatically detect the Next.js configuration
Ensure you:
- Set the build command:
pnpm build --filter web - Set the output directory:
apps/web/.next - Use Node.js >= 20
- Documentation Index - Complete documentation navigation
- Quick Setup Guide - Get started in 5 minutes
- CLI Tool Guide - Complete CLI documentation
- Contributing Guide - How to contribute
- Next.js Documentation
- Turborepo Handbook
- shadcn/ui Documentation
- pnpm Workspaces
- Changesets Documentation
MIT
Contributions are welcome! Please read the contributing guidelines before submitting a PR.
- Fork the repository
- Create your feature branch
- Add your changes and create a changeset
- Push to the branch
- Open a pull request
Built with β€οΈ using modern web technologies