Skip to content

Create with CLI

💡 TL;DR - ApiLogicServer create

The genai-logic create CLI command creates a customizable / executable API Logic Project from an existing database, providing:

  • A JSON:API - Endpoint for each table, with filtering, sorting, pagination, optimistic locking, including related data access, based on relationships in the models file (typically derived from foreign keys)

  • An Admin App - multi-page, multi-table, with automatic joins

The genai-logic genai CLI command creates a customizable / executable API Logic Project and a new database, from an NL prompt. For more information, see WebGenAI CLI.

Customize the project in your IDE to add custom endpoints, rules and Python for logic and security. Projects are fully configured for development (e.g. run configurations) and deployment (e.g., image creation, env variables).

 

genai-logic create (existing db)

The key genai-logic create options are:

Discover other options with genai-logic create --help.

Discover other commands with genai-logic --help.

 

Create --from-model

In addition to creating projects from databases, you can also create them from SQLAlchemy models. For example:

  • Copilot can produce models
  • Many Python programmers prefer to use SQLAlchemy as their database tool
Create from Model
als create --project-name=sample_ai --from-model=sample_ai.py --db-url=sqlite

 

genai-logic genai (new db)

The key genai-logic genai options are:

  • --using identifies the prompt file name

  • --project_name defines the directory created for your project (optional)

Discover other options with genai-logic create --help.

Discover other commands with genai-logic --help.

The key files that drive execution are described below. Note they are models - instead of lengthy generated code (what), they are Python declarations of how.

 

Using AI Assistant

 

In addition to CLI commands, you might it simpler to use your AI Assistant (e.g., Copilot).

CLI Shortcut (in Manager)

Copilot will create run the CLI for you with commands such as:

Create from Copilot
create a project from basic_demo in samoles.dbs

 

Subsystem Creation (in Proj)

Beyond creating databases and logic, we have seen AI create entire systems. For example, this remarkable command:

  • Finds, reads and understands the reference statutes from web-based documents
  • Builds an executable GenAI-Logic project, including:

    • A database (including sample data), Admin App and API
    • Business logic, expressed as rules
    • Business documentation
Create Customs Surtax System
Create a fully functional application and database
 for CBSA Steel Derivative Goods Surtax Order PC Number: 2025-0917 
 on 2025-12-11 and annexed Steel Derivative Goods Surtax Order 
 under subsection 53(2) and paragraph 79(a) of the 
 Customs Tariff program code 25267A to calculate duties and taxes 
 including provincial sales tax or HST where applicable when 
 hs codes, country of origin, customs value, and province code and ship date >= '2025-12-26' 
 and create runnable ui with examples from Germany, US, Japan and China" 
 this prompt created the tables in db.sqlite.

 

To use subsystem creation:

  1. Create a project from the pre-supplied small starter database provided in the Manager:
Create the starter database project
genai-logic create  --project_name=customs_app --db_url=sqlite:///samples/dbs/starter.sqlite
  1. In the created project, enter the prompt above.

For more information, click here.

 

What gets created

The key files that drive execution are described below. Note they are models - instead of lengthy generated code (what), they are Python declarations of how.

 

1. Data Model Classes

The Data Model Classes enable SQLAlchemy database operations for the system and your custom code. They are created automatically on project creation.

See rebuild for more information.

The system also creates a database diagram.

2. API

The JSON:API is driven by the model classes, so is very short.

3. Admin App

The Admin App is also a model (not extensive html and javascript), expressed in yaml.

 

Project Structure

When you create an ApiLogicProject, the system creates a project like this that you customize in your IDE:

gen-proj

Explore the Tutorial Project, and observe that the projects are rather small. That is because the system creates models that define what, not now. Explore the project and you will find it easy to understand the API, data model, app and logic files.

Note the entire project is file-based, which makes it easy to perform typical project functions such as source control, diff, merge, code reviews etc.

 

When you create an ApiLogicProject, the system creates a project like this, pre-configured for Developer Oprations. See the notes below.

devops

 

1. Dev Container

You can customize projects using a local install, or a container (see the Install Guide). Container support includes the .devcontainer folder, and the devops/docker/ForVSCode.dockerfile. You should not need to alter these.

In addition to desktop-based development, these enable Codespaces support (see the Express Eval).

 

2. Deployment Container

A common approach to deployment is to create a container for your project. The build-container.dockerfile is created for this purpose.

You will need to edit it to reflect your project and Docker account names.

 

3. Launch Configurations

These are created so you can run the API Logic Server, run tests, etc. You should not need to modify these, but you may wish to extend them.

Note the file that starts the project is api_logic_server_run.py, which obtains arguments from conf/config.py and environmental variables.

 

4. Python venv

The creation process builds a standard requirements.txt file. You can create your venv with this, and (if your IDE does not provide it) the venv.sh/ps1 files to initialize your venv.

 

5. GitHub

Your project includes a suggested .gitignore file (alter as desired). You can use git in standard ways to push and pull changes. Some IDEs support the initial GitHub creation (see VSCode publish, or you can use the git_push_new_project.sh file.

 

6. Configuration, env variables

Most deployment procedures discourage database names / passwords to be in project files and GitHub, instead preferring to specify these via env variables; click here for more information

 

IDE Friendly

The project structure above can be loaded into any IDE for code editing, debugging, etc. For more information on using IDEs, see here.

 

Tool-friendly - file-based

All project elements are files - no database or binary objects. So, you can store objects in source control systems like git, diff/merge them, etc.

 

Customizing ApiLogicProjects

You will typically want to customize and extend the created project. Edit the files noted ih the diagram at the top of this page.

Projects are created from a system-supplied prototype. You can use your own prototype from git (or a local directory) using the from_git parameter.

Architecture

The resultant projects operates as a (typically containerized) 3-tiered architecture, as described here.

ApiLogicServer CLI

API Logic Server consists of a CLI and various runtimes, as described here. The commands on this page (ApiLogicServer create etc) are part of the ApiLogicServer CLI.

The CLI operates in a standard way. Consider the following command:

ApiLogicServer create --project-name=my-project --db-url=sqlite3-url
  1. create is a command; discover the commands with ApiLogicServer
  2. --project-name is an option; discover the options with ApiLogicServer create --help

Note: as of release 10.3.45, you can use the abbreviation als instead of ApiLogicServer