We have seen a huge shift in the way developers and consultants are using Generative AI (GenAI) tools to create working microservices. A new tool named WebGenAI begins the process with a simple prompt to create a complete API microservice with a running React-Admin user interface and has the ability to iterate and add new features or even logic.
WebGenAI is built on top of the existing Python open-source framework ApiLogicServer. The entire project can be downloaded as runnable Python code or a Docker container to use locally. It also pushes each iteration to GitHub and you can run the application using Codespaces. This is usually where the beginning of the full microservice lifecycle starts.
When a new project is started, it usually begins with paper documents that "explore and explain" the scope and direction, use cases, and workflows of the project. WebGenAI takes a prompt/model-driven approach to explore and visualize ideas. The ability to "iterate" over prior prompts to include new functionality helps the stakeholder and SME capture basic functionality. While this generative approach will never be the final release, each iteration will help get the project closer to the vision and capture requirements in real time. WebGenAI, shown below, begins with a simple prompt: "Create a dog-walking business".
The result is a complete running application with React-Admin pages, sample data, and the ability to download the entire source to explore locally or run from GitHub Codespaces.
The WebGenAI tool also has a feature called ConnectDB to prompt for an SQL database (or Excel Workbook), but this is intended to be used in conjunction with the local Docker version or in-house cloud deployment. Not many enterprises will want to put their corporate database credentials into a public website. However, using the local Docker version, WebGenAI can take advantage of an existing database schema to build a complete running application and create an API (based on JSON API) for each selected table. The application that is created will allow the stakeholder to visualize data and navigate between parent/child relationships. While iteration is possible, this would not be the main use case for GenAI.
ApiLogicServer is an open-source project built on Python 3.12 based on SQLALchemy ORM, Flask, and SAFRS/JSON API. Once your virtual environment is ready, a simple installation using will include SQLAlchemy ORM 2.x, Flask, LogicBank, and other libraries to start and run your downloaded project locally. (Note: WebGenAI also has a running Docker version to skip the local installation). In this example, Python and VSCode have already been installed.
WebGenAI will let you see your prompt and project come to life: the actual open-source code can then be downloaded to a local development platform to use with your own IDE (VSCode, PyCharm, IntelliJ, etc). Once you download the project, you can use ApiLogicServer to organize it into folders (Note: An IDE and Python installation and configuration are required to run locally):
Business Logic is a critical component of any microservice. Explore tools like OpenAPI, ChatGPT, and Copilot to see if they can take advantage of LogicBank, an open-source rules engine to generate declarative rules (e.g. , , , , and ). This is very similar to working with a spreadsheet in 3 dimensions (e.g., rows/columns and parent/child tables). Code completion based on the model and Copilot integration makes the developer experience very friendly.
It is amazing to see Copilot in the IDE turn business user statements like these:
Declarative logic sits between the API and SQLAlchemy ORM/SQL database. This allows all API CRUD use cases to be handled consistently and new rules added or changed without having to worry about the order of operations (this is done using a runtime DAG to manage the order of operation) much like a spreadsheet.
ApiLogicServer explains that this is a 40x improvement over writing logic code by hand. Logic is applied to Attributes (derivations) or Entities (events and constraints). If the logic is a bit more complex, a Python function can be called to complete the processing. ALS can make calls to a Kafka producer, external API systems, or use any of Python libraries (e.g. math, Stripe, Email, etc.) in the function.
If the microservice needs to interface with external systems like Kafka, email, payment system, or business process models like GBTec, the rules engine has a series of event types (, , , or ). For example, a event is called after all the logic rules have been fired and the data has been written to the ORM (returning auto-increment keys). This would be the point: to call an external system and pass a pre-configured payload. These events act like webhooks attached to specific API entities to integrate other systems (e.g., notify order shipment, update payment processing, send an email message, start a business process).
This is another one of the key features of ApiLogicServer. Not only will it expose the ORM entities as JSON API endpoints, but the developer can create custom API endpoints to perform specific tasks.
One example of this is the Ontimize Angular User Interface that is created from the generated API. Ontimize would normally send HTTP requests to their own Java/Swing server. By exposing a custom endpoint, ApiLogicServer acts like a bridge for all , , , and and returns a formatted JSON response to Ontimize. So all the Ontimize UI features are now supported without having to rewrite the front-end framework.
Security is easily added using the command line tools. ApiLogicServer offers a local Keycloak Docker container (pre-configured). An alternative is to use the "sql" provider type to run a local SQLite authentication database and model. Other authentication models can be easily added (e.g., LDAP, Active Directory, OKTA, or OAuth).
The KeyCloak configuration settings are stored in the config/config.py file and can be easily changed for test and production deployment.
Security can be enabled at any point in the development process. Once enabled, the developer will need to create roles to be assigned to the various users. Roles declare general CRUD access to API endpoints (, , , and ). A user can have one or more roles, and specific grants can be added to modify role access to an API which includes row-level security and tenancy filters.
The lifecycle of any project involves change. The API design may introduce new tables or columns, the ORM data model can change, the UI components need new lookup relationships or a new special API can be introduced. ApiLogicServer offers several command line tools and options to "rebuild-from-database" or "rebuild-from-model". These commands can rebuild the ORM or the UI components. There are also GenAI commands that can be used to create new applications from prompts.
Using VSCode on a local desktop allows the developer to run the microservice and place breakpoints to explore rules and custom API endpoints. This is a must-have for any developer learning a new system to see and understand what is going on and how to fix issues. A nice feature is the ability to link directly to GitHub for each iteration and run the project using GitHub Codespaces.
This style of test-driven development (TDD) begins with a feature and scenarios that need to be tested. The implementation is a simple Python program that breaks the scenario steps down into simple instructions. While I have not tried to generate these tests with Copilot, this may be a nice future feature request.
All of the components from ApiLogicServer can be checked into GitHub (models, logic, configurations, tests, UI components, etc.) to support multi-developer teams.
The ApiLogicServer directory, , provides a series of directories to build an image, use NGINX, and deploy Docker containers. This takes DevOps a long way down the road to making the project visible on a cloud or on-premise server.
ApiLogicServer provides a react-admin UI (seen in WebGenAI) that allows exploration and navigation of data. There is also an Ontimze Angular application (from Imatia) which provides a more full-featured UX developer experience. Both of these are created from a yaml model file which can be edited and the pages regenerated from the yaml. Ontimize gives the UI/UX team a pre-configured and ready-to-run set of pages for all CRUD operations for every API Endpoint. Ontimize is a mature extensible Angular framework including charts, PDF reports, maps, and editable grids. Ontimize will introduce TypeScript, Node.js, and NPM into the development stack, but the look and feel of an Angular application will move the UX closer to production.
WebGenAI starts the process of prompting, iteration, and generation of an API microservice. Once the base model is ready, the developer team takes over to modify the model, add logic and security, write tests, create a custom UI, and build and deploy Docker containers to the cloud. While this is not exactly low-code, this is a rich platform of integrated services that make the development of a running microservice a new standard combining AI generation with open-source platform tools. You can try a limited web version by providing your GitHub or Google information. Your entire application can be downloaded as a Docker container or a complete source library running the ApiLogicServer framework.