Getting Started
Get Docit running in your Rails app in under a minute.
Requirements
- Ruby ≥ 3.2
- Rails ≥ 7.0
Installation
Add Docit to your Gemfile:
gem "docit" Then run:
bundle install
rails generate docit:install What the installer does
The install generator handles everything in one step:
- Creates
config/initializers/docit.rbwith default settings - Mounts the documentation engine at
/api-docsin your routes - Asks how you'd like to set up your docs:
- AI automatic docs — configure an AI provider, then Docit scans your routes and generates complete documentation for every endpoint
- Manual docs — creates scaffolded doc files with TODO placeholders and injects
use_docsinto controllers - Skip — just install the base config and set up docs later
View your docs
Start your Rails server and visit:
http://localhost:3000/api-docs
You'll see the Scalar API Reference by default. Swagger UI is also available at /api-docs/swagger.
AI setup
If you chose AI setup during install, Docit stores your provider config in .docit_ai.yml
with restricted file permissions and adds that file to .gitignore when possible.
Next steps
- Configure your API metadata, auth schemes, and tags
- Write your first endpoint docs with inline DSL or separate doc files
- Or let AI generate docs for all your endpoints