ApiLogicServer/ApiLogicServer-src
Sobre
Create an executable project (API and Admin App) from a database or natural language prompt with 1 command, customize with declarative rules and Python in your IDE, containerize and deploy.
Dados e análiseCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalGenAI-Logic (API Logic Server)
One prompt — or your existing database — builds a working API and Admin App, then you declare business logic in 5 readable rules instead of 200 lines of AI-generated code, governed by no-bypass rules: those rules run at one commit point, no matter which path the transaction came in on — API, MCP, agent, Kafka.
It reads whatever form your requirements are already in — plain English, Gherkin, actual regulation text — or, you can request an interview to discover the requirements.
And it fits what you already use: your methodology, standard tools, and shared artifacts, fostering collaboration between Business Users and Developers. On opening the project (or using Codespaces, below), the readme provides a First Time tour — you'll see the enforcement yourself in a few minutes. And you're not reading alone: your AI assistant is a partner throughout. Ask it anything — architecture, rules, debugging, deployment, or how the system works.
In short
AI is remarkable at generating code, but hard to govern:
- the requirements are incomplete, and AI fills the gaps with guesses you never see;
- the generated code is hard to read and trust;
- and you still need to prove it does what you asked: testing is the new bottleneck.
The answer: context engineering directs AI to translate requirements into rules, not code. So you can:
- See the guesses: AI flags every assumption it made for review, and leaves a
FIXMEwhere there is no safe default. - Read and trust the rules: 40x more concise than code, and enforced by the engine at commit, on every transaction from every source. No bypass.
- Prove the rules ran: generated tests run, and the traceability report shows each requirement, its rules, and the logs of them firing.

Two funnels, meeting at the rules: any form of intent becomes rules; every transaction source is governed by them, at commit; and the same rules drive the governance reports.
See every claim in one system: the EAI sample was built by AI from six requirements: rules, a B2B API, Kafka in and out, security, and a dashboard. Its judgment calls, rules and traceability report are the evidence. More in the Architecture Brief.
See it work — no install
This opens a ready-to-go Manager workspace in your browser — no local Python, no clone, nothing to install. Inside, the README walks you through a short guided demo: one prompt creates a real project, you trigger a business rule, then open the 200-line procedural version side-by-side with the 5-line declarative version that replaces it.
If you'd rather work locally, see Quick Start below.
Three business uses
Rules apply to any transactional system, so the question is which business problem you are solving:
- New initiatives: prototype in minutes, and keep it. From a business idea, a backlog item, or an AI interview, a running prototype takes 10-20 minutes, with test data and a UI. Business users vet real logic on real transactions, and the prototype is the architecture you iterate into production, not a throw-away.
- Modernization: recover the logic, don't port the code. AI recovers the requirements from the legacy system, GenAI-Logic rebuilds them as rules you can read, and a person reviews the judgment calls the AI recorded. Run on a real open-source ERP we did not write.
- Regulated systems: prove compliance. Requirements come from your compliance specs, or AI reads the regulations directly. The result is an executed record you can hand an auditor. Examples: Customs CLVS and Customs Surtax.
⚡ Quick Start (local install)
# Install (Python 3.10-3.13)
python -m venv venv # windows: python -m venv venv
source venv/bin/activate # windows: venv\Scripts\activate
python -m pip install ApiLogicServer
# Start the Manager (opens readme with instructions)
genai-logic start
# Create project from your database (or use sample)
genai-logic create --project_name=my_app --db_url=sqlite:///samples/dbs/basic_demo.sqlite
# Run it
cd my_app
python api_logic_server_run.py
What's in the generated project:
- JSON:API — endpoints for every table, with filtering, sorting, pagination, related data
- Admin App — multi-page React UI with automatic joins, runs immediately
- Logic Engine — declarative rules (5 lines instead of 200) enforced on every write path, from every caller
- Security — row-level authorization, JWT authentication
- Custom UIs — use the same API with vibe tools (Cursor, Bolt, Lovable) or GenAI-Logic's own Copilot training
- Docker-ready — pre-configured containers for deployment
📖 8-minute video demo | 📚 Full Documentation | 🏠 Home
Why rules instead of code
| Without rules | With GenAI-Logic | |
|---|---|---|
| Creating API endpoints | Days to weeks | Seconds, automated |
| Multi-table update logic | 200+ lines of procedural code, easy to miss a change path | 5 declarative rules — see the A/B comparison |
| Screen building | Manual, or proprietary low-code | Automated from the data model, plus vibe-tool custom UIs |
| System integration | Custom glue code per consumer | MCP-discoverable APIs out of the box |
| Auditing what the logic does | Reading procedural code | Reading the rules — they're the documentation |
Rules are declarative: declared once, auto-invoked at every commit from every caller, auto-ordered by the engine. You don't call them, so they can't be forgotten or bypassed — every write, from any path (API, custom endpoint, Kafka consumer, agent), goes through the same commit-time enforcement. No second door.
This isn't new theory — it's the same paradigm (Val Huber, co-inventor with Ron Ross) from Wang Labs PACE and Versata, validated across 6,000+ production deployments over 40 years, now open source and rebuilt for Python/React.
Governance: review, and proof

AI output doesn't verify itself. Tests are generated from the rules, one feature per requirement, covering each change path a rule implies (for a sum: insert, update, delete, and moving a row to a different parent). The Requirements Traceability Report built from that run is an executed record you can hand an auditor, and it states what it does not cover.
The same rules also produce logic flow diagrams, a health check, and an ontology. More on governance →
When to use it
Good fit — data-centric business applications where the complexity is in multi-table calculations, constraints, and derivations:
- Application integration — instant APIs for legacy databases, modernization without a rewrite
- Rapid prototyping — a working backend in minutes
- GenAI backends — natural language → working microservice
- Backoffice / admin apps, CRUD-heavy systems (orders, inventory, customers)
- Microservice decomposition of a monolith
Not the right tool — real-time streaming (use Kafka/Flink), ML pipelines, low-level systems programming, document/content management, or simple static sites. GenAI-Logic can still be the backend in a hybrid architecture for these.
FAQ
How is this different from low-code platforms (Retool, OutSystems, Hasura)? It generates standard Python projects you own, extend, and deploy — not a proprietary screen-painter. Unlike plain API generators, it includes multi-table logic automation. Detailed comparison →
Is this vendor lock-in? The stack is standard (Python, Flask, SQLAlchemy), and the rules engine (LogicBank) is open source; projects are plain files you own. Rules are written against LogicBank's API, though: leaving means re-expressing them as procedural code, the code they replaced. License: Apache 2.0 + Commons Clause (free for internal use).
Can I customize the generated app? Yes. Override the UI, extend the API, add your own logic — standard Python and SQLAlchemy, any vibe tool. The generated project is a starting point, not a black box. You can also extend the automation itself: new rule types, your organization's project template, your own training files. Ask your AI assistant "how do I customize or extend this?", or see Customize and Extend →
What happens when logic doesn't fit the declarative model? The engine handles the large majority of typical business logic (calculations, validations, cascading updates). For workflows, state machines, or external integrations, you write standard Python event handlers that coexist with the rules — the engine calls your code at the right time.
How long until a team is productive? Rules can be written immediately in natural language; the DSL itself is intuitive. Understanding the engine's optimization strategy (pruning, chaining) takes a few days. Most teams are productive within a week.
Where do I get help? Discord for real-time help, GitHub Discussions, or the full documentation.
Architecture
┌─────────────────────────────────────────────┐
│ Natural Language Prompt or Existing DB │
└───────────────┬─────────────────────────────┘
│ genai-logic create
↓
┌─────────────────────────────────────────────┐
│ Generated Project │
├─────────────────────────────────────────────┤
│ Admin App (React) │
│ JSON:API (SAFRS) │
│ Logic (Rules Engine) │
│ ORM (SQLAlchemy) │
│ Security (JWT + Row-level) │
└─────────────────────────────────────────────┘
│
↓
Docker Container
Stack: Python 3.10-3.13, Flask + SQLAlchemy, React + Material-UI, Docker.
What gets created:
my_app/
├── api/ # JSON:API endpoints (Admin App AND custom UIs)
│ ├── expose_api_models.py
│ └── customize_api.py # custom endpoints
├── ui/admin/ # instant Admin App
│ └── admin.yaml
├── logic/ # business logic, enforced on every write
│ └── logic_discovery/ # rules, one file per use case
├── security/
│ └── declare_security.py
├── database/
│ └── models.py
├── tests/ # BDD tests (Behave)
├── docs/training/ # training for your AI assistant (Copilot, Claude)
└── devops/docker/
Create from requirements
In the Manager, give your AI assistant (Copilot, Claude, ...) a prompt like this, in plain English:
Create a system for customers, orders, items and products.
Customer balance is sum of unshipped order totals.
Order total is sum of item amounts.
Item amount is quantity * unit price.
Copy product price to item unit price.
Constraint: customer balance cannot exceed credit limit.
The assistant creates the project, the database, the API and Admin App, and the 5 rules that enforce the credit check. It can also interview you to discover the requirements, or read Gherkin or regulation text.
Every created project also includes AI tutoring: open it and your Copilot/Claude assistant explains what's built and what to do next (.github/copilot-instructions.md), backed by training material in docs/training/. Ask it to translate a new requirement and it writes the rules, not procedural code, because that training tells it to.
Living documentation: ask the assistant to create tests, and it generates Behave tests from your declared rules; running them produces a report tracing requirement → test → rule → execution — so the rules stay the source of truth, not a Word doc that drifts.
🎬 Video Overview (8 min)
Examples and Samples
| Sample | Description | Database |
|---|---|---|
| basic_demo | Check credit rules, Behave testing | SQLite (Northwind) |
| genai_demo | Created from natural language | SQLite |
| classicmodels | Sales, employees, offices | MySQL |
| chinook | Music store (artists, albums, tracks) | SQLite/PostgreSQL |
| postgres-nw | Northwind on PostgreSQL | PostgreSQL |
| sqlserver | Adventure Works | SQL Server |
Supported Databases
SQLite, PostgreSQL, MySQL/MariaDB, SQL Server, Oracle, and any other SQLAlchemy-supported database.
Security
Authentication (SQL-based, Keycloak, or custom providers), role-based authorization with row-level filtering, multi-tenant global filters, JWT tokens, Swagger-integrated security docs. Security Overview →
Contributing
| Area | Current | Ideas for contribution |
|---|---|---|
| API | JSON:API, Swagger | GraphQL, gRPC |
| Deployment | Docker, Azure | AWS (ECS/Lambda), Kubernetes/Helm |
| Logic | Rules engine | Additional rule types, performance tuning |
| UI | Admin App (React) | Custom UI frameworks, mobile SDK |
| GenAI | Your AI assistant + training files, WebGenAI | Enhanced natural language understanding |
Developing API Logic Server itself:
git clone https://github.com/ApiLogicServer/ApiLogicServer-src.git
cd ApiLogicServer-src
python -m pip install -r requirements.txt
python test/build_and_test.py
Documentation
- Full Documentation
- Architecture Brief — for architects and evaluators
- Quick Start Tutorial (20 minutes)
- Logic: Why — the case for declarative logic
- Logic Documentation — rule types and patterns
- API Self-Serve — consumer-driven APIs
- Security Guide
- Behave Testing
- Executable Requirements — requirements in, rules out
- Modernization — recover the logic from legacy systems
- Integration Patterns — Kafka, B2B, MCP
- Database Changes
- Deployment
- Architecture
- Issue Tracker
Background
The declarative rules paradigm here has 40+ years of production history:
- Wang Labs PACE (1980s-90s) — Val Huber co-invented the paradigm with Ron Ross; 6,000+ production deployments on minicomputers and Visual Basic.
- Versata (1990s-2010s) — Val Huber as CTO; evolved the engine for J2EE; Fortune 500 customers; $3.4B company (IPO: VSTA).
- API Logic Server / GenAI-Logic (2020-present) — Val Huber, architect and lead developer; modern Python/React, open source, combined with GenAI for natural-language logic authoring.
In-depth context, written by Val Huber on Medium:
| Article | Topic |
|---|---|
| Welcome to GenAI-Logic | Vision and overview — start here |
| Declarative GenAI Architecture | NL → DSL → Engines, the FrankenCode problem, FAQ |
| Declarative Logic: Living in a Procedural World | How declarative rules work inside Python |
| Living With Logic in the Enterprise | Debugging, testing, performance, real deployments |
| Business User / IT Collaboration | Logic as a contract between business and IT |
| Vibe an MCP Server | Creating MCP-enabled services |
| Probabilistic and Deterministic Logic | AI at runtime + deterministic rules |
| Enterprise Vibe Automation | Full-stack automation from prompts |
Connect
- Home: genai-logic.com
- Discord: Join the community
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Docs: apilogicserver.github.io/Docs
- Blog: Medium
Acknowledgments
Built on Flask, SQLAlchemy, SAFRS, React, Material-UI, and Behave — and on the work of Val Huber and Ron Ross in originating the declarative rules paradigm at Wang Labs PACE, carried forward at Versata. Thanks to everyone who's filed issues, sent PRs, and given feedback.
License
Apache 2.0 with the Commons Clause — see LICENSE.
⭐ Star this repo if you find it useful.
Explore projetos relacionados
Carregando…
