QuickShip Model Generator
QuickShip Model Generator is a Visual Studio Code extension designed to streamline the creation of Mongoose models and their associated APIs. Built for back-end developers working with Node.js, Mongoose, and Next.js, this extension automatically generates model files and API routes, making it easy to build RESTful architectures quickly and efficiently.
Features
- Automatic Model Generation: Create a Mongoose model with custom fields and parameters.
- Customizable CRUD Permissions: Configure permissions and protection for
create , read , update , and delete routes.
- REST API Creation: Automatically generate API endpoints for each model based on configured CRUD permissions.
- Navigation and Icons: Customize the display name and icon for each model in your back-office navigation.
Installation
- Open Visual Studio Code.
- Go to the Extensions pane (
Ctrl+Shift+X ).
- Search for "QuickShip Model Generator" and click Install.
Prerequisites
- Node.js installed on your system.
- Mongoose and Next.js set up in your project.
- VSCE (Visual Studio Code Extension Manager) for extension publishing.
Usage
- Run the Command: Use
Ctrl+Shift+P to open the command palette, then run QuickShip Model Generator: Start .
- Define the Model:
- Enter the model name.
- Add fields with their types (
text , email , richtext , etc.), options (fullWidth, mainCharacteristic), and default values.
- Configure CRUD Permissions: Select available CRUD actions (create, read, update, delete) and specify if they are protected.
- Generate APIs: API files are automatically created under
/pages/api/[model_name] .
- Update the Index: The model and CRUD configurations are automatically added to
/models/index.ts .
Example
- Run the
QuickShip Model Generator: Start command.
- Enter
User as the model name.
- Add fields like
username (text, required) and email (email, required).
- Configure CRUD permissions to allow
create and read .
- Your
User model and corresponding API files are automatically generated in your project.
Configuration
The extension uses the following default settings, adjustable during generation:
- Supported Field Types:
text , email , richtext , select , chip , date , singleFile , multipleFile , password .
- CRUD Options:
create , read , update , delete , each configurable as protected or public.
- Navigation Options: Customize display name and icon for each model.
Contributing
Contributions are welcome! If you have suggestions, identify bugs, or want to add new features, please open an issue on GitHub.
License
MIT © 2024 - QuickShip [Victor BAUCOR EI]
| |