Using llms.txt
Learn how the llms.txt standard helps AI agents discover and understand your documentation structure for better results.
By the end of this guide, you'll understand how the llms.txt standard works and how the SaaS Boilerplate leverages it to make documentation more accessible to AI agents like Lia.
What is llms.txt?
The llms.txt standard is a simple convention that helps Large Language Models (LLMs) and AI agents better understand and navigate documentation websites. It's essentially a plain text file that provides a structured overview of your documentation, making it easier for AI tools to:
- Discover content: Quickly find relevant documentation pages
- Understand structure: See how your docs are organized
- Get context: Access high-level information about your project
- Navigate efficiently: Jump to specific sections without crawling the entire site
This standard was popularized by libraries like Next.js and has become a common practice across the developer ecosystem.
How llms.txt Works
The llms.txt file is typically placed at the root of your website (e.g., yoursite.com/llms.txt) and follows a simple format:
# Project Name
Brief description of what this project does.
## Getting Started
- [Quick Start Guide](link-to-quickstart)
- [Installation](link-to-installation)
- [Configuration](link-to-config)
## Core Concepts
- [Architecture Overview](link-to-architecture)
- [API Reference](link-to-api)
- [Best Practices](link-to-best-practices)
## Advanced Topics
- [Performance Tuning](link-to-performance)
- [Troubleshooting](link-to-troubleshooting)
- [Contributing](link-to-contributing)This structured format allows AI agents to quickly understand your project's scope and find the information they need.
SaaS Boilerplate Implementation
The SaaS Boilerplate comes with llms.txt support built-in, making all your content (documentation, blog posts, help center, and updates) easily accessible to AI agents.
Automatic Content Exposure
Your SaaS Boilerplate automatically exposes content through API routes configured in next.config.ts:
// next.config.ts - Automatic llms.txt routing
async rewrites() {
return [
{
source: '/docs/:path*.mdx',
destination: '/api/content/docs/llms.mdx/:path*',
},
{
source: '/blog/:path*.mdx',
destination: '/api/content/blog/llms.mdx/:path*',
},
{
source: '/help/:path*.mdx',
destination: '/api/content/help/llms.mdx/:path*',
},
{
source: '/updates/:path*.mdx',
destination: '/api/content/updates/llms.mdx/:path*',
},
]
}This means any AI agent can access your content at URLs like:
yoursite.com/docs/getting-started/quickstart/llms.mdxyoursite.com/blog/announcements/llms.mdxyoursite.com/help/faq/llms.mdx
Content API Structure
The content is served through API routes in src/app/(api)/api/content/ that automatically convert your MDX files into LLM-friendly formats. This includes:
- Documentation: All technical docs and guides
- Blog posts: Announcements, tutorials, and updates
- Help center: FAQs, troubleshooting, and support content
- Release notes: Version updates and changelogs
Lia and llms.txt
While Lia comes pre-trained with deep knowledge of the SaaS Boilerplate and Igniter.js ecosystem, she can optionally leverage llms.txt files for additional context:
Built-in Training vs. Dynamic Context
- Built-in Training: Lia has specialized knowledge of Igniter.js patterns, multi-tenancy, and SaaS Boilerplate architecture
- Dynamic Context: She can use
llms.txtto access the latest documentation, blog posts, and project updates - Hybrid Approach: Best results come from combining Lia's training with fresh content via
llms.txt
Practical Usage
When working with Lia, you can reference llms.txt content for:
- Latest API changes or deprecations
- New feature announcements
- Updated best practices
- Recent troubleshooting guides
Popular llms.txt Resources
Many popular libraries and frameworks provide llms.txt files for their documentation. Here's a curated list of useful resources:
| Library/Framework | llms.txt URL | Description |
|---|---|---|
| Next.js | nextjs.org/docs/llms.txt | React framework documentation |
| Better Auth | better-auth.com/docs/llms.txt | Authentication library docs |
| Zod | zod.dev/llms.txt | TypeScript schema validation |
| Prisma | prisma.io/docs/llms.txt | Database ORM documentation |
| Fumadocs | fumadocs.dev/llms.txt | Documentation framework |
| SaaS Boilerplate | demo.saas-boilerplate.com/llms.txt | Live demo of this implementation |
Implementing llms.txt in Your Project
If you're extending the SaaS Boilerplate or building your own implementation:
Basic Setup
- Create the file: Add
public/llms.txtto your project - Structure content: Organize with clear sections and links
- Keep updated: Regularly refresh with new content
- Test access: Ensure the file is publicly accessible