This documentation website is built using Docusaurus.
-
Clone the repository
git clone https://github.com/RevenueCat/docs.git cd docusaurus -
Install dependencies
yarn install
-
Start development server
yarn start
This opens
http://localhost:3030and auto-reloads when you make changes.
If you aren't comfortable using GitHub to make changes, please contact RevenueCat Support or open an Issue with your requested change here.
- Create a new branch for your changes
- Edit documentation in the
/docsfolder using Markdown (.md) or MDX (.mdx) - Test locally using
yarn start - Open a Pull Request - this automatically deploys to the dev environment
- Review and merge - changes are automatically deployed to production
docusaurus/
├── docs/ # Documentation content (.md/.mdx files)
├── src/
│ ├── components/ # React components
│ ├── css/ # Global styles
│ ├── sidebars/ # Sidebar configuration utilities
│ └── theme/ # Theme customizations
├── static/
│ ├── icons/ # SVG icons for sidebar categories
│ ├── img/ # Images and assets
│ └── fonts/ # Custom fonts
├── sidebars.ts # Sidebar navigation structure
└── docusaurus.config.js # Site configuration
- Use
.mdfor simple documentation without React components - Use
.mdxfor pages that need custom components or code snippets - Store files in appropriate subdirectories within
/docs - Use descriptive filenames that match the content
- Headers: Use clear, descriptive headings with proper hierarchy (beginning with H2 → H3, etc.)
- Code: Use proper syntax highlighting with language tags
- Images: Optimize images and use descriptive alt text
- Links: Use relative links for internal pages, absolute for external
- Logical Flow: Organize content from basic to advanced concepts
- Cross-References: Link to related sections and external resources
- Examples: Include practical examples and use cases
- Screenshots: Keep images up-to-date and annotated when helpful
For tabbed code blocks, use the global RCCodeBlock component in .mdx files:
import content from "@site/code_blocks/welcome/getting_started.swift?raw";
<RCCodeBlock
tabs={[
{
type: RCCodeBlock.languages.swift,
content: content,
title: "iOS Implementation", // optional
},
{
type: RCCodeBlock.languages.kotlin,
content: kotlinContent,
title: "Android Implementation", // optional
},
]}
/>;Please note: .ts and .js files are unsupported. Please add the plain text .txt suffix to these snippets, and reference like:
import content from "@site/code_blocks/welcome/getting_started.ts.txt?raw";Supported Languages: Check RCCodeBlock.languages for available syntax highlighting.
Add video content using the global YouTubeEmbed component:
<YouTubeEmbed videoId="dQw4w9WgXcQ" title="Getting Started with RevenueCat" />- Store images in
/static/img/directory - Use WebP format when possible for better performance
- Include descriptive alt text for accessibility
- Consider dark mode compatibility
The sidebar system is the heart of the documentation navigation, defined in sidebars.ts. The system uses TypeScript utilities from sidebar-utils.ts to create a structured tree of categories, subcategories, pages, and links.
There are four types of sidebar items:
- Category - Top-level sections with icons and custom styling
- SubCategory - Collapsible sections that can have their own landing pages
- Page - Individual documentation pages
- Link - References to pages in other categories
Categories are the main navigation sections and support custom icons and colors:
const exampleCategory = Category({
iconName: "sparkle", // Icon from /static/icons/ directory
iconColor: "var(--rc-blue-primary)", // Optional custom color (defaults to blue)
label: "Example Category",
itemsPathPrefix: "example/", // Path prefix for all items in this category
items: [
// ... category items
],
});Available Icons: The iconName should correspond to SVG files in /static/icons/. Common icons include:
"sparkle"- For guides and highlights"hammer"- For projects and development"mobile"- For SDK documentation"person"- For customer-related docs"chart-bar"- For analytics and metrics"key"- For account and security
Icon Colors: Use CSS variables for consistent theming:
"var(--rc-red-primary)"- Default red theme"var(--rc-blue-primary)"- Blue accent"var(--rc-green-primary)"- Success/positive actions- Custom colors can be defined in
custom.css
SubCategories create collapsible sections within categories:
SubCategory({
label: "Getting Started",
slug: "getting-started", // Optional: creates a landing page
itemsPathPrefix: "getting-started/",
items: [Page({ slug: "quickstart" }), Page({ slug: "installation" })],
index: {
// Optional: generated index page
title: "Getting Started Guide",
link: "getting-started-overview",
description: "Learn the basics of RevenueCat",
},
});Pages represent individual documentation files:
Page({ slug: "installation/ios" });
// References: /docs/installation/ios.md or ios.mdxThe final path is constructed as: itemsPathPrefix + slug
Links reference pages in other categories:
Link({
label: "SDK Reference",
slug: "/platform-resources/sdk-reference",
});
// Creates a link with arrow indicator (→)const mobileSDKCategory = Category({
iconName: "mobile",
label: "RevenueCat SDK",
itemsPathPrefix: "getting-started/",
items: [
Page({ slug: "quickstart" }),
SubCategory({
label: "Install the SDK",
slug: "installation",
itemsPathPrefix: "installation/",
items: [
Page({ slug: "ios" }), // → /docs/getting-started/installation/ios
Page({ slug: "android" }), // → /docs/getting-started/installation/android
Page({ slug: "reactnative" }),
],
}),
Link({
label: "Identifying Users",
slug: "/customers/user-ids",
}),
],
});The system supports multiple sidebar configurations:
const sidebars = {
defaultSidebar: [
welcomeCategory,
projectsCategory,
mobileSDKCategory,
// ... more categories
],
dataSidebar: [metricsCategory, chartsCategory],
integrationsSidebar: [eventsCategory, webhooksCategory],
};Paths are built hierarchically:
- Base:
/docs/ - Category prefix:
itemsPathPrefixfrom Category - SubCategory prefix:
itemsPathPrefixfrom SubCategory - Page slug:
slugfrom Page
Example: Category({ itemsPathPrefix: "sdk/" }) → SubCategory({ itemsPathPrefix: "ios/" }) → Page({ slug: "installation" }) = /docs/sdk/ios/installation
- Consistent Iconography: Use appropriate icons that match the content type
- Logical Grouping: Group related content in SubCategories
- Clear Labels: Use descriptive labels that match the content
- Path Prefixes: Use consistent path prefixes to organize file structure
- Color Coding: Use custom colors sparingly for important categories
- Node.js: Version 18+ recommended
- Yarn: Package manager (or npm)
# Install dependencies
yarn install
# Optional: Install typos checker for spell checking
brew install typos-cliThe typos checker helps catch spelling errors and can be integrated with:
- Pre-commit hooks (automatic when
typos-cliis installed) - VS Code extension
- GitHub Actions (runs on PRs)
# Start development server (with hot reload)
yarn start
# Build for production
yarn build
# Serve production build locally
yarn serveyarn startThis command:
- Starts a local development server on
http://localhost:3000 - Opens your browser automatically
- Enables hot reloading for most changes
- Shows build errors and warnings in the console
- Fast Refresh: Most changes reflect immediately without full page reload
- Search: Local search is available and indexes content automatically
- Dark Mode: Test both light and dark themes
- Mobile: Test responsive design on different screen sizes
yarn buildThis generates static content in the build directory that can be served by any static hosting service.
yarn build && yarn serveThis serves the production build locally on http://localhost:3000 to test before deployment.
- Development: Automatic deployment on PR creation
- Production: Automatic deployment on merge to main branch
- Manual: Can be deployed to any static hosting service
Build Failures
- Check for invalid Markdown syntax in
/docsfiles - Ensure all imported components are properly installed
- Verify all links and images exist
Missing Content
- Check
sidebars.tsconfiguration - Verify file paths match the sidebar structure
- Ensure files have proper frontmatter
Styling Issues
- Check CSS custom properties in
src/css/custom.css - Verify Tailwind classes are properly configured
- Test in both light and dark modes
- Check the console for build errors and warnings
- Review the Docusaurus docs at docusaurus.io
- Search existing issues in the repository
- Open a new issue with detailed information about the problem
- Colors: Modify CSS variables in
src/css/custom.css - Fonts: Add custom fonts to
/static/fonts/and update CSS - Components: Override theme components in
src/theme/
- Site settings: Edit
docusaurus.config.js - Navigation: Update
sidebars.ts - Plugins: Add/configure plugins in the config file
- Check existing issues to avoid duplicate work
- Discuss major changes in an issue before implementation
- Follow the style guide for consistency
- Create a descriptive PR title and description
- Link related issues using keywords (fixes #123)
- Request review from appropriate team members
- Live Documentation: docs.revenuecat.com
- RevenueCat Dashboard: app.revenuecat.com
- Support: RevenueCat Support
- Community: RevenueCat Community