sleekcms-next
v0.3.0
Published
Generate complete Next.js apps from SleekCMS content with AI-powered code generation
Maintainers
Readme
sleekcms-next
Generate complete, fully-functional Next.js applications directly from your SleekCMS content structure with optional AI-powered code generation.
Features
- 🚀 Instant Next.js Apps: Create production-ready Next.js 14+ applications in seconds
- 🤖 AI-Powered Generation: Use OpenAI GPT-4 to intelligently generate contextually appropriate components
- 📡 Smart Data Inference: Automatically detects pages, collections, and data structures from SleekCMS
- 🎨 Intelligent Components: Generates optimized React components for products, HTML content, lists, and more
- 🎯 Built-in Styling: Tailwind CSS configured out of the box
- 📱 Responsive Design: Mobile-first responsive layouts automatically generated
- 🔐 Type Safe: Full TypeScript support included
Installation & Usage
Basic Usage (Template-Based)
npx sleekcms-next <YOUR_SLEEKCMS_TOKEN>Interactive AI Provider Selection
npx sleekcms-next <YOUR_SLEEKCMS_TOKEN> --aiThis will prompt you to choose an AI provider via keyboard:
- OpenAI (GPT-4) - Most advanced, $0.03/1K tokens
- Claude 3 (Anthropic) - Cost-effective, $0.003/1K tokens
- Gemini (Google) - Free tier available
- Skip AI - Use template-based generation
Direct AI Provider Usage
OpenAI:
npx sleekcms-next dev-mysite-abc123 --openai-key=sk-proj-...Claude (Anthropic):
npx sleekcms-next dev-mysite-abc123 --claude-key=sk-ant-...Gemini (Google):
npx sleekcms-next dev-mysite-abc123 --gemini-key=AIza...Examples
Without AI (Fast, Template-Based)
npx sleekcms-next dev-mysite-abc123xyz456With Interactive Provider Selection
npx sleekcms-next dev-mysite-abc123xyz456 --aiThen select your preferred AI provider from the menu.
Direct Provider Selection
npx sleekcms-next dev-mysite-abc123xyz456 --openai-key=sk-proj-...The AI will:
- Analyze your content structure
- Generate beautiful, contextually appropriate components
- Apply modern design patterns
- Create better user experiences
- Use appropriate spacing, hover effects, and animations
This will:
- Fetch your SleekCMS content structure
- Analyze pages, collections, and field types
- [If AI enabled] Use your chosen AI provider to generate intelligent, contextually aware components
- [If AI disabled] Use smart template-based component generation
- Create a complete Next.js project with Tailwind CSS
- Create
.env.localwith your token pre-configured
Why Use AI Mode?
| Feature | Template-Based | AI-Powered | |---------|---------------|-----------| | Speed | ⚡ Very Fast | 🐢 ~10-30s per page | | Cost | 💰 Free | 💳 Varies by provider | | Quality | ✅ Good | 🌟 Excellent | | Customization | 📋 Standard layouts | 🎨 Contextually optimized | | Design Patterns | 📐 Template-based | 🤖 AI understands content | | Creativity | 🔄 Predictable | ✨ Creative & Adaptive |
AI Provider Comparison
| Provider | Cost | Speed | Quality | Free Tier | |----------|------|-------|---------|-----------| | OpenAI GPT-4 | $0.03/1K tokens | Fast | Excellent | ❌ | | Claude 3 | $0.003/1K tokens | Fast | Excellent | ❌ | | Gemini | Variable | Medium | Good | ✅ |
Recommendation:
- Use template mode for quick prototypes or testing
- Use Claude for best cost-efficiency
- Use OpenAI for highest quality
- Use Gemini for free tier with reasonable quality
Getting API Keys
OpenAI (GPT-4)
- Visit OpenAI Platform
- Sign up or log in
- Create a new API key
- Copy the key (starts with
sk-proj-...) - Use with:
--openai-key=sk-proj-... - Cost: ~$0.01-0.05 per page
Claude (Anthropic)
- Visit Anthropic Console
- Sign up or log in
- Create a new API key
- Copy the key (starts with
sk-ant-...) - Use with:
--claude-key=sk-ant-... - Cost: ~$0.001-0.01 per page (more cost-efficient)
Gemini (Google)
- Visit Google AI Studio
- Click "Create API Key"
- Copy your API key (starts with
AIza...) - Use with:
--gemini-key=AIza... - Free tier available with rate limits
Token Format
Your SleekCMS token should be in the format: environment-siteId-apiKey
For example: dev-my-site-abc123xyz456
Getting Started with Generated App
cd sleekcms-app-<timestamp>
npm install
npm run devThen open http://localhost:3000 in your browser.
What Gets Generated
Pages
- One page component for each SleekCMS page
- Automatic routing based on page slugs
- Tailwind-styled layouts
Components
- Product Cards: Grid layouts for product collections
- Lists: Styled lists for menu items, job listings, etc.
- HTML Content: Rich text with Tailwind prose styling
- Images: Responsive image components
Config Files
next.config.js- Next.js configurationtsconfig.json- TypeScript configurationtailwind.config.ts- Tailwind CSS setuppostcss.config.js- PostCSS configuration.env.local- Environment variables (token pre-filled)
Supported Data Structures
Product Collections
Automatically generates beautiful product grids:
{
"products": [
{
"product_name": "Product Name",
"product_description": "<p>Description</p>",
"price": "$9.99",
"product_image": { "url": "..." }
}
]
}Text Lists
Styled bullet lists:
{
"items": ["Item 1", "Item 2", "Item 3"]
}HTML Content
Rich HTML rendered with prose styling:
{
"description": "<h1>Welcome</h1><p>Content here...</p>"
}Images
Responsive images with proper aspect ratios:
{
"hero_image": {
"url": "https://...",
"description": "Alt text",
"attribution": { "name": "Creator" }
}
}Environment Variables
After generation, the .env.local file will contain:
SLEEKCMS_TOKEN- Your API tokenSLEEKCMS_API_URL- Your API endpoint
You can modify these to point to different sites without regenerating.
Development
Built-in Scripts
npm run dev # Start development server
npm run build # Build for production
npm start # Run production server
npm run lint # Run ESLintCustomization
The generated app is fully yours to customize! You can:
- Modify component styling in
app/globals.css - Update Tailwind config in
tailwind.config.ts - Add new pages and components as needed
- Integrate with other services
How It Works
- Token Parsing: Extracts environment, site ID, and API key from your token
- API Fetch: Retrieves your SleekCMS content structure
- Structure Analysis:
- Identifies pages and their slugs
- Detects collections (arrays of items)
- Infers field types (images, HTML, lists, products)
- Component Generation: Creates optimized React/Next.js components
- Project Scaffolding: Generates complete Next.js boilerplate
Requirements
- Node.js 18 or higher
- npm 8 or higher
License
MIT
Support
For issues, feature requests, or questions about SleekCMS, visit:
