DocuBase is built on a few core concepts that make it powerful and flexible. Understanding these will help you get the most out of your documentation site.
Content Collections
Content collections are the heart of DocuBase. They provide type-safe content management with automatic schema validation.
What are Content Collections?
Content collections are groups of related content files (like documentation pages, blog posts, or tutorials) that share the same structure and schema.
src/content/
├── docs/ # Documentation collection
├── blog/ # Blog posts collection
└── tutorials/ # Tutorials collection
Why Use Collections?
Collections enforce a consistent frontmatter schema. If you forget a required field or use the wrong type, you’ll get a helpful error at build time instead of a broken page in production.
// Schema ensures title is always present
schema: z.object({
title: z.string(),
description: z.string().optional(),
})Collections keep your content organized logically. Each collection can have its own schema, its own rendering template, and its own URL structure.
/docs/*→ Documentation pages/blog/*→ Blog posts with dates/tutorials/*→ Step-by-step guides
Need to add a new type of content? Create a new collection with its own schema. Want to query all posts by a certain author? Collections make that easy.
const posts = await getCollection('blog',
({ data }) => data.author === 'DocuBase Team'
);MDX Components
MDX lets you use React/Astro components directly in your markdown content. This is what makes DocuBase documentation interactive and visually rich.
Available Components
DocuBase includes a library of pre-built components:
| Component | Purpose |
|---|---|
| Callout | Highlight important information |
| Tabs | Organize content into tabbed sections |
| Table | Display structured data in rows and columns |
| Steps | Create numbered step-by-step guides |
| Collapsible | Hide/show content on demand |
Using Components
Import and use components in any MDX file:
import Callout from '@/components/Callout.astro';
<Callout type="tip" title="Pro tip">
Components make your docs more engaging!
</Callout>
Component documentation
See the Components page for detailed usage of each component.
Layouts and Templates
DocuBase uses layouts to provide consistent structure across pages.
Layout Hierarchy
BaseLayout
├── DocsLayout (for documentation pages)
├── BlogLayout (for blog posts)
└── Page-specific layouts
The Base Layout
Every page uses BaseLayout which provides:
- HTML document structure
- Meta tags and SEO
- Global styles
- Header and footer slots
The Docs Layout
Documentation pages use DocsLayout which adds:
- Sidebar navigation
- Table of contents
- Breadcrumbs
- Previous/Next navigation
Routing
DocuBase uses file-based routing powered by Astro.
How Routes Work
The file path determines the URL:
| File | URL |
|---|---|
| src/content/docs/getting-started.mdx | /docs/getting-started |
| src/content/blog/welcome.mdx | /blog/welcome |
| src/content/docs/guides/advanced.mdx | /docs/guides/advanced |
Dynamic Routes
DocuBase uses dynamic routes to render content collections:
src/pages/
├── docs/[...slug].astro # Renders all docs
├── blog/[...slug].astro # Renders all blog posts
└── tutorials/[...slug].astro
Frontmatter
Every content file starts with frontmatter—YAML metadata between --- markers.
Required vs Optional Fields
Documentation frontmatter:
---
title: Page Title # Required
description: Brief desc # Optional
order: 1 # Optional - sort order
category: Getting Started # Optional - for grouping
---Blog post frontmatter:
---
title: Post Title # Required
description: Summary # Required
pubDate: 2024-01-15 # Required
author: Author Name # Required
tags: [tag1, tag2] # Optional
draft: false # Optional
---Tutorial frontmatter:
---
title: Tutorial Title # Required
description: What you learn # Required
difficulty: beginner # Required
duration: 30 minutes # Required
prerequisites: [...] # Optional
tags: [topic1, topic2] # Optional
---Static Site Generation
DocuBase builds to static HTML for maximum performance and easy deployment.
Build Process
- Content Collection - All MDX files are parsed and validated
- Page Generation - Each route generates HTML files
- Asset Optimization - CSS, JS, and images are optimized
- Output - Everything goes to the
dist/folder
Benefits of Static Generation
- Fast - Pre-built HTML loads instantly
- Secure - No server-side code to exploit
- Scalable - Serve from any CDN
- Reliable - No database or runtime dependencies
Deployment
Deploy the dist/ folder to any static host: Cloudflare Pages, Vercel, Netlify, GitHub Pages, or your own server.
Next Steps
Now that you understand the core concepts:
- Install DocuBase on your machine
- Learn how to use Components
- Check out the Tutorials for hands-on practice