Overview
Zendocs is a starter project built with Next.js + MongoDB that helps you put your documentation and SEO on autopilot. Instead of manually creating and maintaining docs pages, you upload your documentation, and the Alchemyst Platform takes care of indexing, generating SEO-friendly pages, and enabling Q&A directly from your docs.Get Started
⚡ After setup, upload a small test file. You should see:
- A successful request at
/api/uploadin DevTools- A record created in MongoDB
- A new SEO-friendly page under
/docs/{id}
How It Works ?
- Prepare your docs – Gather your internal documentation (text, markdown, or zipped files).
- Create a MongoDB instance – Either self-hosted or on MongoDB Atlas.
- Sign up on Alchemyst Platform – Create an account and get an API KEY.
- Upload docs to Context Surgeon – This tool indexes your documents so the AI can use them.
- Set environment variables – Copy
.env.example→.envand fill in: - Run locally – Start the app and you’ll see your docs auto-generated with SEO pages.
- Ask questions – Users can search or ask questions, and get answers powered by your docs.
Environment Variables
Set these in.env:
⚠️ Remember to keep .env out of version control.
Code Structure
Architecture & Flow
Zendocs is divided into four main modules: Frontend, Backend, Database, and Config. Below is a detailed breakdown with flowcharts for each module.1. Frontend
Handles user interactions, file uploads, and displaying documentation and search results.Key Files:
- src/pages/upload.tsx – Upload UI
- src/components/DocViewer.tsx – Displays individual docs
- src/components/Search.tsx – Search & Q&A interface
2. Backend
Processes uploaded files, interacts with the Alchemyst AI platform, and generates SEO pages.Key Files:
- src/pages/api/upload.ts – API route for uploads
- Alchemyst Platform – Indexing & embedding service
- Page Generator – Creates SEO-friendly pages and sitemap
3. Database
Stores metadata and document information for quick retrieval and search.Key Files:
- lib/mongodb.ts – MongoDB connection helper
- models/ – MongoDB schemas
4. Configuration
Environment variables manage API keys, backend URLs, and thresholds for debouncing requests.Key Variables:
Core Features
1. Document Generation
Generates docs from uploaded content via Alchemyst AI. Stored in MongoDB with metadata for fast retrieval. ->generateDocs.ts
2. Document Chat
Real-time chat for a document’s context. Integrates with Alchemyst AI for intelligent responses. ->src/components/docs/chat-app.tsx
3. Document Search
Full-text search with filtering and ranking. ->src/components/docs/doc-search.tsx
API Endpoints
1. Documents
- GET
/api/docs/list– List all docs - GET
/api/docs/[docSlug]– Get a specific doc - POST
/api/docs/search– Search docs - POST
/api/docs/generate– Generate a new doc
2. Chat
- GET
/api/docs/[docSlug]/chat/history– Get chat history - POST
/api/docs/[docSlug]/chat/generate– Generate chat response
Benefits of using Zendocs
- Personalized Documentation – Users get answers based on your uploaded docs
- SEO on Autopilot – New pages are generated and added to the sitemap automatically
- Fast Setup – Just connect MongoDB, add environment variables, and you’re ready
How to Deploy ?
Run Locally
Testing
Deployment
Configured for Next.js hosting platforms. Defaultport: 4163.
SEO & Performance
- Automatic sitemap generation
- Server-side rendering for better SEO
- Optimized image loading
- Response caching and metadata optimization
Security
- API route protection
- MongoDB connection security
- Input validation with Zod
- XSS prevention & CORS configuration
Github
Star and look at the code

