DocWright
Auto-generate and maintain documentation for your Rails application.
DocWright introspects your live Rails app to generate structured markdown documentation for your database schema, API routes, models, services, background jobs, and more. Human-written content is preserved across regenerations using smart merge markers.
Installation
Add to your application's Gemfile:
gem "docwright"
Then run:
bundle install
bundle exec rake docwright:generate
Usage
Generate documentation
rake docwright:generate
Runs the interactive wizard which:
- Scans your app and shows what will be generated
- Asks y/n to continue
- Generates auto files (database, API, models)
- Walks you through each new manual file with write/editor/skip options
Check documentation completeness
rake docwright:check
Audits your docs and reports:
- Missing required files
- Files with placeholder content only
- Empty notes slots
Search documentation
rake docwright:search[your_term]
Searches across all generated markdown files.
Generated files
Auto-generated (always regenerated)
docs/database.md— tables, columns, typesdocs/api.md— routes and endpointsdocs/models.md— associations and validations per model
Manual templates (written once, never overwritten)
docs/overview.mddocs/setup.mddocs/architecture.mddocs/deployment.mddocs/security.mddocs/troubleshooting.mddocs/business_rules.mddocs/changelog.mddocs/readme.md
Optional docs (declared in .docwright.yml)
docs/auth_and_permissions.mddocs/background_jobs.mddocs/services.mddocs/concerns.mddocs/features/*.md
Configuration
Create .docwright.yml in your Rails app root:
# Optional narrative docs
optional_docs:
auth_and_permissions: true
background_jobs: true
services: true
concerns: true
# Feature-specific docs
features:
- name: qr_flow
description: QR code generation and scanning flow
- name: subscriptions
description: Billing and plan management
How merge markers work
Auto-generated content is wrapped in markers:
auto content here — regenerated every time
Write your notes outside these markers — DocWright will never touch them.
For per-model files, named markers are used:
auto content for Post
Notes for Post
your notes here — never overwritten
Development
git clone https://github.com/GraceHtet/docwright.git
cd docwright
bundle install
bundle exec rspec
Contributing
Bug reports and pull requests are welcome on GitHub.
License
MIT License. See LICENSE.txt.