A general-purpose documentation template for web projects. Framework-agnostic, content-first, and ready to deploy.
Live Demo: https://docubase-docs.vercel.app
The fastest way to create a new DocuBase documentation site:
npx create-docubase my-docs
cd my-docs
npm run devYour site will be available at http://localhost:4321.
- Content-First: Write documentation in MDX with full component support
- Framework-Agnostic: Works with any UI library or none at all
- Multiple Content Types: Documentation, blog posts, and tutorials out of the box
- AI Chat Assistant: Built-in RAG-powered chat that answers questions about your docs
- Static Site Generation: Fast, SEO-friendly pages that deploy anywhere
- Type-Safe: Full TypeScript support with Astro Content Collections
- Dark Mode: Automatic dark mode support via CSS media queries
- Astro - Static site framework
- MDX - Markdown with components
- TypeScript - Type safety
- Tailwind CSS - Styling
- Google Gemini - AI chat responses
- Upstash Vector - Vector search for RAG
- Storybook - Component playground (optional)
- Node.js 18 or higher
Run the CLI directly without installing:
npx create-docubase my-docsThe CLI will:
- Create a new directory with your project name
- Copy the DocuBase template files
- Prompt you to install dependencies
- Provide next steps to get started
Install the CLI globally for repeated use:
npm install -g create-docubase
create-docubase my-docspnpm create docubase my-docsyarn create docubase my-docsYou can also clone the template directly:
git clone https://github.com/Sithumli/DocuBase.git my-docs
cd my-docs
# Install dependencies
npm install
# Start development server
npm run devYour site will be available at http://localhost:4321.
src/
├── content/
│ ├── docs/ # Documentation pages
│ ├── blog/ # Blog posts
│ └── tutorials/ # Tutorials and guides
│
├── layouts/
│ └── DocsLayout.astro
│
├── components/ # Reusable, framework-agnostic components
│ ├── Callout.astro
│ ├── CodeGroup.astro
│ ├── Collapsible.astro
│ ├── Example.astro
│ ├── Step.astro
│ ├── Steps.astro
│ └── Tabs.astro
│
├── pages/
│ ├── index.astro
│ ├── docs/
│ ├── blog/
│ └── tutorials/
│
├── stories/ # Storybook stories (optional)
└── styles/
└── global.css
.storybook/ # Storybook configuration (optional)
astro.config.mjs
package.json
Create documentation pages in src/content/docs/:
---
title: Page Title
description: Brief description
order: 1
category: Getting Started
draft: false
---
Your content here...Add blog posts to src/content/blog/:
---
title: Post Title
description: Post description
pubDate: 2024-01-15
author: Author Name
tags: [tag1, tag2]
draft: false
image: /images/post-image.jpg
---
Post content here...Create tutorials in src/content/tutorials/:
---
title: Tutorial Title
description: What you'll learn
difficulty: beginner | intermediate | advanced
duration: 30 minutes
prerequisites:
- Prerequisite 1
- Prerequisite 2
tags: [tag1, tag2]
order: 1
draft: false
---
Tutorial content here...DocuBase includes several built-in components for MDX:
import Callout from '../../components/Callout.astro';
<Callout type="note">This is a note.</Callout>
<Callout type="tip">This is a tip.</Callout>
<Callout type="warning">This is a warning.</Callout>
<Callout type="danger">This is a danger alert.</Callout>
<Callout type="info">This is info.</Callout>
<Callout type="tip" title="Custom Title">With a custom title.</Callout>import Tabs from '../../components/Tabs.astro';
<Tabs labels={["Tab 1", "Tab 2", "Tab 3"]}>
<div>Content for Tab 1</div>
<div>Content for Tab 2</div>
<div>Content for Tab 3</div>
</Tabs>import CodeGroup from '../../components/CodeGroup.astro';
<CodeGroup labels={["npm", "pnpm", "yarn"]}>
<div>```bash
npm install package
```</div>
<div>```bash
pnpm add package
```</div>
<div>```bash
yarn add package
```</div>
</CodeGroup>import Steps from '../../components/Steps.astro';
import Step from '../../components/Step.astro';
<Steps>
<Step title="First Step">
Instructions for the first step.
</Step>
<Step title="Second Step">
Instructions for the second step.
</Step>
</Steps>import Collapsible from '../../components/Collapsible.astro';
<Collapsible title="Click to expand">
Hidden content here...
</Collapsible>
<Collapsible title="Open by default" defaultOpen={true}>
This starts expanded.
</Collapsible>import Example from '../../components/Example.astro';
<Example title="Example Title" description="Optional description">
Interactive content here
</Example>DocuBase includes a built-in AI chat assistant that uses RAG (Retrieval-Augmented Generation) to answer questions about your documentation.
- Copy the environment file:
cp .env.example .env- Add your API keys to
.env:
# Upstash Vector (https://console.upstash.com/vector)
UPSTASH_VECTOR_REST_URL=your_url_here
UPSTASH_VECTOR_REST_TOKEN=your_token_here
# Google Gemini (https://aistudio.google.com/apikey)
GOOGLE_GENERATIVE_AI_API_KEY=your_key_here- That's it! Content is automatically indexed on every build.
- Content is automatically indexed when you run
pnpm run build - Users can ask questions via the chat widget or "Ask Anything" input
- The AI searches your docs and provides relevant answers with sources
- No manual indexing required - just write docs and deploy
- AskAnything: Homepage input for starting a chat
- ChatWidget: Floating chat button (can be added to any layout)
DocuBase includes an optional Storybook setup for developing and showcasing components:
# Start Storybook
npm run storybookStorybook will be available at http://localhost:6006.
The Storybook setup is completely separable from the documentation site. You can:
- Remove the
.storybook/directory andsrc/stories/if not needed - Remove Storybook-related devDependencies from
package.json - Remove the
storybookandbuild-storybookscripts
# Build the static site
npm run build
# Preview the build
npm run previewThe output will be in the dist/ directory.
DocuBase generates a static site that can be deployed to any hosting provider:
- Connect your repository to Cloudflare Pages
- Set build command:
npm run build - Set output directory:
dist
- Add a GitHub Actions workflow:
# .github/workflows/deploy.yml
name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm install
- run: npm run build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./distBoth platforms auto-detect Astro projects. Just connect your repository.
Update the site option in astro.config.mjs:
export default defineConfig({
site: 'https://docubase-docs.vercel.app',
// ...
});Edit the CSS variables in src/styles/global.css:
@theme {
--color-primary-500: #3b82f6;
--color-primary-600: #2563eb;
/* ... */
}MIT