A Turborepo starter template with Next.js, Nextra, Storybook, and a shared pre-configured shadcn/ui package, powered by Bun and Biome
A Turborepo starter template with Next.js, Nextra, Storybook, and a shared pre-configured shadcn/ui package, powered by Bun and Biome
A powerful monorepo starter template featuring Next.js, Nextra, and a shared pre-configured shadcn/ui package, powered by Bun, Vitest, Playwright, Storybook, and Biome.
# Clone the repository
git clone https://github.com/gmickel/turborepo-shadcn-nextjs.git
# Navigate to the project directory
cd turborepo-shadcn-nextjs
# Install dependencies
bun install
# Start development server
bun devbun ui:add:component This works just like the add command in the
shadcn/uiCLI.
graph TD
A[Turborepo] --> B[Apps]
A --> C[Packages]
B --> D[@repo/docs]
B --> E[@repo/web]
B --> F[@repo/storybook]
C --> G[@repo/ui]
C --> H[@repo/utils]
C --> I[@repo/tsconfig]| App/Package | Description |
|---|---|
@repo/docs |
Documentation site powered by Nextra 3 alpha |
@repo/web |
Main Next.js web application |
@repo/ui |
Core React components and design system shared by both web and docs applications (powered by shadcn/ui) |
@repo/utils |
Shared React utilities ️ |
@repo/tsconfig |
Shared tsconfig.json configurations ️ |
Each package and app is 100% TypeScript.
This Turborepo has some additional tools already set up for you:
This Turborepo includes Storybook for component development and documentation. Storybook is set up for both the @repo/web and @repo/ui packages, allowing the development and showcasing of components from both your main application and your shared UI library.
To run Storybook:
bun storybookThis will start Storybook and open it in your default browser.
Storybook is configured to find stories in the following locations:
apps/storybook/src/**/*.mdxapps/storybook/src/**/*.stories.@(js|jsx|mjs|ts|tsx)apps/web/src/**/*.stories.@(js|jsx|mjs|ts|tsx)packages/ui/src/**/*.stories.@(js|jsx|mjs|ts|tsx)This configuration allows you to write stories for components in both your web application and your shared UI library.
This setup includes several useful Storybook addons:
@storybook/addon-links: For linking between stories@storybook/addon-essentials: A curated set of addons for a great developer experience@storybook/addon-onboarding: For onboarding new users@storybook/addon-interactions: For testing component interactions@storybook/addon-themes: For theme switching in Storybook@storybook/addon-styling-webpack: For handling CSS and PostCSS in Storybookbun build - Build all apps and packagesbun dev - Develop all apps and packagesbun dev:ui - Develop all apps and packages and display the output in Turbo's new experimental UIbun test - Run all tests with vitestbun test:cov - Run all unit tests with vitest and generate a coverage reportbun test:cov:ui - Run all unit tests with vitest and display the vitest UIbun test:e2e - Run all end-to-end tests with playwrightbun lint - Lint and format all packagesbun lint:fix - Lint, format, and fix all packagesbun changeset - Generate a changeset - WIPbun clean - Clean up all node_modules and dist folders (runs each package's clean script)bun ui:add:component - Add a shadcn/ui component to the @repo/ui packagebun storybook - Run Storybook for component development and documentationTurborepo offers a simple command to add new apps or packages to the monorepo. To add a new app, run the following command:
bun turbo gen workspace [--name ]You will be prompted to choose the name and workspace type (app or package) to use.
You can copy an existing app or package with:
bun turbo gen workspace [--name ] --copyYou will be prompted to choose the name and workspace type (app or package) of the new app and which app or package to copy.
[! NOTE] Remember to run
bun installafter copying an app. ⚠️
This Turborepo uses GitHub Actions for CI.
It comes preconfigured with the following workflow that runs on every push or pull request to the main branch:
This template includes some useful automation tools:
Keeps dependencies up-to-date automatically with daily checks and update rules.
Can automatically merges patch updates from Dependabot to reduce manual work.
For the auto-merge workflow:
repo scope and add it as a repository secret named GITHUB_TOKEN for enhanced security.Maintains an up-to-date list of contributors in your README.
WIP
For more information, refer to the official Changesets documentation.
This Turborepo is set up for easy deployment of its various applications.
The docs and web apps can be deployed to Vercel without any additional configuration. This allows for quick and easy deployment of your Next.js applications.
You can view the test deployments for these apps:
apps/web: https://turborepo-shadcn-nextjs-web.vercel.app/apps/docs: https://turborepo-shadcn-nextjs-docs.vercel.app/The apps/storybook is automatically deployed to GitHub Pages using a custom workflow.
.github/workflows/storybook-deploy.yml Gordon MickelPRs and main pushes run the deterministic build, unit tests, Chromium smoke and lint. Superseded PR runs are cancelled. Dependency updates are grouped weekly at the workspace root; Storybook publishes only when its inputs change. Contributor refreshes run weekly or manually. Run focused tests locally during edits; no scheduled browser suite is needed for this template.
No open issues yet, or sync has not completed.