template setup 🚀
This commit is contained in:
159
README.md
Normal file
159
README.md
Normal file
@@ -0,0 +1,159 @@
|
||||
|
||||
|
||||
# ✨ 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
|
||||
|
||||
1. Create a new project at [sanity.io](https://www.sanity.io/)
|
||||
2. Copy your **Project ID** for later
|
||||
3. 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 |
|
||||
|
||||
4. Create a **token** with `Viewer` permissions (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:
|
||||
|
||||
1. `pageTitle` – Name for your Sanity Studio
|
||||
2. `publicViewerToken` – The token from above
|
||||
3. `studioHost` – Lowercase, no special chars (e.g. `myproject`)
|
||||
4. `studioUrl` – `https://<studioHost>.sanity.studio`
|
||||
5. `projectId` – From Sanity project settings
|
||||
6. `previewUrl` – Your website URL (`http://localhost:3000` for local dev)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 💻 Local Development
|
||||
|
||||
|
||||
Install dependencies (from the root):
|
||||
|
||||
```sh
|
||||
bun install
|
||||
```
|
||||
|
||||
|
||||
Start all apps (Next.js and Sanity Studio) in parallel from the root:
|
||||
|
||||
```sh
|
||||
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:
|
||||
|
||||
```sh
|
||||
bun run deploy
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 🧬 Type Generation
|
||||
|
||||
To generate types from your Sanity schemas:
|
||||
|
||||
```sh
|
||||
bun run generate
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
on github
|
||||
|
||||
## 🚀 Use This Template
|
||||
|
||||
Easily kickstart your own project with this template on GitHub:
|
||||
|
||||
1. ⭐️ **Go to the repository page on GitHub.**
|
||||
2. ⤴️ Click the **"Use this template"** button (top right) and select **"Create a new repository"**.
|
||||
3. 📝 Fill in your new repository details and click **"Create repository from template"**.
|
||||
4. ⬇️ Clone your new repository:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/your-username/your-repo-name.git
|
||||
cd your-repo-name
|
||||
```
|
||||
|
||||
5. 📦 Install dependencies and start development:
|
||||
|
||||
```sh
|
||||
bun install
|
||||
bun run dev
|
||||
```
|
||||
|
||||
6. 🛠️ Follow the [Getting Started](#getting-started) steps above to configure your Sanity project and environment.
|
||||
|
||||
Happy building! 🎉
|
||||
Reference in New Issue
Block a user