dmaker
v0.1.0
Published
CLI for managing Fumadocs documentation projects with NestJS OpenAPI integration
Maintainers
Readme
dmaker
A powerful CLI tool for managing Fumadocs documentation projects with NestJS OpenAPI integration.
Features
- 🚀 Quick Setup: Initialize documentation projects with a single command
- 📝 OpenAPI Integration: Generate OpenAPI specs from NestJS applications
- 🔄 Hot Reload: Development server with automatic file watching
- 📦 Static Export: Build optimized static documentation sites
- 🎨 Fumadocs Powered: Beautiful documentation UI out of the box
Installation
npm install -g dmaker
# or
yarn global add dmaker
# or
pnpm add -g dmakerUsage
Initialize a new documentation project
dmaker initThis will create a new documentation project with:
- Basic content structure
- Configuration file
- Example MDX files
Generate OpenAPI specification from NestJS
dmaker openapiGenerate OpenAPI JSON from your NestJS application with enhanced response schemas.
Requirements:
- Configure
nestjssection indmaker.config.json - NestJS application with
@nestjs/swaggersetup
Generate documentation
dmaker generateBuild the documentation site from your content and OpenAPI spec.
Development mode with hot reload
dmaker devStart a development server with automatic file watching and hot reload.
Configuration
Create a dmaker.config.json file in your project root:
{
"name": "my-docs",
"title": "My Documentation",
"description": "API Documentation",
"openapiFile": "./openapi.json",
"contentDir": "./content",
"outDir": "./out",
"nestjs": {
"appDir": "./src",
"rootDir": "./",
"envFile": ".env",
"tsconfigPath": "tsconfig.json",
"apiPrefix": "api",
"apiPrefixExcludeRoutes": ["/health", "/metrics"],
"versioning": {
"enabled": true,
"type": "URI",
"prefix": "v"
},
"dtoFileNameSuffix": [".dto.ts", ".presenter.ts"],
"controllerFileNameSuffix": ".controller.ts"
}
}Commands
dmaker init
Initialize a new documentation project.
Options:
-n, --name <name>- Project name-d, --dir <directory>- Target directory (default: ".")
dmaker openapi
Generate OpenAPI specification from NestJS application.
Options:
-c, --config <path>- Path to config file (default: "dmaker.config.json")--keep-scripts- Keep temporary scripts for debugging
dmaker generate
Generate documentation from your content.
Options:
-c, --config <path>- Path to config file (default: "dmaker.config.json")--clean- Remove temp directory after build
dmaker dev
Start development server with hot reload.
Options:
-c, --config <path>- Path to config file (default: "dmaker.config.json")-p, --port <port>- Port to run the dev server on (default: "3000")
NestJS Integration
dmaker provides seamless integration with NestJS applications:
- Automatic OpenAPI Generation: Extracts metadata from your NestJS controllers
- Enhanced Response Schemas: Adds success response schemas from TypeScript return types
- Versioning Support: Handles API versioning (URI, Header, etc.)
- Global Prefix Handling: Respects your API prefix configuration
- Route Exclusions: Skip routes like health checks from global prefix
Example Workflow
# 1. Initialize project
dmaker init -n my-api-docs
# 2. Configure dmaker.config.json with your NestJS paths
# 3. Generate OpenAPI spec
dmaker openapi
# 4. Start development server
dmaker dev
# 5. Build for production
dmaker generateRequirements
- Node.js >= 18
- For NestJS integration:
@nestjs/swaggerand@nestjs/cliinstalled in your project
License
MIT © Alexandre Retamero
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please file an issue on the GitHub repository.
