3.7 KiB
✨ Lumify Sanity Template
Modern web template for Next.js, Sanity Studio, and Bun, with monorepo structure and reusable UI components. 🚀
🧩 Features
- ⚡ Next.js (App Router, TypeScript, Tailwind CSS)
- 📝 Sanity Studio (custom schemas, live preview, type generation)
- 🏗️ Monorepo (TurboRepo, packages for UI and Sanity connection)
- 🎨 Reusable UI components
🗂️ Project Structure
apps/
client/ # Next.js frontend app
src/
app/ # App router pages & layouts
components/ # React UI components
lib/ # Utility functions
public/ # Static assets
studio/ # Sanity Studio (CMS)
packages/
sanity-connection/ # Shared Sanity config/utilities
typescript-config/ # Shared tsconfig presets
ui/ # Shared UI components
🏁 Getting Started
1️⃣ Sanity Project Setup
-
Create a new project at sanity.io
-
Copy your Project ID for later
-
In Sanity, set up the following CORS origins:
URL Status https://example.vercel.app Not Allowed http://localhost:3000 Not Allowed https://*.api.sanity.io Not Allowed wss://*.api.sanity.io Not Allowed https://example.sanity.studio Allowed http://localhost:3333 Allowed -
Create a token with
Viewerpermissions (for live preview):Name Permissions Main Token (Copy it for the next step) Viewer
2️⃣ Configure the Repo
Edit packages/sanity-connection/index.ts and fill in:
pageTitle– Name for your Sanity StudiopublicViewerToken– The token from abovestudioHost– Lowercase, no special chars (e.g.myproject)studioUrl–https://<studioHost>.sanity.studioprojectId– From Sanity project settingspreviewUrl– Your website URL (http://localhost:3000for local dev)
💻 Local Development
Install dependencies (from the root):
bun install
Start all apps (Next.js and Sanity Studio) in parallel from the root:
bun run dev
✨ You do not need to cd into any subdirectory—TurboRepo will handle running the correct scripts in each package/app.
🛠️ Useful Scripts
| Script | Description |
|---|---|
| bun run dev | Start dev server (client/studio) |
| bun run build | Build app/studio |
| bun run deploy | Deploy Sanity Studio |
| bun run generate | Generate Sanity types |
🚢 Deployment
To deploy Sanity Studio:
bun run deploy
🧬 Type Generation
To generate types from your Sanity schemas:
bun run generate
on github
🚀 Use This Template
Easily kickstart your own project with this template on GitHub:
-
⭐️ Go to the repository page on GitHub.
-
⤴️ Click the "Use this template" button (top right) and select "Create a new repository".
-
📝 Fill in your new repository details and click "Create repository from template".
-
⬇️ Clone your new repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name -
📦 Install dependencies and start development:
bun install bun run dev -
🛠️ Follow the Getting Started steps above to configure your Sanity project and environment.
Happy building! 🎉