Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>X-API-GENNew to Visual Studio Code? Get it now.
X-API-GEN

X-API-GEN

Sai Pavan Velidandla

|
275 installs
| (0) | Free
X-API-GEN is a powerful VS Code extension that simplifies backend development by automatically generating REST APIs using Express.js and MongoDB directly from JSON schemas. This tool streamlines API setup by creating Mongoose models and Express routes, complete with CRUD operations and advanced quer
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

X-API-GEN

X-API-GEN is a powerful Visual Studio Code extension that automates the generation of REST APIs using Express.js and MongoDB directly from JSON schemas. Save time and focus on building features while X-API-GEN handles the repetitive tasks of setting up backend APIs.

Features

  • Automatic Model Creation: Generates Mongoose models from JSON schema files, making database setup effortless.
  • Full CRUD API Routes: Automatically sets up Express routes for creating, reading, updating, and deleting records.
  • Advanced Query Options: Includes built-in support for search, sorting, filtering, and pagination, making your APIs more versatile and efficient.
  • Streamlined Workflow: Generates code files in one click, reducing setup time and minimizing repetitive coding.

How to Use

  1. Install the Extension:

    • Search for X-API-GEN in the Visual Studio Code marketplace and install the extension.
  2. Generate API from JSON Schema:

    • Open the command palette (Ctrl+Shift+P or Cmd+Shift+P on macOS).
    • Type Generate REST API from JSON Schema and select the command.
    • Choose your JSON schema file when prompted.
  3. Generated Files:

    • The extension will generate two files based on your schema:
      • Schema.js: Contains the Mongoose model definition based on your JSON schema.
      • Schema_API.js: Contains the Express routes for the schema with full CRUD operations and query options.
  4. Edit and Customize:

    • Modify the generated files if needed to fit your specific application requirements. The code is well-structured for easy customization.

Example JSON Schema

Here is a sample JSON schema you can use:

{
    "title": "User",
    "type": "object",
    "properties": {
        "name": { "type": "string", "minLength": 2, "maxLength": 50 },
        "email": { "type": "string", "format": "email" },
        "password": { "type": "string", "minLength": 8 },
        "age": { "type": "integer", "minimum": 18, "maximum": 100 },
        "roles": {
            "type": "array",
            "items": { "type": "string", "enum": ["user", "admin", "moderator"] }
        },
        "createdAt": { "type": "string", "format": "date-time" }
    },
    "required": ["name", "email", "password"]
}

Requirements

  • Node.js installed on your system.
  • MongoDB for database integration when running your APIs locally.

Extension Settings

This extension does not have any user-configurable settings yet.

Known Issues

  • None at the moment. Please report any issues via the GitHub Issues page.

Release Notes

0.0.1

  • Initial release with support for generating CRUD operations, Mongoose models, and advanced query capabilities (search, sort, filter, pagination) from JSON schemas.

Support

If you encounter any issues or have feature suggestions, feel free to submit them on our GitHub repository.


Enjoy building APIs faster with X-API-GEN!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft