Skip to main content

No project description provided

Project description

API Logic Server

Downloads Latest Version Supported Python versions

Create instant microservices from your database or natural language prompt - working API + Admin App + Logic in 5 seconds, with 40X code reduction through declarative rules.

Create instant microservices (MCP-enabled API + Admin App + Business Logic) from your database or a natural language prompt:

ApiLogicServer create --project_name=my_app --db_url=mysql://...

API Logic Server Architecture


โšก Quick Start (2 minutes)

# 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=

# Run it
cd my_app
python api_logic_server_run.py

What you get in 5 seconds:

  • ๐Ÿš€ JSON:API - Endpoints for every table with filtering, pagination, related data
  • ๐Ÿ“ฑ Instant Admin App UI - Multi-page React app with automatic joins (runs immediately)
  • ๐ŸŽจ Custom Apps via API - Use the API with your favorite vibe tools (Cursor, Bolt, Lovable, etc.) OR leverage GenAI-Logic training for Copilot to build custom UIs (see this article)
  • ๐Ÿง  Logic Engine - Spreadsheet-like rules (40X more concise than code)
  • ๐Ÿ” Security - Row-level authorization, JWT authentication
  • ๐Ÿณ Docker-ready - Pre-configured containers for deployment

Mix and match: Use the instant Admin App for backoffice tasks AND build custom UIs with vibe tools for advanced features like cards and maps - all powered by the same logic-enabled API.

๐Ÿ“– 8-minute video demo | ๐Ÿ“š Full Documentation | ๐Ÿ  Home


๐ŸŽฏ Why API Logic Server?

Built on 40+ years of proven technology (Wang PACE โ†’ Versata โ†’ API Logic Server):

  • 6,000+ production deployments validated the declarative approach
  • Fortune 500 companies relied on this architecture for mission-critical systems
  • Now open source and modernized for cloud-native Python/React stack

The Problem It Solves

Traditional Approach API Logic Server
Weeks to create API endpoints 5 seconds (automated)
200+ lines of update logic code 5 rules (40X reduction - to see an A/B Comparision, click here
Manual screen painting Automated from data model, plus vibe-enabled custom UIs
Hard to integrate systems MCP-enabled APIs
Opaque procedural code Declarative living documentation

๐Ÿ’ก When to Use API Logic Server

โœ… Ideal Use Cases

API Logic Server excels at data-centric business applications where the complexity is in multi-table calculations, constraints, and derivations:

  • ๐Ÿ”Œ Application Integration - Instant APIs for legacy databases (modernization without rewrite)
  • โšก Rapid Prototyping - Working backend in minutes for validation
  • ๐Ÿค– GenAI Backends - Natural language โ†’ working microservice
  • ๐Ÿข Backoffice Apps - Admin dashboards for data maintenance
  • ๐Ÿ”— Microservices - Decompose monoliths with instant services
  • ๐Ÿ“Š Business Rule Automation - Complex calculations, cascading updates, constraint checking
  • ๐Ÿ”„ CRUD-Heavy Applications - Order management, inventory, customer systems
  • ๐Ÿ›๏ธ Legacy Modernization - MCP-enable existing databases, create modern API layer while legacy apps continue running

Sweet Spot: Applications where business logic complexity >> UI complexity

โš ๏ธ Not Recommended For

API Logic Server is optimized for data-centric business logic, but less suited for:

  • Real-time streaming systems - Use Kafka/Flink for high-throughput event processing
  • Complex UI/UX interactions - Works great as the backend, but not a UI framework
  • Machine learning pipelines - Use TensorFlow/PyTorch for ML workflows
  • Low-level system programming - Traditional languages better suited
  • Document/content management - Use specialized CMS platforms
  • Simple static websites - Overkill for basic content delivery

For these scenarios, traditional approaches are more appropriate. API Logic Server can still serve as the backend for hybrid architectures.


โ“ Frequently Asked Questions

Q: How is this different from low-code platforms (Retool, OutSystems, Hasura)?

A: Unlike pure low-code platforms, API Logic Server generates standard Python projects you own, extend and deploy. Screen creation is by vibe tools rather than screen painting. Unlike API generators, it includes sophisticated multi-table logic automation (40X code reduction). Read detailed comparison โ†’

Q: Isn't this just vendor lock-in?

A: It's free and open source. The declarative rules sit on top of standard (readable, version-controlled) Python โ€” you can always drop down to procedural code. If you ever need to migrate away, you can either keep using the rules engine (it's just a library) or replace declarative rules with equivalent procedural code using standard SQLAlchemy events.

Q: Can I customize the generated app?

A: Absolutely. You can override the UI, extend APIs, and plug in your own logic โ€” using standard Python, SQLAlchemy, and any Vibe tool. The generated project is a starting point, not a black box. See customization patterns โ†’

Q: What happens when logic doesn't fit the declarative model?

A: The declarative engine handles over 95% of typical business logic (calculations, validations, cascading updates). For complex workflows, state machines, or external integrations, you write standard Python event handlers that coexist with declarative rules. The engine calls your code at the right time โ€” no conflict, full extensibility.

Q: How long does it take developers to become productive?

A: Developers can start writing rules immediately using natural language, and the DSL syntax is intuitive. Understanding the engine's optimization strategies (pruning, chaining) takes a few days of practice. Most teams are fully productive within a week.

Q: What if I have questions or need help?

A: Join our Discord community for real-time help, check GitHub Discussions, or browse the comprehensive documentation.

โ†’ More FAQs in detailed article


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Natural Language Prompt or Existing DB     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚ ApiLogicServer create
                โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Generated Project                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ“ฑ Admin App (React)                       โ”‚
โ”‚  ๐Ÿ”Œ JSON:API (SAFRS)                        โ”‚
โ”‚  ๐Ÿง  Logic (Rules Engine)                    โ”‚
โ”‚  ๐Ÿ’พ ORM (SQLAlchemy)                        โ”‚
โ”‚  ๐Ÿ” Security (JWT + Row-level)              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
                โ†“
        ๐Ÿณ Docker Container

Technology Stack:

  • Python 3.10-3.13
  • Flask + SQLAlchemy
  • React + Material-UI
  • Docker + Docker Compose

๐Ÿ“ฆ What Gets Created

my_app/
โ”œโ”€โ”€ api/                    # JSON:API endpoints (for Admin App AND custom UIs)
โ”‚   โ”œโ”€โ”€ expose_api_models.py
โ”‚   โ””โ”€โ”€ customize_api.py    # Add custom endpoints
โ”œโ”€โ”€ ui/admin/              # Instant Admin App (ready to run)
โ”‚   โ””โ”€โ”€ admin.yaml         # Declare UI behavior
โ”œโ”€โ”€ logic/                 # Business Logic (enforced on ALL API calls)
โ”‚   โ””โ”€โ”€ declare_logic.py   # Spreadsheet-like rules
โ”œโ”€โ”€ security/              # Authentication & Authorization
โ”‚   โ””โ”€โ”€ declare_security.py
โ”œโ”€โ”€ database/              # SQLAlchemy models
โ”‚   โ””โ”€โ”€ models.py
โ”œโ”€โ”€ tests/                 # BDD tests (Behave)
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ training/          # GenAI-Logic training for Copilot
โ””โ”€โ”€ devops/
    โ””โ”€โ”€ docker/            # Deployment configs

Two UI approaches (use both!):

  1. Instant Admin App - Runs immediately for backoffice/internal users
  2. Custom UIs - Build with vibe tools (Cursor, Bolt, etc.) OR use GenAI-Logic Copilot training to create React/Vue/Angular apps that consume the API

๐Ÿš€ Key Features

1๏ธโƒฃ Declarative Logic (40X More Concise)

Before (200+ lines of Python):

# Manual cascade updates, balance calculations, constraint checking...
# Complex dependency tracking, old_row comparisons...
# Missed corner cases: reassign order, change quantity, delete order...
# (Imagine 200 lines of procedural code here)

After (5 declarative rules):

Rule.constraint(derive=Customer.Balance <= Customer.CreditLimit)
Rule.sum(derive=Customer.Balance, as_sum_of=Order.AmountTotal, 
         where=lambda row: row.ShippedDate is None)
Rule.sum(derive=Order.AmountTotal, as_sum_of=OrderDetail.Amount)
Rule.formula(derive=OrderDetail.Amount, 
             as_expression=lambda row: row.Quantity * row.UnitPrice)
Rule.copy(derive=OrderDetail.UnitPrice, from_parent=Product.UnitPrice)

Rules automatically handle all dependencies:

  • โœ… Chain up (OrderDetail โ†’ Order โ†’ Customer)
  • โœ… Chain down (Product price change cascades)
  • โœ… Old row comparisons (moved orders adjust both customers)
  • โœ… All 9 use cases (add, update, delete, reassign...)

2๏ธโƒฃ Self-Serve APIs

Consumers select their own attributes and related data - no custom API development required:

# Get customer with orders and order details
GET /api/Customer/ALFKI?include=OrderList,OrderList.OrderDetailList&fields[Customer]=CompanyName,Balance

# Filter and sort
GET /api/Customer?filter[Balance][$gt]=1000&sort=-Balance&page[size]=10

Features:

  • Filtering, sorting, pagination
  • Related data (automatic joins)
  • Optimistic locking
  • Swagger documentation
  • Logic enforcement on all updates

3๏ธโƒฃ GenAI Integration

Create from Natural Language

genai-logic genai --using=prompt.txt

Example prompt:

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.

Result: Working microservice with logic in 10 seconds!

AI-Assisted Development

Every created project includes AI tutoring to help you get oriented and productive quickly:

  • ๐Ÿค– Copilot instructions (.copilot-instructions.md) - When you open a project, Copilot presents a friendly welcome message explaining what's already built and what you can do next. Ask Copilot to "read instructions" anytime for guidance.
  • ๐Ÿ“š Training materials (docs/training/) - Comprehensive guides for all features
  • ๐Ÿ” Logic from natural language (translate English โ†’ rules)
# Paste into Copilot: "Create logic for check credit"
# Copilot generates the 5 rules above!

4๏ธโƒฃ Living Documentation

Automated test generation from your rules:

# Generate Behave tests from declared logic
genai-logic add-tests

# Run tests
behave

# Generate documentation
python behave_logic_report.py

Output: Complete traceability from requirements โ†’ tests โ†’ rules โ†’ execution trace.


๐ŸŽฌ Video Overview (8 min)

See how Microservice Automation creates and runs a microservice - a multi-page app and an API:

GenAI Automation


๐Ÿค Contributing

We welcome contributions! Areas of interest:

Area Current Ideas for Contribution
API JSON:API, Swagger GraphQL, gRPC support
Deployment Docker, Azure AWS (ECS/Lambda), Kubernetes/Helm charts
Logic Rules engine Additional rule types, performance tuning
UI Admin App (React) Custom UI frameworks, mobile SDK
GenAI Web version, CLI Enhanced natural language understanding

See issues for current requests.

Development Setup

For development (extending API Logic Server itself):

# Clone and install dev version
git clone https://github.com/ApiLogicServer/ApiLogicServer-src.git
cd ApiLogicServer-src

# Install dependencies
python -m pip install -r requirements.txt

# Run build/test automation
python test/build_and_test.py

See dev installation docs for complete setup.


๐Ÿ“š Documentation


๐Ÿ“– Key Documentation Pages

Getting Started

Core Concepts

Advanced Topics


๐ŸŒŸ Examples and Samples

See all sample projects

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

๐Ÿ† Technology Lineage

API Logic Server builds on proven technology with 40+ years of production validation:

Wang Labs PACE (1980s-1990s)

  • Inventor: Val Huber (Designer and Co-inventor with Ron Ross of declarative rules)
  • Scale: 6,000+ production deployments
  • Innovation: First commercial declarative business rules system
  • Platform: Minicomputers โ†’ Visual Basic

Versata (1990s-2010s)

  • Leadership: Val Huber (CTO)
  • Customers: Fortune 500 companies
  • Scale: $3.4 billion company (IPO: VSTA)
  • Innovation: Evolved rules for J2EE enterprise applications
  • Platform: Java Enterprise Edition

API Logic Server (2020-present)

  • Leadership: Val Huber (Architect and Lead Developer)
  • Innovation: Modern cloud-native Python/React implementation
  • Platform: Open source, Docker, microservices architecture
  • Unique: Combined with GenAI for natural language logic

The same declarative rules paradigm, proven at scale, now open source and AI-enhanced.


๐Ÿ“Š Comparison: Frameworks vs Low Code vs API Logic Server

Aspect Frameworks
(Django, Flask)
Low Code
(Retool, Appsmith)
API Logic Server
API Creation Manual (weeks) Limited/proprietary โœ… Automated (5 sec)
Logic Automation โŒ Manual code โŒ Limited โœ… Rules (40X)
App Automation โŒ Manual โœ… GUI builder โœ… From data model
Customization โœ… Full Python โš ๏ธ Proprietary โœ… Python + Rules
IDE โœ… Standard tools โŒ Proprietary โœ… VSCode, PyCharm
Deployment โœ… Any platform โš ๏ธ Vendor lock-in โœ… Docker, any cloud
GenAI Integration โŒ None โš ๏ธ Limited โœ… Full (DB + Logic)
Testing Manual Limited โœ… Auto-generated

๐Ÿ’พ Supported Databases

  • SQLite (included samples)
  • PostgreSQL
  • MySQL / MariaDB
  • SQL Server
  • Oracle
  • Any SQLAlchemy-supported database

๐Ÿ” Security Features

  • Authentication: SQL-based, Keycloak, or custom providers
  • Authorization: Role-based grants with row-level filtering
  • Multi-tenant: Global filters based on user attributes
  • JWT Tokens: Standard authentication flow
  • Swagger Security: Integrated with API documentation

See Security Overview


๐Ÿ“„ License

MIT License - see LICENSE file


๐Ÿ™ Acknowledgments

Built on the shoulders of giants:

Technology Pioneers:

  • Wang Labs PACE (1980s) - Original declarative rules concept (Val Huber, designer/co-inventor)
  • Versata (1990s-2010s) - $3.4B company, Fortune 500 deployments (Val Huber, CTO)
  • Ron Ross - Co-inventor of declarative rules paradigm

Open Source Foundation:

  • Flask - Web framework
  • SQLAlchemy - ORM layer
  • SAFRS - JSON:API implementation
  • React - Admin App UI
  • Material-UI - Component library
  • Behave - BDD testing framework

Community:

  • All contributors who have submitted issues, PRs, and feedback
  • The Python and React ecosystems

๐Ÿ“ In-Depth Articles

These Medium articles provide comprehensive context on architecture, use cases, and the reasoning behind API Logic Server:

Article Topic Key Insights
Welcome to GenAI-Logic Vision & Overview Big picture: Does GenAI deliver business agility? Start here for context.
Declarative GenAI Architecture Technical Deep Dive NL โ†’ DSL โ†’ Engines pattern, FrankenCode problem, includes FAQ section
Declarative Logic: Living in a Procedural World Architecture Philosophy How declarative rules work in Python, the paradox resolved
Living With Logic in the Enterprise Production Patterns Debugging, testing, performance, customization in real deployments
Business User / IT Collaboration Team Dynamics How logic acts as a contract between business and IT
Vibe an MCP Server MCP Integration Creating MCP-enabled services with natural language
Probabilistic and Deterministic Logic AI + Rules Engineering reliability into agentic systems (AI at runtime + rules)
Enterprise Vibe Automation GenAI Workflows Full-stack automation from prompts

These articles represent significant research and real-world experience - they address common questions, architectural decisions, and lessons learned from 40+ years of declarative technology evolution.


๐Ÿ“ž Connect

๐Ÿ“– Recommended Reading

Start with the welcome article to understand the vision and architecture:


โญ Star this repo if you find it useful!

Made with โค๏ธ by the API Logic Server team

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apilogicserver-15.4.1.tar.gz (45.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apilogicserver-15.4.1-py3-none-any.whl (47.1 MB view details)

Uploaded Python 3

File details

Details for the file apilogicserver-15.4.1.tar.gz.

File metadata

  • Download URL: apilogicserver-15.4.1.tar.gz
  • Upload date:
  • Size: 45.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for apilogicserver-15.4.1.tar.gz
Algorithm Hash digest
SHA256 588d71bc8ac00b68744911acd95778f748a9bbc1d33a5305dde03425414418e9
MD5 6d0b00c6a6aa22b32a0c3ca4cff2ad32
BLAKE2b-256 4109b28678d9d0f693dc07102c09a8a3451ba33040f0fdc9832c096c6a11bc65

See more details on using hashes here.

File details

Details for the file apilogicserver-15.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for apilogicserver-15.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8141a65a3567b564d0ecf84bc4a349dd3a5d37e4629e4a898072804c62279d02
MD5 2e253955eba9d2cf5af8fdcff0d946ed
BLAKE2b-256 2eb5cc3f1088343ff0f8fadb378e7b390bcaddfde5c54350814fd1977835d5a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page