Guide for creating new themes from preset template. CRITICAL: Includes MANDATORY dependency management rules for NPM distribution.
Complete guide for scaffolding and configuring new themes from the preset template.
Si
@nextsparkjs/coretiene una dependencia, los themes DEBEN declararla comopeerDependency, NUNCA comodependency.
{
"name": "@nextsparkjs/theme-NOMBRE",
"version": "1.0.0",
"private": false,
"main": "./config/theme.config.ts",
"dependencies": {
// Plugins que el theme requiere
"@nextsparkjs/plugin-langchain": "workspace:*"
},
"peerDependencies": {
"@nextsparkjs/core": "workspace:*",
"next": "^15.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zod": "^4.0.0"
// Agregar otras de core que el theme use directamente
}
}
| Package | Can Import From |
|---|---|
| Theme | Core (peer), plugins (dep/peer), itself (never other themes) |
pnpm create:theme <theme-name>core/templates/contents/themes/starter/themes/<theme-name>/Before creating ANY theme, collect:
Required Information:
1. Theme name (lowercase, hyphenated slug)
2. Display name (human-readable)
3. Description (purpose of the theme)
4. Author (team or individual)
5. Primary use case (SaaS type, industry, features)
6. Color preferences (optional - can use defaults)
pnpm create:theme <theme-name>
pnpm create:theme <theme-name> \
--description "Theme description" \
--author "Author Name" \
--display-name "Display Name"
pnpm create:theme project-manager \
--description "Project management SaaS application" \
--author "Development Team" \
--display-name "Project Manager"
contents/themes/<theme-name>/
├── config/
│ ├── theme.config.ts # Visual configuration
│ ├── app.config.ts # Application overrides
│ ├── dashboard.config.ts # Dashboard settings
│ └── permissions.config.ts # Permission overrides
├── about.md # Theme description
├── styles/
│ ├── globals.css # CSS variables
│ └── components.css # Component overrides
├── messages/
│ ├── en.json # English translations
│ └── es.json # Spanish translations
├── migrations/
│ ├── README.md # Migration docs
│ └── 001_example_schema.sql
├── docs/01-overview/
│ ├── 01-introduction.md
│ └── 02-customization.md
├── blocks/hero/ # Example hero block
├── entities/ # Data entities (optional)
│ └── [entity]/ # Each entity has 4 required files
│ ├── [entity].config.ts
│ ├── [entity].fields.ts
│ ├── [entity].types.ts
│ ├── [entity].service.ts
│ └── messages/
├── templates/ # Page overrides
├── public/brand/ # Brand assets
└── tests/ # Theme tests