Skip to content

Commit 9207a72

Browse files
committed
Initial commit
Created from https://vercel.com/new
0 parents  commit 9207a72

File tree

143 files changed

+15687
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+15687
-0
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Automatically populated when deployed on Vercel
2+
# https://vercel.com/docs/environment-variables/system-environment-variables
3+
VERCEL_PROJECT_PRODUCTION_URL=registry-starter.vercel.app
4+
5+
# Optional, see README.md#authentication: _(if implementing auth in middleware.ts)_
6+
# REGISTRY_AUTH_TOKEN=

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ide
2+
.idea
3+
.vscode
4+
5+
# dependencies
6+
/node_modules
7+
/.pnp
8+
.pnp.js
9+
.yarn/install-state.gz
10+
11+
# testing
12+
/coverage
13+
14+
# next.js
15+
/.next/
16+
/out/
17+
18+
# production
19+
/build
20+
/public/r/
21+
22+
# misc
23+
.DS_Store
24+
*.pem
25+
26+
# debug
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
31+
# local env files
32+
.env*.local
33+
34+
# vercel
35+
.vercel
36+
37+
# typescript
38+
*.tsbuildinfo
39+
next-env.d.ts

README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<a href="https://registry-starter.vercel.app/">
2+
<h1 align="center">Registry Starter</h1>
3+
</a>
4+
5+
<p align="center">
6+
Registry Starter is a free, open-source template built with Next.js and Shadcn/ui Registry to accelerate your AI-Native Design System.
7+
</p>
8+
9+
<p align="center">
10+
<a href="#deploy-your-own"><strong>Deploy Your Own</strong></a> ·
11+
<a href="#open-in-v0"><strong>Open in v0</strong></a> ·
12+
<a href="#theming"><strong>Theming</strong></a> ·
13+
<a href="#mcp"><strong>MCP</strong></a> ·
14+
<a href="#authentication"><strong>Authentication</strong></a> ·
15+
<a href="#running-locally"><strong>Running Locally</strong></a> ·
16+
<a href="#file-structure"><strong>File Structure</strong></a> ·
17+
<a href="https://ui.shadcn.com/docs/registry"><strong>Read Docs</strong></a>
18+
</p>
19+
<br/>
20+
21+
## Deploy Your Own
22+
23+
You can deploy your own version of the Next.js Registry Starter to Vercel with one click:
24+
25+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fregistry-starter&project-name=my-registry&repository-name=my-registry&demo-title=Registry%20Starter&demo-description=Registry%20Starter%20is%20a%20free%2C%20open-source%20template%20built%20with%20Next.js%20and%20Shadcn%2Fui%20Registry%20to%20accelerate%20your%20AI-Native%20Design%20System.&demo-url=https%3A%2F%2Fregistry-starter.vercel.app&demo-image=%2F%2Fregistry-starter.vercel.app%2Fpreview.png)
26+
27+
## Open in v0
28+
29+
[![Open in v0](https://registry-starter.vercel.app/open-in-v0.svg)](https://v0.dev/chat/api/open?title=Dashboard+Kit&prompt=These+are+existing+design+system+styles+and+files.+Please+utilize+them+alongside+base+components+to+build.&url=https%3A%2F%2Fregistry-starter.vercel.app%2Fr%2Fdashboard.json)
30+
31+
This registry application also exposes `Open in v0` buttons for each component. Once this application is deployed, the
32+
`Open in v0` button redirects to [`v0.dev`](https://v0.dev) with a prepopulated prompt and a URL pointing back to this
33+
registry's `/r/${component_name}.json` endpoint. This endpoint will provide v0 the necessary file information, content,
34+
and metadata to start your v0 chat with your component, theme, and other related code.
35+
36+
These `/r/${component_name}.json` files are generated using `shadcn/ui` during the `build` and `dev` based on the
37+
repository's [`registry.json`](./registry.json). For more information, refer to the
38+
[documentation](https://ui.shadcn.com/docs/registry/registry-json).
39+
40+
## Theming
41+
42+
To use a custom theme for all the components, all you need to do is modify the CSS tokens in
43+
[`globals.css`](./src/app/globals.css). More information on these practices can be found
44+
on [ui.shadcn.com/docs](https://ui.shadcn.com/docs).
45+
46+
#### Fonts
47+
48+
To use custom fonts, you can either use [
49+
`next/font/google`](https://nextjs.org/docs/pages/getting-started/fonts#google-fonts) or the
50+
[`@font-face`](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) CSS rule in your
51+
[`globals.css`](./src/app/globals.css).
52+
53+
```css
54+
@font-face {
55+
font-family: 'Montserrat';
56+
font-style: normal;
57+
font-weight: 400;
58+
src: url('https://fonts.gstatic.com/s/montserrat/v15/JTUSjIg1_i6t8kCHKm45xW5rygbi49c.woff2') format('woff2'),
59+
url('https://fonts.gstatic.com/s/montserrat/v15/JTUSjIg1_i6t8kCHKm45xW5rygbj49c.woff') format('woff');
60+
}
61+
```
62+
63+
If you use `@font-face`, ensure you modify [`globals.css`](src/app/globals.css) tailwind configuration to map
64+
your custom font variables to Tailwind fonts. Refer to this
65+
[Tailwind documentation](https://tailwindcss.com/docs/font-family#customizing-your-theme)
66+
67+
## MCP
68+
69+
To use this registry with MCP, you must also edit [`registry.json`](./registry.json)'s first
70+
`registry-item` named `theme`. This `registry:theme` item not only contains the tailwind configuration, but it also
71+
contains your design tokens / CSS variables.
72+
73+
The `shadcn/ui` CLI's MCP command will use the entire `registy.json` file, so it must be put in the `/public` folder
74+
with all of your `registry:item`s. This will enable you to use your registry in tools like Cursor & Windsurf.
75+
76+
## Authentication
77+
78+
To protect your registry, you must first protect your `registry.json` and all `registry:item` JSON files.
79+
This is made possible with an environment variable and basic Next.js Middleware.
80+
81+
1. Create new `REGISTRY_AUTH_TOKEN`. For example, you can generate one:
82+
83+
```bash
84+
node -e "console.log(crypto.randomBytes(32).toString('base64url'))"
85+
```
86+
87+
2. Add new `middleware.ts` file to protect `/r/:path` routes
88+
89+
```ts
90+
// src/middleware.ts
91+
import { NextResponse } from "next/server";
92+
import type { NextRequest } from "next/server";
93+
94+
export const config = { matcher: "/r/:path*" };
95+
96+
export function middleware(request: NextRequest) {
97+
const token = request.nextUrl.searchParams.get("token");
98+
99+
if (token == null || token !== process.env.REGISTRY_AUTH_TOKEN) {
100+
return new NextResponse("Unauthorized", { status: 401 });
101+
}
102+
103+
return NextResponse.next();
104+
}
105+
106+
```
107+
108+
When using `Open in v0`, the v0 platform will use the `token` search parameter to authenticate with your Registry:
109+
110+
```ts
111+
const v0Url = `https://v0.dev/chat/api/open?url=https%3A%2F%2Fregistry-starter.vercel.app%2Fr%2Faccordion.json&token=${process.env.REGISTRY_AUTH_TOKEN}`
112+
```
113+
114+
> [!NOTE]
115+
> This method only protects the `/r/:path` routes, this does NOT protect the Registry's UI / component previews. If you
116+
> choose to protect the UI / component preview, you must ensure the `registry.json` and all `registry:item`s are
117+
> publicly accessible or protected using the `token` search parameter. This ensures v0 and other AI Tools have access to
118+
> use the registry
119+
120+
121+
## Running locally
122+
123+
```bash
124+
pnpm install
125+
pnpm dev
126+
```
127+
128+
Your app should now be running on [localhost:3000](http://localhost:3000).
129+
130+
## File Structure
131+
132+
`app/(registry)` routes contains the registry pages.
133+
134+
`app/demo` routes contains various UI primitives, Components, or Blocks (based on `registry.json`)
135+
136+
`@/components` contains all components used in the registry
137+
138+
`@/components/ui` contains all `shadcn/ui` UI Primitives used in the registry
139+
140+
`@/components/registry` contains all components for this Registry Starter application
141+
142+
`@/hooks` contains all React hooks
143+
144+
`@/lib` contains all business logic & utils
145+
146+
`@/layouts` contains all v0 layouts used in `registry.json`

biome.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json",
3+
"organizeImports": { "enabled": true },
4+
"files": {
5+
"ignore": [
6+
"node_modules",
7+
"playwright-report",
8+
".next",
9+
".vercel",
10+
".idea",
11+
"public/r",
12+
"components/ui"
13+
]
14+
},
15+
"linter": {
16+
"enabled": true,
17+
"rules": {
18+
"recommended": true,
19+
"nursery": {
20+
"useSortedClasses": "warn"
21+
}
22+
}
23+
},
24+
"formatter": {
25+
"enabled": true,
26+
"indentStyle": "space",
27+
"indentWidth": 2
28+
},
29+
"javascript": {
30+
"formatter": {
31+
"arrowParentheses": "always",
32+
"bracketSameLine": false,
33+
"bracketSpacing": true,
34+
"jsxQuoteStyle": "double",
35+
"quoteProperties": "asNeeded",
36+
"semicolons": "always",
37+
"trailingCommas": "all"
38+
}
39+
}
40+
}

components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/styles/globals.css",
9+
"baseColor": "gray",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

next.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
async headers() {
5+
return [
6+
{
7+
source: "/(.*)",
8+
headers: [
9+
{
10+
key: "X-Robots-Tag",
11+
value: "noindex, nofollow, noarchive, nosnippet, noimageindex",
12+
},
13+
],
14+
},
15+
];
16+
},
17+
};
18+
19+
export default nextConfig;

package.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "registry-starter",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"dev": "npm run registry:build && next dev --turbopack",
7+
"build": "npm run registry:build && next build",
8+
"start": "next start",
9+
"lint": "biome check",
10+
"lint:fix": "biome check --write",
11+
"registry:build": "npx shadcn@latest build"
12+
},
13+
"dependencies": {
14+
"@hookform/resolvers": "^5.2.2",
15+
"@tanstack/react-table": "^8.21.3",
16+
"@vercel/analytics": "^1.6.1",
17+
"@vercel/speed-insights": "^1.3.1",
18+
"class-variance-authority": "^0.7.1",
19+
"clsx": "^2.1.1",
20+
"cmdk": "^1.1.1",
21+
"date-fns": "^4.1.0",
22+
"embla-carousel-react": "^8.6.0",
23+
"input-otp": "^1.4.2",
24+
"lucide-react": "^0.506.0",
25+
"next": "16.0.10",
26+
"next-themes": "^0.4.6",
27+
"radix-ui": "^1.4.3",
28+
"react": "^19.2.3",
29+
"react-day-picker": "^9.12.0",
30+
"react-dom": "^19.2.3",
31+
"react-hook-form": "^7.68.0",
32+
"react-resizable-panels": "^3.0.6",
33+
"recharts": "^2.15.4",
34+
"sonner": "^2.0.7",
35+
"tailwind-merge": "^3.4.0",
36+
"vaul": "^1.1.2",
37+
"zod": "^3.25.76"
38+
},
39+
"devDependencies": {
40+
"@biomejs/biome": "1.9.4",
41+
"@tailwindcss/postcss": "^4.1.18",
42+
"@testing-library/dom": "^10.4.1",
43+
"@testing-library/jest-dom": "^6.9.1",
44+
"@testing-library/user-event": "^14.6.1",
45+
"@types/jsdom": "^21.1.7",
46+
"@types/node": "^22.19.3",
47+
"@types/react": "^19.2.7",
48+
"@types/react-dom": "^19.2.3",
49+
"@vitejs/plugin-react-swc": "^3.11.0",
50+
"jsdom": "^25.0.1",
51+
"postcss": "^8.5.6",
52+
"tailwindcss": "^4.1.18",
53+
"tw-animate-css": "^1.4.0",
54+
"typescript": "5.4.5"
55+
},
56+
"packageManager": "pnpm@9.15.2",
57+
"engines": {
58+
"node": ">=22"
59+
},
60+
"overrides": {
61+
"react-is": "^19.0.0-rc-69d4b800-20241021"
62+
}
63+
}

0 commit comments

Comments
 (0)