ApiLogicServer 15.0.54__py3-none-any.whl → 15.0.55__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- api_logic_server_cli/api_logic_server.py +6 -5
- api_logic_server_cli/api_logic_server_info.yaml +2 -2
- api_logic_server_cli/create_from_model/api_logic_server_utils.py +4 -1
- api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md +13 -21
- api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py +3 -3
- api_logic_server_cli/prototypes/base/readme.md +11 -13
- api_logic_server_cli/prototypes/base/security/readme_security.md +0 -1
- api_logic_server_cli/prototypes/basic_demo/README.md +267 -272
- api_logic_server_cli/prototypes/basic_demo/docs/system-creation-vibe.md +10 -13
- {apilogicserver-15.0.54.dist-info → apilogicserver-15.0.55.dist-info}/METADATA +1 -1
- {apilogicserver-15.0.54.dist-info → apilogicserver-15.0.55.dist-info}/RECORD +15 -15
- {apilogicserver-15.0.54.dist-info → apilogicserver-15.0.55.dist-info}/WHEEL +0 -0
- {apilogicserver-15.0.54.dist-info → apilogicserver-15.0.55.dist-info}/entry_points.txt +0 -0
- {apilogicserver-15.0.54.dist-info → apilogicserver-15.0.55.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-15.0.54.dist-info → apilogicserver-15.0.55.dist-info}/top_level.txt +0 -0
|
@@ -12,10 +12,10 @@ ApiLogicServer CLI: given a database url, create [and run] customizable ApiLogic
|
|
|
12
12
|
Called from api_logic_server_cli.py, by instantiating the ProjectRun object.
|
|
13
13
|
'''
|
|
14
14
|
|
|
15
|
-
__version__ = "15.00.
|
|
15
|
+
__version__ = "15.00.55" # last public release: 15.00.52 (15.00.12)
|
|
16
16
|
recent_changes = \
|
|
17
17
|
f'\n\nRecent Changes:\n' +\
|
|
18
|
-
"\t07/23/2024 - 15.00.
|
|
18
|
+
"\t07/23/2024 - 15.00.55: system vibe support - initial testing \n"\
|
|
19
19
|
"\t07/20/2024 - 15.00.52: Python 3.13 compatibility fixes - psycopg2→psycopg3, SQLAlchemy 2.0+, pkg_resources→importlib.metadata. mgr dbs \n"\
|
|
20
20
|
"\t07/17/2024 - 15.00.49: venv fix+, ext bldr * fix, copilot vibe tweaks - creation, mcp logic, basic_demo autonums \n"\
|
|
21
21
|
"\t07/10/2024 - 15.00.41: copilot vibe support for logic, UI, MCP, bug[98] \n"\
|
|
@@ -385,13 +385,14 @@ def create_project_and_overlay_prototypes(project: 'ProjectRun', msg: str) -> st
|
|
|
385
385
|
joinpath('prototypes/BudgetApp')
|
|
386
386
|
recursive_overwrite(nw_dir, project.project_directory)
|
|
387
387
|
|
|
388
|
-
if project.db_url
|
|
388
|
+
if 'basic_demo' in project.db_url:
|
|
389
389
|
log.debug(".. ..Copy in basic_demo customizations: readme, logic, tests")
|
|
390
390
|
nw_dir = (Path(api_logic_server_dir_str)).\
|
|
391
391
|
joinpath('prototypes/basic_demo')
|
|
392
392
|
recursive_overwrite(nw_dir, project.project_directory)
|
|
393
|
-
|
|
394
|
-
create_utils.copy_md(project = project, from_doc_file = "Sample-Basic-Demo
|
|
393
|
+
os.rename(project.project_directory_path / 'readme.md', project.project_directory_path / 'readme_standard.md')
|
|
394
|
+
create_utils.copy_md(project = project, from_doc_file = "Sample-Basic-Demo.md", to_project_file = "readme.md")
|
|
395
|
+
create_utils.copy_md(project = project, from_doc_file = "Sample-Basic-Demo-Vibe.md", to_project_file="readme_vibe.md")
|
|
395
396
|
|
|
396
397
|
|
|
397
398
|
if project.db_url == "mysql+pymysql://root:p@localhost:3306/classicmodels":
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
last_created_date: July 23, 2025
|
|
1
|
+
last_created_date: July 23, 2025 21:48:33
|
|
2
2
|
last_created_project_name: ../../../servers/basic_demo
|
|
3
|
-
last_created_version: 15.00.
|
|
3
|
+
last_created_version: 15.00.54
|
|
@@ -146,6 +146,7 @@ def copy_md(project, from_doc_file: str, to_project_file: str = "README.md"):
|
|
|
146
146
|
readme_lines_mkdocs = readme_file.readlines()
|
|
147
147
|
readme_lines_md = []
|
|
148
148
|
in_mkdocs_block = False
|
|
149
|
+
do_process_code_block_titles = False
|
|
149
150
|
db_line_num = 0
|
|
150
151
|
for each_line in readme_lines_mkdocs:
|
|
151
152
|
db_line_num += 1
|
|
@@ -197,7 +198,9 @@ def copy_md(project, from_doc_file: str, to_project_file: str = "README.md"):
|
|
|
197
198
|
else:
|
|
198
199
|
each_line = each_line.replace('.md', '') # hmm... todo: find out why this exists
|
|
199
200
|
pass
|
|
200
|
-
if
|
|
201
|
+
if 'process_code_block_titles' in each_line: # update front matter to get this
|
|
202
|
+
do_process_code_block_titles = True
|
|
203
|
+
if do_process_code_block_titles and 'title=' in each_line:
|
|
201
204
|
# extract the quoted text after 'title=' into title
|
|
202
205
|
match = re.search(r'title\s*=\s*["\']([^"\']+)["\']', each_line)
|
|
203
206
|
if match:
|
|
@@ -82,25 +82,12 @@ but you can also offer to suggest rules.
|
|
|
82
82
|
|
|
83
83
|
### Adding MCP
|
|
84
84
|
|
|
85
|
-
The API is automatically MCP-enabled.
|
|
86
|
-
|
|
87
|
-
> **Important**: For project `basic_demo` (only), add customizations first, then MCP Client, then fix logic:
|
|
85
|
+
The API is automatically MCP-enabled. This adds the MCP Client:
|
|
88
86
|
|
|
89
87
|
```bash
|
|
90
|
-
# 1. Add customization framework (required first, *only* for project `basic_demo`
|
|
91
|
-
# This creates the SysEmail table, and the logic for opt-out.
|
|
92
|
-
genai-logic add-cust
|
|
93
|
-
|
|
94
|
-
# 2. Then add MCP Client (requires OpenAI key)
|
|
95
88
|
genai-logic genai-add-mcp-client
|
|
96
|
-
|
|
97
|
-
# 3. Rename the logic file `logic/logic_discovery/use_case.py` to `logic/logic_discovery/use_case.py.duplicate` (it is duplicated by using `genai-logic add-cust`)
|
|
98
|
-
rm
|
|
99
89
|
```
|
|
100
90
|
|
|
101
|
-
|
|
102
|
-
**Note**: If you already ran `genai-add-mcp-client`, you should run `add-cust` afterwards to ensure the customization framework is properly set up.
|
|
103
|
-
|
|
104
91
|
### Configuring Admin UI
|
|
105
92
|
|
|
106
93
|
This is built when project is created - no need to add it.
|
|
@@ -171,11 +158,16 @@ def my_endpoint():
|
|
|
171
158
|
|
|
172
159
|
### Customize Models - Add Tables, Attributes
|
|
173
160
|
|
|
174
|
-
|
|
161
|
+
To add tables / columns to the database (highly impactful - request permission):
|
|
175
162
|
|
|
176
|
-
|
|
163
|
+
1. Update `database/model.py`
|
|
164
|
+
2. Use `database/alembic/alembic_run.py` to update the database. This will generate a migration script and apply it to the database, so you do not have to run `alembic revision --autogenerate` manually.
|
|
165
|
+
3. Offer to update ui/admin/admin.yaml to add the new table or column to the Admin UI.
|
|
166
|
+
|
|
167
|
+
NEVER start by updating the database directly, since some platforms may not have database CLI tools, although you can present this as an option.
|
|
168
|
+
|
|
169
|
+
If altering `database/models.py`, be sure to follow the patterns shown in the existing models. Note they do not contain a `__bind_key__`.
|
|
177
170
|
|
|
178
|
-
```python
|
|
179
171
|
|
|
180
172
|
### Addressing `Missing Attributes` during logic loading at project startup
|
|
181
173
|
|
|
@@ -220,10 +212,10 @@ models.Employee.ProperSalary = __proper_salary__
|
|
|
220
212
|
|
|
221
213
|
When customizing SQLAlchemy models:
|
|
222
214
|
|
|
223
|
-
Don't use direct comparisons with database fields in computed properties
|
|
224
|
-
Convert to Python values first using float(), int(), str()
|
|
225
|
-
Use property() function instead of @jsonapi_attr for computed properties
|
|
226
|
-
Always add error handling for type conversions
|
|
215
|
+
* Don't use direct comparisons with database fields in computed properties
|
|
216
|
+
* Convert to Python values first using float(), int(), str()
|
|
217
|
+
* Use property() function instead of @jsonapi_attr for computed properties
|
|
218
|
+
* Always add error handling for type conversions
|
|
227
219
|
|
|
228
220
|
### Adding events
|
|
229
221
|
LogicBank rules are the preferred approach to logic, but you will sometimes need to add events. This is done in `logic/declare_logic.py` (important: the function MUST come first):
|
|
@@ -21,7 +21,7 @@ See: https://apilogicserver.github.io/Docs/Integration-MCP/
|
|
|
21
21
|
################
|
|
22
22
|
|
|
23
23
|
create_tool_context_from_llm = False
|
|
24
|
-
''' set to False to bypass LLM call and
|
|
24
|
+
''' set to False to bypass LLM call and OpenAI API Key requirement. '''
|
|
25
25
|
|
|
26
26
|
import os, logging, logging.config, sys
|
|
27
27
|
from pathlib import Path
|
|
@@ -144,10 +144,10 @@ def query_llm_with_nl(learnings_and_schema: str, nl_query: str):
|
|
|
144
144
|
temperature=0.2
|
|
145
145
|
)
|
|
146
146
|
tool_context_str = response.choices[0].message.content
|
|
147
|
-
else:
|
|
147
|
+
else: # this is so folks can try mcp without an OpenAI API key
|
|
148
148
|
# read integration/mcp/mcp_tool_context.json
|
|
149
149
|
tool_context_file_path = os.path.join(os.path.dirname(__file__), "../../integration/mcp/examples/mcp_tool_context_response_get.json")
|
|
150
|
-
if '
|
|
150
|
+
if 'email' in nl_query:
|
|
151
151
|
tool_context_file_path = os.path.join(os.path.dirname(__file__), "../../integration/mcp/examples/mcp_tool_context_response.json")
|
|
152
152
|
try:
|
|
153
153
|
with open(tool_context_file_path, "r") as tool_context_file:
|
|
@@ -7,37 +7,35 @@
|
|
|
7
7
|
- ✅ **JSON:API Endpoints** - REST API for all database tables at `/api/*`
|
|
8
8
|
- ✅ **Swagger Documentation** - Interactive API docs at `/api`
|
|
9
9
|
- ✅ **Business Logic Engine** - Declarative rules in `logic/declare_logic.py`
|
|
10
|
-
- ✅ **Security Framework** - Authentication/authorization in `security
|
|
11
|
-
```
|
|
12
|
-
als add-auth --provider-type=sql --db-url=
|
|
13
|
-
als add-auth --provider-type=sql --db_url=postgresql://postgres:p@localhost/authdb
|
|
14
|
-
|
|
15
|
-
als add-auth --provider-type=keycloak --db-url=localhost
|
|
16
|
-
als add-auth --provider-type=keycloak --db-url=hardened
|
|
17
|
-
|
|
18
|
-
als add-auth --provider-type=None # to disable
|
|
19
|
-
```
|
|
10
|
+
- ✅ **Security Framework** - Authentication/authorization in `security/`
|
|
20
11
|
- ✅ **Database Models** - SQLAlchemy ORM in `database/models.py`
|
|
21
12
|
|
|
13
|
+
See readme files under api, logic and security.
|
|
14
|
+
|
|
22
15
|
**🚀 Ready to Run:** This is a complete, working system. Just press F5 or run `python api_logic_server_run.py`
|
|
23
16
|
|
|
17
|
+
<br>
|
|
18
|
+
|
|
24
19
|
---
|
|
25
20
|
|
|
26
21
|
# 🚀 Quick Start
|
|
27
22
|
|
|
28
|
-
> 🤖 **For GitHub Copilot Users:** See `.github/.copilot-instructions.md` for AI assistant guidance on getting started with this project.
|
|
29
|
-
|
|
30
23
|
**Bootstrap Copilot by pasting the following into the chat:**
|
|
31
24
|
```
|
|
32
25
|
Please find and read `.github/.copilot-instructions.md`.
|
|
33
26
|
```
|
|
34
27
|
|
|
28
|
+
<br>
|
|
29
|
+
|
|
35
30
|
**Microservice Automation Complete -- run to verify:** for **VSCode** projects except those downloaded from Web/GenAI:
|
|
36
31
|
1. `Press F5 to Run` (your venv is defaulted)
|
|
37
32
|
|
|
38
33
|
    For **other IDEs,** please follow the [Setup and Run](#1-setup-and-run) procedure, below.
|
|
39
34
|
|
|
40
|
-
>
|
|
35
|
+
<br>
|
|
36
|
+
|
|
37
|
+
> 💡 **Tip:** Create the sample app for customization examples:
|
|
38
|
+
> `ApiLogicServer create --project-name=nw_sample --db_url=nw+`
|
|
41
39
|
|
|
42
40
|
|
|
43
41
|
|
|
@@ -1,497 +1,492 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Instant Microservices - with Logic and Security
|
|
3
3
|
notes: gold is proto (-- doc); alert for apostrophe
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.23 from docsite, for readme 7/11/2025
|
|
5
5
|
---
|
|
6
|
+
<style>
|
|
7
|
+
-typeset h1,
|
|
8
|
+
-content__button {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
# Product Tour (Start Here)
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
2. **Logic and Security:** multi-table constraints and derivations, role-based security, and application integration
|
|
11
|
-
3. **An Admin App:** a multi-page, multi-table web app
|
|
12
|
-
4. **Customizable:** use your IDE to customize with declarative rules and standard Python
|
|
15
|
+
This illustrates basic [GenAI-Logic](https://www.genai-logic.com/product/key-features) operation:
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
1. Creating projects from new or existing databases, providing a MCP-enabled API and an Admin App
|
|
18
|
+
2. Adding declarative logic and security, and
|
|
19
|
+
3. Customizing your project using your IDE and Python<br><br>
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
> 🤖 **Bootstrap Copilot by pasting the following into the chat:**
|
|
22
|
+
```
|
|
23
|
+
Please find and read `.github/.copilot-instructions.md`.
|
|
24
|
+
```
|
|
17
25
|
|
|
18
|
-
|
|
26
|
+
<br>
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
The entire process takes 20 minutes; usage notes:
|
|
21
29
|
|
|
22
|
-
*
|
|
30
|
+
* Important: look for **readme files** in created projects
|
|
31
|
+
* You may find it more convenient to view this [in your Browser](https://apilogicserver.github.io/Docs/Sample-Basic-Tour)
|
|
32
|
+
* A slide show summary is available [on our Web Site](https://www.genai-logic.com/product/tour)
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+

|
|
25
35
|
|
|
26
|
-
* Self-demo with video - you can also use [this video](https://www.youtube.com/watch?v=sD6RFp8S6Fg) (it's the same system, but the database is created with ChatGPT).
|
|
27
36
|
|
|
28
37
|
|
|
29
38
|
|
|
30
|
-
## 1.
|
|
39
|
+
## 1. Create and Run
|
|
31
40
|
|
|
32
|
-
API Logic Server can create projects from existing databases, or use GenAI to create projects with new databases.
|
|
41
|
+
API Logic Server can create projects from existing databases, or use GenAI to create projects with new databases. Let's see how.
|
|
33
42
|
|
|
34
43
|
|
|
35
|
-
###
|
|
44
|
+
### From Existing Database
|
|
36
45
|
|
|
37
|
-
This
|
|
46
|
+
This is the best way to start:
|
|
38
47
|
|
|
48
|
+
1. Open a terminal window: **Terminal > New Terminal**
|
|
49
|
+
2. **Create Project from Existing Database:**
|
|
39
50
|
```bash
|
|
40
|
-
|
|
51
|
+
genai-logic create --project_name=basic_demo --db_url=sqlite:///samples/dbs/basic_demo.sqlite
|
|
41
52
|
```
|
|
42
53
|
|
|
43
|
-
> Note: the `db_url` value is [an abbreviation](https://apilogicserver.github.io/Docs/Data-Model-Examples/)
|
|
54
|
+
> Note: the `db_url` value is [an abbreviation](https://apilogicserver.github.io/Docs/Data-Model-Examples/) for a test database provided as part of the installation. You would normally supply a SQLAlchemy URI to your existing database, e.g. <br>`genai-logic create --project_name=basic_demo --db_url=sqlite:///samples/dbs/basic_demo.sqlite`.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<details markdown>
|
|
58
|
+
|
|
59
|
+
<summary> The database is Customer, Orders, Items and Product</summary>
|
|
44
60
|
|
|
45
|
-
|
|
61
|
+

|
|
46
62
|
|
|
63
|
+
</details>
|
|
64
|
+
<br>
|
|
47
65
|
|
|
48
66
|
|
|
49
|
-
###
|
|
67
|
+
### GenAI: New Database
|
|
50
68
|
|
|
51
|
-
|
|
69
|
+
Alternatively, you can create a project *and a new database* from a prompt, using GenAI.
|
|
70
|
+
> ***Don't*** do this if you are executing the basic Product Tour.
|
|
52
71
|
|
|
53
|
-
|
|
72
|
+
There are 3 ways to use GenAI:
|
|
54
73
|
|
|
55
|
-
|
|
74
|
+
* WebGenAI - in the Browser, via pubic website - [click here](https://apilogicserver.github.io/Docs/WebGenAI), or
|
|
75
|
+
* GenAI - in the Browser, via docker - [click here](https://apilogicserver.github.io/Docs/WebGenAI-install), or
|
|
76
|
+
* GenAI CLI - [click here](https://apilogicserver.github.io/Docs/WebGenAI-CLI)
|
|
77
|
+
|
|
78
|
+
To use the GenAI CLI:
|
|
79
|
+
|
|
80
|
+
1. If you have signed up (see *Get an OpenAI Key*, below), this will create and open a project called `genai_demo` from `genai_demo.prompt` (available in left Explorer pane):
|
|
56
81
|
|
|
57
82
|
```bash
|
|
58
|
-
|
|
83
|
+
genai-logic genai --using=system/genai/examples/genai_demo/genai_demo.prompt --project-name=genai_demo
|
|
59
84
|
```
|
|
60
85
|
|
|
61
|
-
|
|
62
|
-
|
|
63
86
|
2. ***Or,*** you can simulate the process (no signup) using:
|
|
64
87
|
|
|
65
88
|
```bash
|
|
66
|
-
|
|
67
|
-
als genai --repaired-response=system/genai/examples/genai_demo/genai_demo.response_example --project-name=genai_demo
|
|
68
|
-
|
|
89
|
+
genai-logic genai --repaired-response=system/genai/examples/genai_demo/genai_demo.response_example --project-name=genai_demo
|
|
69
90
|
```
|
|
70
91
|
|
|
92
|
+
For background on how it works, [click here](Sample-Genai#how-does-it-work).
|
|
93
|
+
|
|
71
94
|
|
|
95
|
+
|
|
96
|
+
|
|
72
97
|
### Open in your IDE and Run
|
|
73
98
|
|
|
74
99
|
You can open with VSCode, and run it as follows:
|
|
75
100
|
|
|
76
|
-
1. **
|
|
101
|
+
1. **Start the Server:** F5 (also described in the Appendix).
|
|
77
102
|
|
|
78
|
-
|
|
103
|
+
* Your virtual environment is automatically configured in most cases; see the Appendix (Procedures / Detail Procedures) if that's not working.
|
|
79
104
|
|
|
80
|
-
|
|
105
|
+
2. **Start the Admin App:** either use the links provided in the IDE console, or click [http://localhost:5656/](http://localhost:5656/). The Admin App screen shown below should appear in your Browser.
|
|
81
106
|
|
|
82
107
|
The sections below explore the system that has been created (which would be similar for your own database).
|
|
83
108
|
<br><br>
|
|
84
109
|
|
|
85
|
-
|
|
110
|
+
### API with Swagger
|
|
86
111
|
|
|
87
|
-
|
|
112
|
+
The system creates an API with end points for each table, with filtering, sorting, pagination, optimistic locking and related data access -- **[self-serve](https://apilogicserver.github.io/Docs/API-Self-Serve/), ready for custom app dev.**
|
|
88
113
|
|
|
89
|
-
|
|
114
|
+
<details markdown>
|
|
90
115
|
|
|
91
|
-
|
|
116
|
+
<summary>See the Swagger </summary>
|
|
92
117
|
|
|
93
|
-
|
|
118
|
+

|
|
119
|
+
</details>
|
|
120
|
+
<br>
|
|
94
121
|
|
|
95
|
-
|
|
122
|
+
### Admin App
|
|
96
123
|
|
|
97
|
-
|
|
124
|
+
It also creates an Admin App: multi-page, multi-table -- ready for **[business user agile collaboration](https://apilogicserver.github.io/Docs/Tech-AI/),** and back office data maintenance. This complements custom UIs created with the API.
|
|
98
125
|
|
|
99
|
-
|
|
126
|
+
You can click Customer Alice, and see their Orders, and Items.
|
|
100
127
|
|
|
101
|
-
|
|
128
|
+
<details markdown>
|
|
102
129
|
|
|
103
|
-
|
|
130
|
+
<summary>See the Admin App </summary>
|
|
131
|
+

|
|
132
|
+
</details>
|
|
104
133
|
|
|
105
|
-
|
|
134
|
+
<br>
|
|
106
135
|
|
|
107
|
-
|
|
136
|
+
## 2. Custom UI: GenAI, Vibe
|
|
108
137
|
|
|
109
|
-
|
|
110
|
-
* Using your IDE to declare logic and security in `logic/declare_logic.sh` and `security/declare_security.py`.
|
|
138
|
+
The app above is suitable for collaborative iteration to nail down the requirements, and back office data maintenance. It's also easy to make simple customizations, using the yaml file.
|
|
111
139
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
To add customizations, in a terminal window for your project:
|
|
115
|
-
|
|
116
|
-
**1. Stop the Server** (Red Stop button, or Shift-F5 -- see Appendix)
|
|
117
|
-
|
|
118
|
-
**2. Add Customizations**
|
|
140
|
+
For more custom apps, you get complete control by generating app source code, which you can then customize in your IDE, e.g. using Vibe Natural Language:
|
|
119
141
|
|
|
120
142
|
```bash
|
|
121
|
-
|
|
143
|
+
# create react source (requires OpenAI key)
|
|
144
|
+
genai-logic genai-add-app --vibe
|
|
145
|
+
cd ui/react-app
|
|
146
|
+
npm install
|
|
147
|
+
npm start
|
|
122
148
|
```
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### Declare Security
|
|
126
149
|
|
|
127
|
-
|
|
150
|
+
And you are ready to Vibe:
|
|
128
151
|
|
|
129
|
-
|
|
152
|
+
* Instead of creating data mockups, you have a **running API server with real data**
|
|
153
|
+
* Instead of starting from scratch, you have a **running multi-page app**
|
|
154
|
+
* And, you'll have projects that are **architecturally correct:** shared logic, enforced in the server, available for both User Interfaces and services.
|
|
155
|
+
* Then, use you favorite Vibe tools with your running API
|
|
130
156
|
|
|
131
|
-
**1. Start the Server** F5
|
|
132
|
-
|
|
133
|
-
**2. Start the Admin App:** [http://localhost:5656/](http://localhost:5656/)
|
|
134
|
-
|
|
135
|
-
**3. Login** as `s1`, password `p`
|
|
136
157
|
|
|
137
|
-
|
|
158
|
+
```txt title='Customize using Natural Language'
|
|
159
|
+
In the ui/react app, Update the Product list to provide users an option to see results in a list, or in cards.
|
|
160
|
+
```
|
|
161
|
+
<br>
|
|
138
162
|
|
|
139
|
-
|
|
163
|
+
> Below is an example from Northwind: [click here](https://apilogicserver.github.io/Docs/Admin-Vibe-Sample)
|
|
140
164
|
|
|
141
|
-
|
|
165
|
+

|
|
142
166
|
|
|
143
|
-
|
|
167
|
+
<br>
|
|
144
168
|
|
|
145
|
-
|
|
169
|
+
## 3. MCP-Ready APIs
|
|
146
170
|
|
|
147
|
-
|
|
171
|
+
Your project is MCP-ready - this will run a simple query *List customers with credit_limit > 1000* (we'll explore more interesting examples below, including provisions for user input):
|
|
148
172
|
|
|
149
|
-
|
|
173
|
+
```bash
|
|
174
|
+
Create a table SysEmail in `database/db.sqlite` as a child of customer,
|
|
175
|
+
with columns id, message, subject, customer_id and CreatedOn.
|
|
176
|
+
```
|
|
150
177
|
|
|
151
|
-
|
|
178
|
+
Follow the suggestions to update the admin app.
|
|
152
179
|
|
|
153
|
-
|
|
180
|
+
TODO: add mcp client here, and test
|
|
154
181
|
|
|
155
|
-
|
|
182
|
+
TODO: test the service
|
|
156
183
|
|
|
157
|
-
|
|
184
|
+
```bash
|
|
185
|
+
List the orders date_shipped is null and CreatedOn before 2023-07-14, and send a discount email (subject: 'Discount Offer') to the customer for each one.
|
|
186
|
+
```
|
|
158
187
|
|
|
159
|
-
|
|
188
|
+

|
|
160
189
|
|
|
161
|
-
|
|
190
|
+
<br>
|
|
162
191
|
|
|
163
|
-
|
|
192
|
+
## 4. Declare Logic And Security
|
|
164
193
|
|
|
165
|
-
|
|
194
|
+
While API/MCP/UI automation is a great start, it's **critical to enforce logic and security.** You do this in your IDE. Here's how.
|
|
166
195
|
|
|
167
|
-
The `add_customizations` process
|
|
196
|
+
The following `add_customizations` process simulates:
|
|
168
197
|
|
|
169
|
-
|
|
198
|
+
* Adding security to your project, and
|
|
199
|
+
* Using your IDE to declare logic and security in `logic/declare_logic.sh` and `security/declare_security.py`.
|
|
170
200
|
|
|
171
|
-
|
|
201
|
+
> Declared security and logic are shown in the screenshots below.<br>It's quite short - 5 rules, 7 security settings.
|
|
172
202
|
|
|
173
|
-
|
|
203
|
+
To add customizations, in a terminal window for your project:
|
|
174
204
|
|
|
175
|
-
|
|
205
|
+
**1. Stop the Server** (Red Stop button, or Shift-F5 -- see Appendix)
|
|
176
206
|
|
|
177
|
-
|
|
207
|
+
**2. Add Customizations**
|
|
178
208
|
|
|
209
|
+
```bash
|
|
210
|
+
genai-logic add-cust
|
|
211
|
+
genai-logic add-auth --db_url=auth
|
|
212
|
+
```
|
|
179
213
|
|
|
180
214
|
|
|
181
|
-
|
|
215
|
+
### Security: Role Based Access
|
|
182
216
|
|
|
183
|
-
|
|
217
|
+
The `add_customizations` process above has simulated using your IDE to declare security in `logic/declare_logic.sh`.
|
|
184
218
|
|
|
185
|
-
|
|
219
|
+
To see security in action:
|
|
186
220
|
|
|
187
|
-
|
|
221
|
+
**1. Start the Server** F5
|
|
188
222
|
|
|
189
|
-
|
|
223
|
+
**2. Start the Admin App:** [http://localhost:5656/](http://localhost:5656/)
|
|
224
|
+
|
|
225
|
+
**3. Login** as `s1`, password `p`
|
|
190
226
|
|
|
191
|
-
|
|
227
|
+
**4. Click Customers**
|
|
192
228
|
|
|
193
|
-
|
|
194
|
-
|
|
229
|
+
<br>
|
|
230
|
+
Observe:
|
|
195
231
|
|
|
196
|
-
|
|
232
|
+
**1. Login now required**
|
|
197
233
|
|
|
198
|
-
|
|
199
|
-
<br><br>
|
|
234
|
+
**2. Role-Based Filtering**
|
|
200
235
|
|
|
201
|
-
|
|
236
|
+
Observe you now see fewer customers, since user `s1` has role `sales`. This role has a declared filter, as shown in the screenshot below.
|
|
202
237
|
|
|
203
|
-
|
|
204
|
-
<br><br>
|
|
238
|
+
**3. Transparent Logging**
|
|
205
239
|
|
|
206
|
-
|
|
240
|
+
<details markdown>
|
|
207
241
|
|
|
208
|
-
|
|
242
|
+
<summary>See Security Declarations </summary>
|
|
209
243
|
|
|
210
|
-
|
|
244
|
+
<br>The screenshot below illustrates security declaration and operation:
|
|
211
245
|
|
|
212
|
-
|
|
246
|
+
* The declarative Grants in the upper code panel, and
|
|
213
247
|
|
|
214
|
-
|
|
248
|
+
* The logging in the lower panel, to assist in debugging by showing which Grants (`+ Grant:`) are applied:
|
|
215
249
|
|
|
216
|
-
|
|
250
|
+

|
|
217
251
|
|
|
218
|
-
|
|
252
|
+
</details>
|
|
219
253
|
|
|
220
254
|
|
|
221
255
|
|
|
222
|
-
|
|
256
|
+
### Logic: Derivations, Constraints
|
|
223
257
|
|
|
224
|
-
|
|
258
|
+
Logic (multi-table derivations and constraints) is a significant portion of a system, typically nearly half. API Logic Server provides **spreadsheet-like rules** that dramatically simplify and accelerate logic development.
|
|
225
259
|
|
|
226
|
-
|
|
260
|
+
Rules are declared in Python, simplified with IDE code completion. The screen below shows the 5 rules for **Check Credit Logic.**
|
|
227
261
|
|
|
228
|
-
|
|
262
|
+
The `add_customizations` process above has simulated the process of using your IDE to declare logic in `logic/declare_logic.sh`.
|
|
229
263
|
|
|
230
|
-
|
|
264
|
+
To see logic in action:
|
|
231
265
|
|
|
232
|
-
|
|
233
|
-
def derive_amount(row: models.Item, old_row: models.Item, logic_row: LogicRow):
|
|
234
|
-
amount = row.Quantity * row.UnitPrice
|
|
235
|
-
if row.Product.CarbonNeutral and row.Quantity >= 10:
|
|
236
|
-
amount = amount * Decimal(0.9) # breakpoint here
|
|
237
|
-
return amount
|
|
266
|
+
**1. In the admin app, Logout (upper right), and login as admin, p**
|
|
238
267
|
|
|
239
|
-
|
|
240
|
-
```
|
|
268
|
+
**2. Use the Admin App to access the first order for `Customer Alice`**
|
|
241
269
|
|
|
242
|
-
|
|
270
|
+
**3. Edit its first item to a very high quantity**
|
|
243
271
|
|
|
244
|
-
|
|
272
|
+
The update is properly rejected because it exceeds the credit limit. Observe the rules firing in the console log - see Logic In Action, below.
|
|
245
273
|
|
|
246
|
-
|
|
274
|
+
<br>
|
|
275
|
+
> 💡 Logic: Multi-table Derivations and Constraint Declarative Rules.<br>  Declarative Rules are 40X More Concise than procedural code.<br>  For more information, [click here](https://apilogicserver.github.io/Docs/Logic-Why).
|
|
247
276
|
|
|
248
|
-
|
|
277
|
+
<br>
|
|
249
278
|
|
|
250
|
-
|
|
251
|
-
als add-cust
|
|
252
|
-
```
|
|
253
|
-
|
|
279
|
+
<details markdown>
|
|
254
280
|
|
|
255
|
-
|
|
281
|
+
<summary>See Logic In Action </summary>
|
|
256
282
|
|
|
257
|
-
|
|
283
|
+
<br>[Declare logic](Logic#declaring-rules) with WebGenAI, or in your IDE using code completion or Natural Language:
|
|
258
284
|
|
|
259
|
-
|
|
285
|
+

|
|
260
286
|
|
|
261
|
-
|
|
287
|
+
**a. Chaining**
|
|
262
288
|
|
|
263
|
-
|
|
289
|
+
The screenshot below shows our logic declarations, and the logging for inserting an `Item`. Each line represents a rule firing, and shows the complete state of the row.
|
|
264
290
|
|
|
265
|
-
|
|
291
|
+
Note that it's a `Multi-Table Transaction`, as indicated by the indentation. This is because - like a spreadsheet - **rules automatically chain, *including across tables.***
|
|
266
292
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
!!! pied-piper ":bulb: Iteration: Automatic Invocation/Ordering, Extensible, Rebuild Preserves Customizations"
|
|
270
|
-
|
|
271
|
-
### a. Dependency Automation
|
|
293
|
+

|
|
272
294
|
|
|
273
|
-
|
|
295
|
+
**b. 40X More Concise**
|
|
274
296
|
|
|
275
|
-
|
|
276
|
-
<br><br>
|
|
297
|
+
The 5 spreadsheet-like rules represent the same logic as 200 lines of code, [shown here](https://github.com/valhuber/LogicBank/wiki/by-code). That's a remarkable 40X decrease in the backend half of the system.
|
|
277
298
|
|
|
278
|
-
|
|
299
|
+
> 💡 No FrankenCode<br>Note the rules look like syntactically correct requirements. They are not turned into piles of unmanageable "frankencode" - see [models not frankencode](https://www.genai-logic.com/faqs#h.3fe4qv21qtbs).
|
|
279
300
|
|
|
280
|
-
|
|
301
|
+
<br><br>
|
|
281
302
|
|
|
282
|
-
|
|
283
|
-
<br>
|
|
303
|
+
**c. Automatic Re-use**
|
|
284
304
|
|
|
285
|
-
|
|
305
|
+
The logic above, perhaps conceived for Place order, applies automatically to all transactions: deleting an order, changing items, moving an order to a new customer, etc. This reduces code, and promotes quality (no missed corner cases).
|
|
306
|
+
<br><br>
|
|
286
307
|
|
|
287
|
-
|
|
288
|
-
<br><br>
|
|
308
|
+
**d. Automatic Optimizations**
|
|
289
309
|
|
|
290
|
-
|
|
310
|
+
SQL overhead is minimized by pruning, and by elimination of expensive aggregate queries. These can result in orders of magnitude impact.
|
|
311
|
+
<br><br>
|
|
291
312
|
|
|
292
|
-
|
|
313
|
+
**e. Transparent**
|
|
293
314
|
|
|
294
|
-
|
|
315
|
+
Rules are an executable design. Note they map exactly to our natural language design (shown in comments) - readable by business users.
|
|
295
316
|
|
|
296
|
-
|
|
317
|
+
Optionally, you can use the Behave TDD approach to define tests, and the Rules Report will show the rules that execute for each test. For more information, [click here](https://apilogicserver.github.io/Docs/Behave-Logic-Report/).
|
|
297
318
|
|
|
298
|
-
|
|
319
|
+
</details>
|
|
299
320
|
|
|
300
|
-
|
|
321
|
+
|
|
301
322
|
|
|
302
|
-
|
|
323
|
+
### MCP: Logic, User Interface
|
|
303
324
|
|
|
304
|
-
|
|
325
|
+
Logic is automatically executed in your MCP-enabled API. For example, consider the following MCP orchestration:
|
|
305
326
|
|
|
306
|
-
|
|
327
|
+

|
|
307
328
|
|
|
308
|
-
### Messaging With Kafka
|
|
309
329
|
|
|
310
|
-
|
|
330
|
+
When sending email, we require ***business rules*** to ensure it respects the opt-out policy:
|
|
311
331
|
|
|
312
|
-
|
|
332
|
+

|
|
313
333
|
|
|
314
|
-
|
|
334
|
+
The server is automatically mcp-enabled, but we might also want an mcp user-interface client:
|
|
315
335
|
|
|
316
|
-
|
|
336
|
+
**1. Stop the Server**
|
|
317
337
|
|
|
318
|
-
|
|
338
|
+
**2. Create an MCP Client Executor like this:**
|
|
319
339
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
340
|
+
```
|
|
341
|
+
genai-logic genai-add-mcp-client
|
|
342
|
+
```
|
|
323
343
|
|
|
324
|
-
|
|
344
|
+
**3. Restart the Server**
|
|
325
345
|
|
|
326
|
-
|
|
346
|
+
<br>
|
|
327
347
|
|
|
328
|
-
|
|
348
|
+
With the server running, test it like this:
|
|
329
349
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
In minutes - not days or weeks - you've used API Logic Server to convert an idea into **working software**, customized using **rule-based logic and security**, and **iterated** to meet new requirements.
|
|
333
|
-
|
|
334
|
-
To dive deeper, you can install [API Logic Server](https://apilogicserver.github.io/Docs) and execute this demo - or create a system from your own databases.
|
|
350
|
+
1. **Test MCP**
|
|
335
351
|
|
|
336
|
-
|
|
352
|
+
You can do this in the command line, or via the admin app.
|
|
337
353
|
|
|
338
|
-
|
|
354
|
+
Use the **Admin App:** (shown above), and follow step 4 on the Home page to see a Business-User-friendly example.
|
|
339
355
|
|
|
340
|
-
|
|
356
|
+
Or, use the command line.
|
|
341
357
|
|
|
342
|
-
|
|
358
|
+
> Since the CLI does not pass an auth token,
|
|
359
|
+
you must first stop the server and disable security.
|
|
343
360
|
|
|
344
|
-
|
|
361
|
+
```bash title='MCP from the command line'
|
|
362
|
+
python integration/mcp/mcp_client_executor.py mcp
|
|
363
|
+
```
|
|
345
364
|
|
|
346
|
-
|
|
365
|
+
<br>
|
|
347
366
|
|
|
348
|
-
|
|
367
|
+
For more on MCP, [click here](https://apilogicserver.github.io/Docs/Integration-MCP).
|
|
349
368
|
|
|
350
|
-
|
|
369
|
+
<br>
|
|
351
370
|
|
|
352
|
-
##
|
|
371
|
+
## 5. Iterate with Rules and Python
|
|
353
372
|
|
|
354
|
-
|
|
373
|
+
Not only are spreadsheet-like rules 40X more concise, they meaningfully simplify maintenance. Let's take an example:
|
|
355
374
|
|
|
356
|
-
|
|
375
|
+
>> Give a 10% discount for carbon-neutral products for 10 items or more.
|
|
376
|
+
<br>
|
|
357
377
|
|
|
358
|
-
|
|
359
|
-
# Admin App, API, Project
|
|
360
|
-
als create --project-name=basic_demo --db-url=basic_demo
|
|
378
|
+
The following `add-cust` process simulates an iteration:
|
|
361
379
|
|
|
362
|
-
|
|
363
|
-
# see logic (logic/declare_logic.py, logic/cocktail-napkin.jpg); add an Order and Item
|
|
364
|
-
# see security (security/declare_security.py); compare customers, s1 vs. admin
|
|
365
|
-
als add-cust
|
|
366
|
-
als add-auth --db_url=auth
|
|
380
|
+
* acquires a new database with `Product.CarbonNeutral`
|
|
367
381
|
|
|
368
|
-
|
|
369
|
-
# see logic/declare_logic.py (breakpoint for Kafka)
|
|
370
|
-
# Swagger: ServicesEndPoint.OrderB2B
|
|
371
|
-
als add-cust
|
|
372
|
-
als rebuild-from-database --db_url=sqlite:///database/db.sqlite
|
|
373
|
-
```
|
|
382
|
+
* issues the `genai-logic rebuild-from-database` command that rebuilds your project (the database models, the api), while preserving the customizations we made above.
|
|
374
383
|
|
|
375
|
-
|
|
384
|
+
* acquires a revised `ui/admin/admin.yaml` that shows this new column in the admin app
|
|
376
385
|
|
|
377
|
-
|
|
386
|
+
* acquires this revised logic - in `logic/declare_logic.py`, we replaced the 2 lines for the `models.Item.Amount` formula with this (next screenshot shows revised logic executing with breakpoint):
|
|
378
387
|
|
|
379
|
-
|
|
388
|
+
```python
|
|
389
|
+
def derive_amount(row: models.Item, old_row: models.Item, logic_row: LogicRow):
|
|
390
|
+
amount = row.Quantity * row.UnitPrice
|
|
391
|
+
if row.Product.CarbonNeutral and row.Quantity >= 10:
|
|
392
|
+
amount = amount * Decimal(0.9) # breakpoint here
|
|
393
|
+
return amount
|
|
380
394
|
|
|
381
|
-
|
|
395
|
+
Rule.formula(derive=models.Item.Amount, calling=derive_amount)
|
|
396
|
+
```
|
|
382
397
|
|
|
383
398
|
|
|
384
399
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
Python employs a virtual environment for project-specific dependencies. Create one as shown below, depending on your IDE.
|
|
400
|
+
To add this iteration, repeat the process above - in a terminal window for your project:
|
|
388
401
|
|
|
389
|
-
|
|
402
|
+
**1. Stop the Server** (Red Stop button, or Shift-F5 -- see Appendix)
|
|
390
403
|
|
|
391
|
-
|
|
404
|
+
**2. Add Iteration**
|
|
392
405
|
|
|
393
406
|
```bash
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
pip install -r requirements.txt
|
|
407
|
+
genai-logic add-cust
|
|
408
|
+
genai-logic rebuild-from-database --db_url=sqlite:///database/db.sqlite
|
|
398
409
|
```
|
|
399
410
|
|
|
400
|
-
|
|
411
|
+
* You can ignore the warning regarding *'mcp-SysMcp' - not present*
|
|
401
412
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
413
|
+
**3. Set the breakpoint as shown in the screenshot below**
|
|
405
414
|
|
|
406
|
-
**
|
|
415
|
+
**4. Test: Start the Server, login as Admin**
|
|
407
416
|
|
|
408
|
-
|
|
417
|
+
**5. Use the Admin App to update your Order by adding 12 `Green` Items**
|
|
409
418
|
|
|
410
|
-
|
|
419
|
+
At the breakpoint, observe you can use standard debugger services to debug your logic (examine `Item` attributes, step, etc).
|
|
411
420
|
|
|
412
|
-
|
|
421
|
+

|
|
413
422
|
|
|
414
423
|
|
|
415
424
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
To enter a new Order:
|
|
419
|
-
|
|
420
|
-
1. Click `Customer 1``
|
|
425
|
+
This simple example illustrates some significant aspects of iteration, described in the sub-sections below.
|
|
421
426
|
|
|
422
|
-
|
|
427
|
+
<br>
|
|
428
|
+
> 💡 Iteration: Automatic Invocation/Ordering, Extensible, Rebuild Preserves Customizations
|
|
423
429
|
|
|
424
|
-
|
|
430
|
+
<br>
|
|
425
431
|
|
|
426
|
-
|
|
432
|
+
**a. Dependency Automation**
|
|
427
433
|
|
|
428
|
-
|
|
434
|
+
Along with perhaps documentation, one of the tasks programmers most loathe is maintenance. That's because it's not about writing code, but it's mainly archaeology - deciphering code someone else wrote, just so you can add 4 or 5 lines that will hopefully be called and function correctly.
|
|
429
435
|
|
|
430
|
-
|
|
436
|
+
Rules change that, since they **self-order their execution** (and pruning) based on system-discovered dependencies. So, to alter logic, you just "drop a new rule in the bucket", and the system will ensure it's called in the proper order, and re-used over all the Use Cases to which it applies. Maintenance is **faster, and higher quality.**
|
|
437
|
+
<br><br>
|
|
431
438
|
|
|
432
|
-
|
|
439
|
+
**b. Extensibile with Python**
|
|
433
440
|
|
|
434
|
-
|
|
441
|
+
In this case, we needed to do some if/else testing, and it was convenient to add a pinch of Python. Using "Python as a 4GL" is remarkably simple, even if you are new to Python.
|
|
435
442
|
|
|
443
|
+
Of course, you have the full object-oriented power of Python and its many libraries, so there are *no automation penalty* restrictions.
|
|
444
|
+
<br>
|
|
436
445
|
|
|
437
|
-
**
|
|
446
|
+
**c. Debugging: IDE, Logging**
|
|
438
447
|
|
|
439
|
-
|
|
448
|
+
The screenshot above illustrates that debugging logic is what you'd expect: use your IDE's debugger. This "standard-based" approach applies to other development activities, such as source code management, and container-based deployment.
|
|
449
|
+
<br><br>
|
|
440
450
|
|
|
441
|
-
|
|
451
|
+
**d. Customizations Retained**
|
|
442
452
|
|
|
443
|
-
|
|
453
|
+
Note we rebuilt the project from our altered database, illustrating we can **iterate, while *preserving customizations.***
|
|
444
454
|
|
|
445
455
|
|
|
446
456
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
The database here is SQLite. You can use the SQLite CLI to add a column using the terminal window of your IDE:
|
|
450
|
-
|
|
451
|
-
```bash
|
|
452
|
-
$ sqlite3 database/db.sqlite
|
|
453
|
-
> alter table Products Add CarbonNeutral Boolean;
|
|
454
|
-
> .exit
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
The SQLite DBMS is installed with API Logic Server, but the **CLI** is not provided on all systems. If it's not installed, [you can install it like this](https://apilogicserver.github.io/Docs/Database-Connectivity/#sqlite).
|
|
458
|
-
|
|
459
|
-
## Appendix: Setup Codespaces
|
|
460
|
-
|
|
461
|
-
Codespaces enables you to run in the cloud: VSCode via your Browser, courtesy GitHub. You can use codespaces on your GenAI project:
|
|
462
|
-
|
|
463
|
-
__1. Open your project on GitHub__
|
|
464
|
-
|
|
465
|
-

|
|
466
|
-
|
|
467
|
-
__2. Open it in Codespaces (takes a minute or 2):__
|
|
457
|
+
### API Customization: Standard
|
|
468
458
|
|
|
469
|
-
|
|
459
|
+
Of course, we all know that all businesses the world over depend on the `hello world` app. This is provided in `api/customize_api`. Observe that it's:
|
|
470
460
|
|
|
471
|
-
|
|
461
|
+
* standard Python
|
|
472
462
|
|
|
473
|
-
|
|
463
|
+
* using Flask
|
|
474
464
|
|
|
475
|
-
|
|
465
|
+
* and, for database access, SQLAlchemy. Note all updates from custom APIs also enforce your logic.
|
|
476
466
|
|
|
477
|
-
|
|
467
|
+
Explore the custom API in `api/api_discovery/order_b2b.py`, and test it using swagger:
|
|
478
468
|
|
|
479
|
-
|
|
469
|
+
1. **Access the Home page of the Admin App**
|
|
470
|
+
2. **Access the swagger**
|
|
471
|
+
3. **Test the b2b API / Logic, as shown below:**
|
|
480
472
|
|
|
481
|
-
|
|
473
|
+

|
|
482
474
|
|
|
483
|
-
|
|
475
|
+
|
|
484
476
|
|
|
477
|
+
### Messaging With Kafka
|
|
485
478
|
|
|
486
|
-
|
|
479
|
+
Along with APIs, messaging is another technology commonly employed for application integration. See the screenshot below; for more information, see [Sample Integration](Sample-Integration#produce-ordershipping-message).
|
|
487
480
|
|
|
481
|
+

|
|
488
482
|
|
|
489
483
|
|
|
490
|
-
##
|
|
484
|
+
## 6. Deploy Containers: No Fees
|
|
491
485
|
|
|
492
|
-
|
|
493
|
-
<br>GenAI-Logic uses OpenAI, which requires an Open API Key:
|
|
486
|
+
API Logic Server also creates scripts for deployment. While these are ***not required at this demo,*** this means you can enable collaboration with Business Users:
|
|
494
487
|
|
|
495
|
-
1.
|
|
488
|
+
1. Create a container from your project -- see `devops/docker-image/build_image.sh`
|
|
489
|
+
2. Upload to Docker Hub, and
|
|
490
|
+
3. Deploy for agile collaboration.
|
|
496
491
|
|
|
497
|
-
|
|
492
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Vibe MCP / Microservice
|
|
3
|
+
do_process_code_block_titles: True
|
|
3
4
|
version: 0.23 from docsite 7/11/2025
|
|
4
5
|
---
|
|
5
6
|
<style>
|
|
@@ -60,15 +61,13 @@ Verify it as follows:
|
|
|
60
61
|
|
|
61
62
|
## Create a Custom React App
|
|
62
63
|
|
|
63
|
-
**Create Start App**
|
|
64
64
|
```bash title="Create a custom react app"
|
|
65
65
|
Create a react app.
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
<br>
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
```txt title='Customize using Natural Language'
|
|
70
|
+
```txt title='Customize using Natural Language - Add Cards'
|
|
72
71
|
In the ui/react app, update the Product list to provide users an option to see results in a list,
|
|
73
72
|
or in cards.
|
|
74
73
|
```
|
|
@@ -86,13 +85,6 @@ todo - diagram
|
|
|
86
85
|
|
|
87
86
|
<br>
|
|
88
87
|
|
|
89
|
-
**Create MCP Executor: process request - invokes the LLM to obtain a series of API calls to run, and runs them**
|
|
90
|
-
``` bash title="Create an MCP Client Executor"
|
|
91
|
-
Create the mcp client executor
|
|
92
|
-
```
|
|
93
|
-
<br>
|
|
94
|
-
|
|
95
|
-
**Add a Table to Track Sent Emails**
|
|
96
88
|
``` bash title="Add a Table to Track Sent Emails"
|
|
97
89
|
Create a table SysEmail in `database/db.sqlite` as a child of customer,
|
|
98
90
|
with columns id, message, subject, customer_id and CreatedOn.
|
|
@@ -101,7 +93,14 @@ Follow the suggestions to update the admin app.
|
|
|
101
93
|
|
|
102
94
|
<br>
|
|
103
95
|
|
|
104
|
-
|
|
96
|
+
<br>
|
|
97
|
+
|
|
98
|
+
``` bash title="Create MCP Executor: process request - invokes the LLM to obtain a series of API calls to run, and runs them"
|
|
99
|
+
Create the mcp client executor
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
<br>
|
|
103
|
+
|
|
105
104
|
``` bash title="Create the email service using SysEmail as a Request Table"
|
|
106
105
|
Add an after_flush event on SysEmail to produce a log message "email sent",
|
|
107
106
|
unless the customer has opted out.
|
|
@@ -109,7 +108,6 @@ unless the customer has opted out.
|
|
|
109
108
|
|
|
110
109
|
<br>
|
|
111
110
|
|
|
112
|
-
**Business Logic to Honor Email Opt-out**
|
|
113
111
|
```bash title="Business Logic to Honor Email Opt-out"
|
|
114
112
|
Add an after_flush event on SysEmail to produce a log message "email sent",
|
|
115
113
|
unless the customer has opted out.
|
|
@@ -117,7 +115,6 @@ unless the customer has opted out.
|
|
|
117
115
|
|
|
118
116
|
<br>
|
|
119
117
|
|
|
120
|
-
**Test: restart the server/admin app - Click SysMCP >> Create New, and enter:**
|
|
121
118
|
```text title="Test the MCP Client: Click SysMCP >> Create New, and enter"
|
|
122
119
|
List the orders date_shipped is null and CreatedOn before 2023-07-14,
|
|
123
120
|
and send a discount email (subject: 'Discount Offer') to the customer for each one.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
api_logic_server_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
api_logic_server_cli/api_logic_server.py,sha256=
|
|
3
|
-
api_logic_server_cli/api_logic_server_info.yaml,sha256=
|
|
2
|
+
api_logic_server_cli/api_logic_server.py,sha256=bvJalrJd3kvbg2Wo5mGyaE9XI2ZuePaAZ3YNDULo3P8,103516
|
|
3
|
+
api_logic_server_cli/api_logic_server_info.yaml,sha256=5VlTp5Iv_b3mQxAzTHdNWGpGeeI8Q37-wRRN5y20rrw,128
|
|
4
4
|
api_logic_server_cli/cli.py,sha256=gd_uHrUanp705EryYAdkY5D9LJJvvSEHUwoylm-G6sw,87355
|
|
5
5
|
api_logic_server_cli/cli_args_base.py,sha256=7cVM6BeizwttYAwUu1FUyuLuvWufvgt0TFeA8FI6tu0,3304
|
|
6
6
|
api_logic_server_cli/cli_args_project.py,sha256=I5no_fGRV_ZsK3SuttVDAaQYI4Q5zCjx6LojGkM024w,4645
|
|
@@ -11,7 +11,7 @@ api_logic_server_cli/add_cust/add_cust.py,sha256=yi_6qoiBm19K1u5VNhDW-KaTVcnsU-u
|
|
|
11
11
|
api_logic_server_cli/create_from_model/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
|
12
12
|
api_logic_server_cli/create_from_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
api_logic_server_cli/create_from_model/api_expose_api_models_creator.py,sha256=V-u3Hm404doztw66YuD2A043RCFmtw5QF5tMioC_1b0,7900
|
|
14
|
-
api_logic_server_cli/create_from_model/api_logic_server_utils.py,sha256=
|
|
14
|
+
api_logic_server_cli/create_from_model/api_logic_server_utils.py,sha256=H0t_hpN6TGzhe9CAzkonX3dUvZ2k9qeemKHexoXtIQI,28624
|
|
15
15
|
api_logic_server_cli/create_from_model/create_db_from_model.py,sha256=2H7slGnk39XOSnvL7vxrg6Ewx4bxeBJBgLo8fcXHTB4,4382
|
|
16
16
|
api_logic_server_cli/create_from_model/dbml.py,sha256=m1yRnes5DXPMQrFBFJM2CuDhIfVFywSM6nDX7k19BLU,11573
|
|
17
17
|
api_logic_server_cli/create_from_model/meta_model.py,sha256=ERf7tSgnSJSeRMVyggkdg-lvORQZSbfK0KMpL63qSEY,5837
|
|
@@ -508,7 +508,7 @@ api_logic_server_cli/prototypes/base/.DS_Store,sha256=wKX7g_yII-CHA_BuKAVYXwglzg
|
|
|
508
508
|
api_logic_server_cli/prototypes/base/.gitignore,sha256=PAO98cVvjgAL_mvXCMS_Vfk7bT2Vd1-j9a8_nB2qxqs,190
|
|
509
509
|
api_logic_server_cli/prototypes/base/README_PROJECT.md,sha256=sGJuNF_Qt5ripZBXfTi0OmoV4fUxe7ySxrqcKs7DwOk,1186
|
|
510
510
|
api_logic_server_cli/prototypes/base/api_logic_server_run.py,sha256=j4a0jwPn-USqkFrCiFI34TcCTHxNOnPAW-IwMtFGWcw,7074
|
|
511
|
-
api_logic_server_cli/prototypes/base/readme.md,sha256=
|
|
511
|
+
api_logic_server_cli/prototypes/base/readme.md,sha256=sh6S1RQbTNDssRK_EsLt_KRWRMTBJ7QxsCTMoLaAmzY,12672
|
|
512
512
|
api_logic_server_cli/prototypes/base/requirements.txt,sha256=we6X5fRBJVqN8SacwV7oPDtGk5IAiNbUDbUwCGHkCrc,107
|
|
513
513
|
api_logic_server_cli/prototypes/base/run.ps1,sha256=lrZgw8SEntPam3ZYKVzsRo7rOKSGWqgO7qUNJ3CbP44,801
|
|
514
514
|
api_logic_server_cli/prototypes/base/run.sh,sha256=7kJc-FpK9iqtt9BDXR1XogWXfVDnmPS8kS5fXk2Q5Dk,1442
|
|
@@ -516,7 +516,7 @@ api_logic_server_cli/prototypes/base/.devcontainer-option/For_VSCode.dockerfile,
|
|
|
516
516
|
api_logic_server_cli/prototypes/base/.devcontainer-option/devcontainer.json,sha256=tk-mGd4XdmbpKUqUeGmcPMzX3RDc6am9-de8c-rFmSo,2361
|
|
517
517
|
api_logic_server_cli/prototypes/base/.devcontainer-option/readme.md,sha256=-sSneMDne1fqEoox2hXUGmoO8ewgi34y7lJwGTidSpY,104
|
|
518
518
|
api_logic_server_cli/prototypes/base/.devcontainer-option/setup.sh,sha256=pOvGjZ7jgRQzFkD93mNICmcC2y66Dexrq4bCnSSVwtU,310
|
|
519
|
-
api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md,sha256=
|
|
519
|
+
api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md,sha256=JUmoR882ev41blkiooshu__iFWgeT6DX6KCf62B69KU,10280
|
|
520
520
|
api_logic_server_cli/prototypes/base/.idea/runConfigurations/ApiLogicServer.xml,sha256=eFzhe9NH-VNjcPWbPsRQy5o-MugJR9IWklA1Fo8wtYg,1127
|
|
521
521
|
api_logic_server_cli/prototypes/base/.idea/runConfigurations/Report_Behave_Logic.xml,sha256=I3jlEf-TPzc-1NY843v6AcQIQ8QJD3z9KvxTYSZWMtY,1306
|
|
522
522
|
api_logic_server_cli/prototypes/base/.idea/runConfigurations/Run_Behave.xml,sha256=CTzF0P4w7o4FzOi-eSpru0HczSEGtJsKqkQ7VWRyxPc,1196
|
|
@@ -630,7 +630,7 @@ api_logic_server_cli/prototypes/base/integration/kafka/kafka_consumer.py,sha256=
|
|
|
630
630
|
api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py,sha256=g0nMAVfz1Y0iKJbbXfvRpdf-QUmyB4uUGZ6lyaVoXag,4470
|
|
631
631
|
api_logic_server_cli/prototypes/base/integration/kafka/kafka_readme.md,sha256=MlwykHWM2w41KzWh4vPuTnIodR8f-BQzrWpV4P1hrsI,161
|
|
632
632
|
api_logic_server_cli/prototypes/base/integration/mcp/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
|
633
|
-
api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py,sha256=
|
|
633
|
+
api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py,sha256=CzDkR6teyhIHT6UqCrWvbgyRna_rodtitj6k7uOwtv4,25505
|
|
634
634
|
api_logic_server_cli/prototypes/base/integration/mcp/mcp_server_discovery.json,sha256=TUyInb67AWoGw7XFE9iDZxmM8UEID-ahQmdmzpF9AmQ,188
|
|
635
635
|
api_logic_server_cli/prototypes/base/integration/mcp/readme-mcp.md,sha256=TuqDgTM7nHVQINmSxO8QO6rBzo_PJ-QxIxhZM3YeLB8,370
|
|
636
636
|
api_logic_server_cli/prototypes/base/integration/mcp/examples/mcp_context_results.txt,sha256=27a8-MpBoE3i8UnCoMZINgeseFUxGhhwurgoV5EeP1k,8105
|
|
@@ -653,7 +653,7 @@ api_logic_server_cli/prototypes/base/logic/logic_discovery/readme_logic_discover
|
|
|
653
653
|
api_logic_server_cli/prototypes/base/logic/logic_discovery/use_case.py,sha256=9qp9e_PwTvIg5mfYLtFxfwFhfivBhk3O6uHeh_lUd5c,822
|
|
654
654
|
api_logic_server_cli/prototypes/base/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
655
655
|
api_logic_server_cli/prototypes/base/security/declare_security.py,sha256=sWi-M7E-dIhvC0hmdCXnTRjHAR5eWVKCYIDCoblISm4,2281
|
|
656
|
-
api_logic_server_cli/prototypes/base/security/readme_security.md,sha256=
|
|
656
|
+
api_logic_server_cli/prototypes/base/security/readme_security.md,sha256=G8krW3KHl_N-ksbEr3WFV3U2ODYhlFYOij73t-KV9jk,507
|
|
657
657
|
api_logic_server_cli/prototypes/base/security/authentication_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
658
658
|
api_logic_server_cli/prototypes/base/security/authentication_provider/abstract_authentication_provider.py,sha256=RPPA48kdYiXx5zQ6epbfAEB1se8E10Ra9NxYRjIBShk,895
|
|
659
659
|
api_logic_server_cli/prototypes/base/security/authentication_provider/keycloak/auth_provider.py,sha256=gnk8CqhlEobRPEBTwimG6OkZhc5gP-Yba1VFlTydt2Q,10437
|
|
@@ -705,7 +705,7 @@ api_logic_server_cli/prototypes/base/venv_setup/venv-linux.sh,sha256=FDIxVyZ50Cg
|
|
|
705
705
|
api_logic_server_cli/prototypes/base/venv_setup/venv.ps1,sha256=_-LfKkLw5HOkZsF59BGCqM9Zsk3n1oDIyDb4emy0O08,698
|
|
706
706
|
api_logic_server_cli/prototypes/base/venv_setup/venv.sh,sha256=aWX9fa8fe6aO9ifBIZEgGY5UGh4I0arOoCwBzDsxgU8,893
|
|
707
707
|
api_logic_server_cli/prototypes/basic_demo/.DS_Store,sha256=sij8zwzUCUY-cTmB_AJNRd5JqPXoK-aLIhIo495iLIA,6148
|
|
708
|
-
api_logic_server_cli/prototypes/basic_demo/README.md,sha256=
|
|
708
|
+
api_logic_server_cli/prototypes/basic_demo/README.md,sha256=lPqI91XAoZfkisGAICK_l2OCn7QYU6BFFfS05BCCHk8,18338
|
|
709
709
|
api_logic_server_cli/prototypes/basic_demo/_config.yml,sha256=KIUQQpjgj7hP_Z2Fksq90E52UnbKnyom-v9L_eIfqZo,170
|
|
710
710
|
api_logic_server_cli/prototypes/basic_demo/_layouts/redirect.html,sha256=-0kMPGYI88fb787IzYmdi7ySZUhgpUlP0vodrg8-NRM,457
|
|
711
711
|
api_logic_server_cli/prototypes/basic_demo/customizations/.DS_Store,sha256=9TTUzzmsI5vYa6wg5TIBWMNRsKivi_IDbgb05zReWN4,6148
|
|
@@ -766,7 +766,7 @@ api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app
|
|
|
766
766
|
api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.js,sha256=nV_j3KpDeUpD8sPsGJeOqi6lUvcPbheJtLdqU5nENPs,4366
|
|
767
767
|
api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.ts,sha256=FlsEiPVX_U-22glUGoscj3qcYdnfMJ_9Wa2Vi4CV2xs,4471
|
|
768
768
|
api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/styles.module.css,sha256=AuGbjqBQu2by4z5APJvQAWk44ocrdQ9lCopqYCJXCy0,154
|
|
769
|
-
api_logic_server_cli/prototypes/basic_demo/docs/system-creation-vibe.md,sha256=
|
|
769
|
+
api_logic_server_cli/prototypes/basic_demo/docs/system-creation-vibe.md,sha256=7ECJTc-BM6TwgBc3NM67a6LPXqBVY7RtRFepvhPjBko,4001
|
|
770
770
|
api_logic_server_cli/prototypes/basic_demo/iteration/api/api_discovery/order_b2b.py,sha256=hg9Bsz0_t-RjO9rFcW-YH3y26kq4IY5dd9FfVoYxB4w,3176
|
|
771
771
|
api_logic_server_cli/prototypes/basic_demo/iteration/database/db.sqlite,sha256=SvpzWZxWnwIqd25UhzL5crhtjEfF53MLj3lOB2cPK8M,24576
|
|
772
772
|
api_logic_server_cli/prototypes/basic_demo/iteration/docs/er_diagram.png,sha256=-3aSv9ay7XeFqGU-cygRz5T5eYhY627BYmA6GXdUYH0,161072
|
|
@@ -2298,9 +2298,9 @@ api_logic_server_cli/tools/mini_skel/database/system/SAFRSBaseX.py,sha256=p8C7AF
|
|
|
2298
2298
|
api_logic_server_cli/tools/mini_skel/database/system/TestDataBase.py,sha256=U02SYqThsbY5g3DX7XGaiMxjZBuOpzvtPS6RfI1WQFg,371
|
|
2299
2299
|
api_logic_server_cli/tools/mini_skel/logic/declare_logic.py,sha256=fTrlHyqMeZsw_TyEXFa1VlYBL7fzjZab5ONSXO7aApo,175
|
|
2300
2300
|
api_logic_server_cli/tools/mini_skel/logic/load_verify_rules.py,sha256=Rr5bySJpYCZmNPF2h-phcPJ53nAOPcT_ohZpCD93-a0,7530
|
|
2301
|
-
apilogicserver-15.0.
|
|
2302
|
-
apilogicserver-15.0.
|
|
2303
|
-
apilogicserver-15.0.
|
|
2304
|
-
apilogicserver-15.0.
|
|
2305
|
-
apilogicserver-15.0.
|
|
2306
|
-
apilogicserver-15.0.
|
|
2301
|
+
apilogicserver-15.0.55.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
|
|
2302
|
+
apilogicserver-15.0.55.dist-info/METADATA,sha256=lZEo3VL3d_dteRSrGPTMsGvUGWHWN_v0tlAE8iZ27Tc,6653
|
|
2303
|
+
apilogicserver-15.0.55.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
2304
|
+
apilogicserver-15.0.55.dist-info/entry_points.txt,sha256=W9EVNvf09h8n6rJChmVj2gzxVQ6BXXZa2x3wri0lFGc,259
|
|
2305
|
+
apilogicserver-15.0.55.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
|
|
2306
|
+
apilogicserver-15.0.55.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|