A modern, responsive documentation kit built with Next.js 15, Tailwind CSS, and MDX. Perfect for creating beautiful API documentation, guides, and technical documentation websites.
π Visit us at luffa.dev
- Modern Stack: Built with Next.js 15.3.4, React 18, and TypeScript
- π€ AI-Powered Search: RAG (Retrieval-Augmented Generation) search with Upstash Vector
- π MDX Support: Write documentation in Markdown with React components
- π¨ Syntax Highlighting: Code blocks with Shiki highlighting support
- π Dark Mode: Built-in dark/light theme toggle
- π± Responsive Design: Mobile-first responsive design with Tailwind CSS
- π Dual Search: Traditional FlexSearch + AI-powered semantic search
- π Navigation: Automatic navigation generation from file structure
- β‘ Fast: Static site generation for optimal performance
- π¨ Customizable: Easy to customize themes and extend functionality
# Clone the repository
git clone https://github.com/llamacto/luffa.git
cd luffa
# Install dependencies
npm install
# Set up environment variables (see Environment Setup below)
cp env.example .env.local
# Start development server
npm run dev
Create a .env.local
file:
# Upstash Vector Database (Free: 10,000 vectors + 10,000 queries/month)
UPSTASH_VECTOR_REST_URL=https://your-vector-db-url.upstash.io
UPSTASH_VECTOR_REST_TOKEN=your_vector_token_here
# OpenAI API Key
OPENAI_API_KEY=sk-your_openai_api_key_here
-
Create Upstash Vector Database
- Sign up at upstash.com
- Create a Vector Database
- Copy REST URL and Token
-
Get OpenAI API Key
- Visit platform.openai.com
- Create new API key
-
Sync Documentation
npm run sync-docs
src/
βββ app/
β βββ api-reference/
β β βββ page.mdx # API documentation
β βββ guides/
β β βββ getting-started/
β β β βββ page.mdx # Guide pages
β β βββ advanced/
β β βββ page.mdx
β βββ page.mdx # Homepage
βββ content/ # Additional content (optional)
β βββ tutorials/
β βββ examples/
docs/ # External docs folder (optional)
- Accuracy: High (based on actual documentation)
- Context: Provides relevant document sources with relevance scores
- Response: Contextually aware answers with source attribution
- Fallback: Automatically falls back to basic AI if RAG fails
- Accuracy: Medium (general knowledge about your product)
- Context: None
- Response: General knowledge-based answers
Using Upstash free tier:
Service | Free Limit | Perfect For |
---|---|---|
Vector Database | 10,000 vectors + 10,000 queries/month | Documentation chunks |
Redis | 10MB + 10,000 commands/day | Search result caching |
QStash | 500 messages/month | Webhook notifications |
OpenAI Free Tier: 3 requests/minute for embeddings (rate-limited in sync script)
# Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
# Documentation Management
npm run sync-docs # Sync MDX files to vector database
# Code Quality
npm run lint # Run ESLint
π MDX Documents
β
π Sync Script (splits into chunks)
β
π§ OpenAI Embeddings
β
ποΈ Upstash Vector Database
β
π User Search Query β Semantic Search β π€ AI Response + Sources
Luffa includes a custom color palette inspired by natural fibers:
- Primary: Luffa green shades (
luffa-50
toluffa-950
) - Accent: Warm orange shades (
accent-50
toaccent-950
)
Edit tailwind.config.ts
to customize colors.
Edit src/app/api/rag-search/route.ts
:
// Adjust number of search results
topK: 8, // Default is 5
// Change embedding model
model: 'text-embedding-3-large', // Higher accuracy, higher cost
Edit scripts/sync-docs.js
:
// Adjust chunk size and overlap
const chunks = splitTextIntoChunks(doc.content, 1500, 300)
- Build Size: ~163KB optimized
- Search Latency:
- RAG Search: ~2-3 seconds
- Basic AI: ~1-2 seconds
- Traditional Search: <100ms
- Fork this repository
- Connect to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically
- Run sync after deployment:
npm run sync-docs
- Set environment variables
- Build the project:
npm run build
- Deploy the
.next
folder - Run sync script to populate vector database
Users can toggle between two search modes in the AI search interface:
- RAG Search: Searches your actual documentation using semantic similarity
- Basic AI: General AI assistant for questions about your product
- Structure: Use clear headings and sections
- Metadata: Include title, description, and tags in frontmatter
- Content: Write comprehensive, clear explanations
- Updates: Run
npm run sync-docs
after content changes - SEO: Include relevant keywords naturally
- Framework: Next.js 15
- Styling: Tailwind CSS
- Content: MDX
- Search: FlexSearch + Upstash Vector
- AI: OpenAI GPT
- Syntax Highlighting: Shiki
- Animations: Framer Motion
MIT License - see LICENSE.md for details.
Based on TailwindUI Protocol template with significant modifications and enhancements for the Luffa documentation platform.
We welcome contributions! Please read our contributing guidelines and feel free to submit pull requests.
- GitHub Issues: Report bugs or request features
- Documentation: Full setup guide
- Discord: Join our community (coming soon)
Built with β€οΈ for the documentation community