This file provides guidance for working with the Superwall documentation site infrastructure and build system.
For documentation content guidelines (adding/editing docs), see content/README/AGENTS.md.
From the docs directory (apps/docs):
# Generate documentation files
bun run build
# Start documentation development server
bun run dev
# Generate AI-optimized documentation files
tsx scripts/generate-llm-files.ts
tsx scripts/generate-md-files.ts
# Copy documentation images
bun run copy:docs-images
# Deploy to Cloudflare (staging)
bun run deploy:staging
# Deploy to Cloudflare (production)
bun run deployDO NOT EVER DEPLOY WITHOUT CHECKING WITH THE USER
When working on tasks that require referencing any of the Superwall SDKs (iOS, Android, Flutter, or React Native), ALWAYS run the following command first to ensure you have the latest SDK source code:
bun run download:referencesThis command will:
- Clone the iOS, Android, Flutter, and React Native SDK repositories into the
reference/directory - If the repositories already exist, it will pull the latest changes
- The reference directory is gitignored, so these repositories won't be committed
SDK repositories:
- iOS:
reference/ios/(superwall-ios) - Android:
reference/android/(superwall-android) - Flutter:
reference/flutter/(Superwall-Flutter) - React Native:
reference/react-native/(expo-superwall)
After downloading the references, you should:
- Directly examine the source files in these repositories to understand the actual implementation
- Look at the public API files to understand the exact syntax and method signatures
- Check example projects or tests to see how features are used in practice
- Use this first-hand knowledge to ensure documentation is accurate and reflects the current SDK capabilities
This direct inspection is critical for:
- Writing accurate code examples with correct syntax
- Understanding available features and their proper usage
- Ensuring documentation matches the actual SDK implementation
- Identifying any undocumented features or recent changes
- For any AI SDK or AI SDK Elements work, fetch the latest docs via Context7 MCP before making changes.
- Uses Fumadocs for documentation generation
- Source files in
/content/docs/→ Generated files in/public/ - Build process transforms
.mdxto.mdand processes content - Turbo handles build caching and optimization
source.config.ts- Fumadocs configurationsrc/lib/source.ts- Source configuration and iconssrc/app/layout.config.tsx- Site layout configurationplugins/- Custom remark plugins for content processingscripts/- Build and generation scripts
- Navigation structure defined by
meta.jsonfiles in content directories - Pages auto-generated based on file structure in
/content/docs/ - Custom components in
src/components/for enhanced UI /docs/sdk/*wildcard path renders the SDK selector page before redirecting to the chosen platform (e.g./docs/sdk/quickstart/tracking-subscription-state→/docs/ios/quickstart/tracking-subscription-state).
remark-tabs-syntax- Processes tab syntaxremark-code-language- Handles code language detectionremark-image-paths- Processes image pathsremark-sdk-filter- Filters content by SDK
- Start dev server:
bun run dev - Edit content in
/content/docs/ - Changes automatically rebuild and refresh
- Test build locally:
bun run build
- Custom components go in
src/components/ - Icons and assets in
src/lib/source.ts - Layout changes in
src/app/layout.config.tsx
- Staging:
bun run deploy:staging - Production:
bun run deploy - Uses Cloudflare Pages for hosting
- Custom themes in component configuration
- TailwindCSS for styling
- Dark/light mode disabled by default
- AI search integration
- Custom search dialog component
- Support center integration
- Images automatically optimized during build
- Static site generation for fast loading
- CDN distribution via Cloudflare
- Build caching with Turbo for fast rebuilds
- Check for syntax errors in
.mdxfiles - Verify
meta.jsonfiles are valid JSON - Run
bun run buildto see detailed error messages
- Clear cache:
rm -rf .next - Restart dev server
- Check for port conflicts
- Verify Cloudflare configuration
- Check build logs in deployment dashboard
- Ensure all environment variables are set