Skip to content

ApiLogicServer/template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick Start

What is API Logic Server

 

API Logic Server creates customizable database web app projects:

  • Creation is Instant: create projects with a single command. Projects are Highly Functional, providing:

    • API: an endpoint for each table, with filtering, sorting, pagination and related data access

    • Admin UI: multi-page / multi-table apps, with page navigations, automatic joins and declarative hide/show

  • Projects are Customizable, using your IDE: such as VSCode, PyCharm, etc, for familiar edit/debug services

  • Business Logic Automation: using unique spreadsheet-like rules, extensible with Python 🏆

 

Why Does It Matter: Faster, Simpler, Modern Architecture

 

API Logic Server is a low-code, developer-friendly approach that leverages automation to dramatically improve web app development:

  • Automation makes it faster: moments, instead of weeks or months. Unblock UI Dev, and engage business users - early - to reduce misunderstandings. Customize with standard IDEs.

  • Automation makes it simpler: this reduces the risk of architectural errors, e.g., APIs without pagination.

  • Automation ensures a modern software architecture: container-ready, API-based, with shared logic over UIs and APIs (no more logic in UI controllers), in maintainable models.

 

1. Open in Codespaces (Done)

Open this template project in Codespaces.

Show Me How

 

 

1. Use your GitHub account - no additional sign-up required

2. Load the working_software_now project from GitHub

To access this GitHub project with Codespaces

  1. Open this page in a new window, and
  2. Click Open > Codespaces as shown below
  3. You will see an empty project.

These instructions will continue in Codespaces.

 

What Is Happening

You will now see the template project - open in VSCode, in the Browser. But that's just what you see...

Behind the scenes, Codespaces has requisitioned a cloud machine, and loaded the template - with a complete development environment - Python, your dependencies, git, etc.

You are attached to this machine in your Browser, running VSCode.

These instructions are now visible in VS Code, to minimize window switching.

🏆 Pretty remarkable.

 

2. Create a project (Start Here)

Paste this into the Terminal window (lower right):

ApiLogicServer create --project_name=./ --db_url=

When prompted, do not rebuild the container.

What Is Happening

 

This is not a coded application.

The system examined your database (here, the default), and created an executable project:

  • API - an endpoint for each table, with full CRUD services, filtering, sorting, pagination and related data access

  • Admin UI - multi-page / multi-table apps, with page navigations and automatic joins

Projects are Customizable, using your IDE: the Project Explorer shows the project structure. Use the code editor to customize your project, and the debugger to debug it.

Business Logic is Automated: use unique spreadsheet-like rules to declare multi-table derivations and constraints - 40X more concise than code. Extend logic with Python.

Using your own database

 

In this case, we used a default Customers/Orders database. To use your own database, provide the db_url like this.

 

3. Start Server, Admin App

The project is ready to run.

Use the prebuilt Run Configuration to start the server, and the prebuilt Port to start the web app.

Show Me How

As shown below:

  1. Use the default Run Configuration to start the server, and

  2. Click Ports > Globe to start the web app.

 

4. Explore the Tutorial

Open the Tutorial to explore the sample project.

 

Tutorial Overview

The Tutorial will enable you to explore 2 key aspects:

  • Initial Automation - API and UI creation are automated from the data model. So, later, you'd see this level of automation for your own databases.

  • Customization and Debugging - this sample also includes customizations for extending the API and declaring logic, and how to use VSCode to debug these. The Tutorial will clearly identify such pre-built customizations.

 

Extensive product documentation is available here - checkout the FAQs.

 

API Logic Server Background

Motivation

We looked at approaches for building database systems:


Frameworks

Frameworks like Flask or Django enable you to build a single endpoint or Hello World page, but a multi-endpoint API and multi-page application would take weeks or more.


Low Code Tools

These are great for building great UIs, but

  • Want a multi-page app -- without requiring detail layout for each screen
  • Want to preserve standard dev tools - VSCode, PyCharm, git, etc
  • Need an answer for backend logic (it's nearly half the effort)

 

Our Approach: Instant, Standards-based Customization, Logic Automation

API Logic Server is an open source Python project. It runs as a standard Python (pip) install, or under Docker. It consists of:

  • a set of runtimes (api, user interface, data access) for project execution, plus

  • a CLI (Command Language Interface) to create executable projects with a single command

    • Customize your projects in an IDE such as VSCode or PyCharm

💡 API Logic Server reads your schema, and creates an executable, customizable project.

 

Appendices

Here is some background about API Logic Server.

  

Project Information

About Info
Created Nov 7, 2022 07:24:31
API Logic Server Version 6.02.35
Created in directory ../../servers/ApiLogicProject
API Name api

  

Key Technologies

API Logic Server is based on the projects shown below. Consult their documentation for important information.

SARFS JSON:API Server

SAFRS: Python OpenAPI & JSON:API Framework

SAFRS is an acronym for SqlAlchemy Flask-Restful Swagger. The purpose of this framework is to help python developers create a self-documenting JSON API for sqlalchemy database objects and relationships.

These objects are serialized to JSON and created, retrieved, updated and deleted through the JSON API. Optionally, custom resource object methods can be exposed and invoked using JSON.

Class and method descriptions and examples can be provided in yaml syntax in the code comments.

The description is parsed and shown in the swagger web interface. The result is an easy-to-use swagger/OpenAPI and JSON:API compliant API implementation.

LogicBank

Transaction Logic for SQLAlchemy Object Models

Use Logic Bank to govern SQLAlchemy update transaction logic - multi-table derivations, constraints, and actions such as sending mail or messages. Logic consists of both:

  • Rules - 40X more concise using a spreadsheet-like paradigm, and

  • Python - control and extensibility, using standard tools and techniques

Logic Bank is based on SQLAlchemy - it handles before_flush events to enforce your logic. Your logic therefore applies to any SQLAlchemy-based access - JSON:Api, Admin App, etc.

SQLAlchemy

Object Relational Mapping for Python.

SQLAlchemy provides Python-friendly database access for Python.

It is used by JSON:Api, Logic Bank, and the Admin App.

SQLAlchemy processing is based on Python model classes, created automatically by API Logic Server from your database, and saved in the database directory.

Admin App

This generated project also contains a React Admin app:

  • Multi-page - including page transitions to "drill down"
  • Multi-table - master / details (with tab sheets)
  • Intelligent layout - favorite fields first, predictive joins, etc
  • Logic Aware - updates are monitored by business logic

  

Project Structure

This project was created with the following directory structure:

Directory Usage Key Customization File Typical Customization
api JSON:API api/customize_api.py Add new end points / services
database SQLAlchemy Data Model Classes database/customize_models.py Add derived attributes, and relationships missing in the schema
logic Transactional Logic logic/declare_logic.py Declare multi-table derivations, constraints, and events such as send mail / messages
ui Admin App ui/admin/admin.yaml Control field display - order, captions etc.
tests Behave Test Suite tests/api_logic_server_behave/features Declare and implement Behave Tests
 

Key Customization File - Typical Customization

In the table above, the Key Customization Files are created as stubs, intended for you to add customizations that extend the created API, Logic and Web App. Since they are separate files, the project can be rebuilt (e.g., synchronized with a revised schema), preserving your customizations.

Please see the nw sample for examples of typical customizations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published