Generating APIs and UI Components
Generating APIs and UI Components
Overview
- Once the data models are created, use SolidX's App Builder to auto-generate REST APIs and basic UI components for each model.
- The generated APIs will allow you to perform CRUD operations on your models. You can view the API documentation in the Swagger UI provided by SolidX at
/docse.g http://localhost:3000/docs - The generated UI components provide a basic interface for managing your data. You can access them via the admin panel, where menu items for each model are automatically added under the associated module's menu.
- Ensure that the generated APIs and components meet your requirements and customize them as needed.
Code Generation Steps
- From the sidebar, navigate to App Builder under the Solid Core module.
- Select the Modules sub-menu. This opens the module list page.
- Locate your module in the list, click its context menu (three dots), and select Generate Code.
- Confirm the action in the dialog to start the code generation process.
- Code generation may take a few minutes as each model in your module is processed sequentially.
- This process creates or updates files in the
solid-apifolder and updates the UI metadata in the database. Thesolid-uiproject itself is not modified — UI components are rendered dynamically based on this metadata. - In SolidX dev mode (i.e., using
solidx:dev), code changes are picked up automatically. - Verify the generated REST APIs using Swagger UI at the
/docsendpoint. - Access the generated UI components through the model menu items within your module.
- For example, the Institute model's list view would be available at
/admin/core/fees-portal/institute/list, wherefees-portalis the module name andinstituteis the model name.
- For example, the Institute model's list view would be available at
Generating Code for a Single Model
To generate code for a specific model, navigate to the Model sub-menu instead within the App Builder. Locate the desired model, click its context menu (three dots), and select Generate Code.
Note that any related models (via relations) will also be processed during code generation. This approach might be faster than regenerating the entire module, especially if you have many models in the module and only need to update one or a few of them.