A command-line tool for generating API resources for Nuxt 3 CRUD applications.
Warning
This package is not tested and highly experimental.
npm install -g nuxt-crud-cli
Or use it directly with npx:
npx nuxt-crud-cli generate
The CLI tool provides an interactive interface to generate API resources for your Nuxt 3 application.
# Generate a resource
nuxt-crud generate
# Show help
nuxt-crud --help
This tool can generate the following components for your API:
- Controllers: Handle business logic for your resources
- Requests: Validate incoming request data using Zod schemas
- Resources: Transform data for API responses
Generate a complete product
resource:
nuxt-crud generate
Then follow the interactive prompts to:
- Enter a resource name (e.g., "product")
- Choose what to generate (e.g., "All")
- Select which requests to generate
- Enter the API version (default: "v1")
- Choose whether to create route files
The generated resources follow this structure:
server/
api/
v1/
products/
ProductController.ts
[id].ts
index.ts
handlers/
create.ts
delete.ts
getAll.ts
getOne.ts
update.ts
requests/
DeleteProductRequest.ts
GetAllProductsRequest.ts
GetOneProductRequest.ts
StoreProductRequest.ts
UpdateProductRequest.ts
resources/
productCollection.ts
productResource.ts
types.ts
MIT