How mintlify/writer works
Project type and purpose
• This is a monorepo containing:
• Two IDE extensions (VSCode in TypeScript, IntelliJ in Kotlin/Java)
• A Node.js/TypeScript backend (the “Writer Server”)
• Purpose: Users highlight code in their editor → invoke “Write Docs” → the extension calls the Writer server → generates docstrings via AI/parsing/formatting → returns and inserts documentation.
File structure
• Top-level directories:
• .github – CI/CD workflows (builds, tests, deploys)
• intellij – IntelliJ plugin project (Gradle, Kotlin/Java sources, UI forms)
• server – Node.js/TypeScript service (routes, services, models, parsing/formatting, workers)
• vscode – VSCode extension (TS code, webpack, tests)
• The server folder contains standard Express-style routes, a Mongoose layer, background workers, and integrations (Stripe, Segment, Translate, OpenAI).
README for additional context
• Mintlify Writer generates documentation automatically, supports multiple languages and doc-formats, never stores user code.
a. Main components
• Client Layer (two IDE plugins):
• VSCode Extension (TypeScript)
• IntelliJ Plugin (Kotlin/Java)
• API Gateway / Load Balancer (optional, if deployed behind one)
• Writer Server (Node.js/TypeScript monolith)
• HTTP API (Express-style routes)
• Business Logic / Controllers
• Parsing Module (per-language parsers)
• Formatting Module (docstring formatters)
• Worker Pool (background Codex/inference jobs)
• Data Layer (Mongoose + MongoDB)
• Third-Party Integrations (OpenAI/Codex, Stripe, Segment, Translate API)
• Persistence Layer
• MongoDB (for settings, quotas, progress tracking)
• External Services
• OpenAI API
• Stripe Billing
• Segment Analytics
• Translate (e.g., Google Translate)
b. Relationships & interactions
• User → Trigger “Write Docs” in the IDE
• IDE Extension → HTTP(S) → Writer Server /writer route
• Writer Server Controllers → invoke Parsing → Formatting → Worker(s) for heavy AI calls
• Worker → OpenAI API → receives generated docs → returns to Controller
• Controller → persists metadata/usage in MongoDB (via Mongoose)
• Controller → returns generated docstring JSON → IDE Extension
• Extension → injects docstring into user’s code editor
• Billing/Usage tracked via Stripe & Segment calls from the service
c. Architectural patterns & design principles
• Clear separation of concerns:
• Presentation (IDE plugins) vs. API layer vs. business logic vs. data persistence
• Modular parsing/formatting pipeline: per-language parsers and formatters live in distinct folders
• Background workers for long-running AI calls (prevents blocking HTTP threads)
• Monorepo structure to lock dependencies and share configuration/linters/CI
d. Key technologies & frameworks
• IDE Plugins: VSCode API, Webpack, Kotlin/Java Swing UI (IntelliJ)
• Server: Node.js, TypeScript, Express‐style routing, Mongoose, Jest tests
• Deployment: Heroku (Procfile, app.json), GitHub Actions
• External APIs: OpenAI/Codex, Stripe, Segment, Google Translate