The /mintlify-docs command generates comprehensive, production-ready documentation using Mintlify with AI-powered content creation, API reference automation, and interactive MDX components.
Usage
/mintlify-docs [options] <documentation_scope>
Options
Documentation Types
--quickstart - Generate quickstart guide
--api-reference - Generate API reference from code
--tutorial - Generate step-by-step tutorial
--guide - Generate conceptual guide
--changelog - Generate changelog from git history
Source Analysis
--from-code=<path> - Generate docs from source code
--from-openapi=<path> - Generate API docs from OpenAPI spec
--from-types=<path> - Generate docs from TypeScript types
--from-jsdoc - Extract JSDoc comments
Output Format
--mdx - Generate MDX with components (default)
--markdown - Generate plain Markdown
--with-examples - Include code examples
--with-snippets - Include interactive snippets
Features
--search - Configure search integration
--navigation - Generate navigation structure
--analytics - Add analytics tracking
--versioning - Enable version management
Examples
API Reference from TypeScript
Command:
/mintlify-docs --api-reference --from-types=src/api/users.ts --with-examples
Input Code:
// src/api/users.ts
/**
* User management API client
* @module UserAPI
*/
export interface User {
/** Unique user identifier */
id: string;
/** User's email address */
email: string;
/** Display name */
name: string;
/** User role */
role: "admin" | "user" | "guest";
/** Account creation timestamp */
createdAt: Date;
}
export interface CreateUserInput {
email: string;
name: string;
password: string;
}
/**
* Retrieves a user by ID
* @param userId - The user's unique identifier
* @returns Promise resolving to the user object
* @throws {NotFoundError} If user doesn't exist
* @throws {AuthorizationError} If caller lacks permission
* @example
* ```typescript
* const user = await getUser('user_123');
* console.log(user.name);
* ```
*/
export async function getUser(userId: string): Promise<User> {
const response = await fetch(`/api/users/${userId}`);
if (!response.ok) throw new Error("Failed to fetch user");
return response.json();
}
/**
* Creates a new user
* @param input - User creation data
* @returns Promise resolving to the created user
* @throws {ValidationError} If input is invalid
* @throws {ConflictError} If email already exists
* @example
* ```typescript
* const newUser = await createUser({
* email: 'user@example.com',
* name: 'John Doe',
* password: 'secure-password'
* });
* ```
*/
export async function createUser(input: CreateUserInput): Promise<User> {
const response = await fetch("/api/users", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(input),
});
if (!response.ok) throw new Error("Failed to create user");
return response.json();
}
Generated Documentation:
---
title: "User API"
description: "Manage user accounts and profiles"
icon: "users"
---
# User Management API
The User API provides endpoints for managing user accounts, authentication, and profiles.
## User Object
The User object represents a user account in your application.
<ResponseField name="id" type="string" required>
Unique user identifier
</ResponseField>
<ResponseField name="email" type="string" required>
User's email address
</ResponseField>
<ResponseField name="name" type="string" required>
Display name
</ResponseField>
<ResponseField name="role" type="'admin' | 'user' | 'guest'" required>
User role determining access permissions
</ResponseField>
<ResponseField name="createdAt" type="Date" required>
Account creation timestamp
</ResponseField>
<CodeGroup>
```typescript User Object
interface User {
id: string;
email: string;
name: string;
role: "admin" | "user" | "guest";
createdAt: Date;
}
```
{
"id": "user_123",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2025-10-16T12:00:00Z"
}
Get User
GET
/api/users/:userId
Retrieves a user by their unique identifier.
Path Parameters
The user's unique identifier
Response
The requested user object
Error Codes
User with the specified ID doesn't exist
Caller lacks permission to access this user
import { getUser } from "@/api/users";
const user = await getUser("user_123");
console.log(user.name); // "John Doe"
const response = await fetch("/api/users/user_123");
const user = await response.json();
import requests
response = requests.get('https://api.example.com/users/user_123')
user = response.json()
curl https://api.example.com/users/user_123 \
-H "Authorization: Bearer YOUR_TOKEN"
{
"id": "user_123",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2025-10-16T12:00:00Z"
}
{
"error": "User not found",
"code": "USER_NOT_FOUND"
}
{
"error": "Insufficient permissions",
"code": "FORBIDDEN"
}
Create User
POST
/api/users
Creates a new user account.
Request Body
User's email address (must be unique)
Display name
Account password (min 8 characters)
Response
The created user object
Error Codes
Input validation failed
Email address already exists
import { createUser } from "@/api/users";
const newUser = await createUser({
email: "user@example.com",
name: "John Doe",
password: "secure-password",
});
const response = await fetch("/api/users", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "user@example.com",
name: "John Doe",
password: "secure-password",
}),
});
const user = await response.json();
Passwords are automatically hashed using Argon2 before storage. Never log or
expose raw passwords.
```
Quickstart Guide Generation
Command:
/mintlify-docs --quickstart --from-code=src/ "Getting started with our authentication system"
Generated Documentation:
---
title: "Quickstart"
description: "Get started with authentication in 5 minutes"
icon: "rocket"
---
# Getting Started
This guide will help you integrate authentication into your application in under 5 minutes.
<Steps>
<Step title="Install the SDK">
Install the authentication package using your preferred package manager:
<CodeGroup>
```bash npm
npm install @yourapp/auth
```
pnpm add @yourapp/auth
yarn add @yourapp/auth
Add your API credentials to your `.env` file:
AUTH_SECRET=your-secret-key
AUTH_URL=https://api.yourapp.com
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
Never commit your `.env` file to version control. Add it to `.gitignore`.
Create an authentication client instance:
import { createAuthClient } from "@yourapp/auth";
export const auth = createAuthClient({
secret: process.env.AUTH_SECRET!,
baseUrl: process.env.AUTH_URL!,
providers: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
});
Wrap your application with the authentication provider:
import { AuthProvider } from '@yourapp/auth/react';
import { auth } from '@/lib/auth';
export default function RootLayout({ children }) {
return (
<html>
<body>
<AuthProvider client={auth}>
{children}
</AuthProvider>
</body>
</html>
);
}
Access authentication state in your components:
'use client';
import { useAuth } from '@yourapp/auth/react';
export function UserProfile() {
const { user, signIn, signOut } = useAuth();
if (!user) {
return (
<button onClick={() => signIn('github')}>
Sign in with GitHub
</button>
);
}
return (
<div>
<p>Welcome, {user.name}!</p>
<button onClick={signOut}>Sign out</button>
</div>
);
}
Next Steps
Explore the complete API documentation
Learn about advanced authentication patterns
Implement security best practices
View example implementations
```
OpenAPI to Documentation
Command:
/mintlify-docs --api-reference --from-openapi=openapi.yaml
Generated mint.json Configuration:
{
"$schema": "https://mintlify.com/schema.json",
"name": "Your API Documentation",
"logo": {
"dark": "/logo/dark.svg",
"light": "/logo/light.svg"
},
"favicon": "/favicon.svg",
"colors": {
"primary": "#0D9373",
"light": "#07C983",
"dark": "#0D9373",
"anchors": {
"from": "#0D9373",
"to": "#07C983"
}
},
"topbarLinks": [
{
"name": "Support",
"url": "mailto:support@example.com"
}
],
"topbarCtaButton": {
"name": "Dashboard",
"url": "https://dashboard.example.com"
},
"tabs": [
{
"name": "API Reference",
"url": "api-reference"
},
{
"name": "Guides",
"url": "guides"
}
],
"anchors": [
{
"name": "Documentation",
"icon": "book-open-cover",
"url": "https://docs.example.com"
},
{
"name": "Community",
"icon": "discord",
"url": "https://discord.gg/example"
},
{
"name": "GitHub",
"icon": "github",
"url": "https://github.com/example/repo"
}
],
"navigation": [
{
"group": "Get Started",
"pages": ["introduction", "quickstart", "development"]
},
{
"group": "API Reference",
"pages": [
"api-reference/authentication",
"api-reference/users",
"api-reference/organizations"
]
}
],
"footerSocials": {
"twitter": "https://twitter.com/example",
"github": "https://github.com/example",
"linkedin": "https://www.linkedin.com/company/example"
},
"analytics": {
"posthog": {
"apiKey": "phc_xxx"
}
},
"api": {
"baseUrl": "https://api.example.com",
"auth": {
"method": "bearer"
}
}
}
Interactive Components
Custom MDX Components
<Accordion title="How does authentication work?">
Our authentication system uses JWT tokens with automatic refresh. Sessions
last 7 days by default.
</Accordion>
<Info>
All API requests must include a valid Bearer token in the Authorization
header.
</Info>
<Warning>Never expose your API secret key in client-side code.</Warning>
<Tip>
Use environment variables to manage different API keys for development and
production.
</Tip>
<Check>Your API credentials are correctly configured!</Check>
Best Practices
- Clear Structure: Organize documentation with logical navigation
- Code Examples: Include examples in multiple languages
- Error Documentation: Document all possible error codes and responses
- Interactive Elements: Use Mintlify components for better UX
- Version Management: Maintain docs for multiple API versions
- Search Optimization: Use descriptive titles and descriptions
- Regular Updates: Keep documentation in sync with code changes