Skip to content

Architecture

Stefan Crkvenjakov edited this page Oct 7, 2026 · 3 revisions

Framework Architecture

Home · Framework philosophy · Framework Internals

AWT is built around a small framework core and application packages. The core provides common tools, while packages use those tools to give an application its features.

The main parts

Part What it does
Framework core Provides routing, database access, rendering, events and storage.
Packages Contain application features, including their routes, controllers, views and services.
Runtimes Prepare a package's components during startup and connect them to the framework.
Routes Connect URLs and HTTP methods to controller actions.
Controllers Handle requests and coordinate the work needed to produce a result.
Models and repositories Read and write application data through the database tools.
Views and responses Produce HTML pages or return results such as JSON, files and redirects.

A small application can live in one package. A larger application can use several packages, each responsible for a feature such as a catalogue, customer enquiries or administration.

How startup works

When a web request arrives, the framework loads its configuration and prepares its shared services. It reads the installed package records and prepares enabled packages that provide executable runtimes.

The framework checks package dependencies and runs required packages first. Each runtime goes through three stages:

Environment setup → Setup → Main

These stages let a package declare its needs, prepare its components and register its behavior. A package can use a linker runtime to connect smaller runtime components, such as separate controller and router registrations.

Once package startup is complete, the framework collects the registered routes and handles the request. Ordinary web requests repeat this startup; it is not a permanent background server.

How a request becomes a response

flowchart TD
    Request[Incoming web request] --> Startup[Framework and package startup]
    Startup --> Route[Find a matching route]
    Route --> Checks[Check HTTP method and CSRF protection]
    Checks --> Middleware[Run route middleware]
    Middleware --> Controller[Load controller and call its action]
    Controller --> Data[Use services, models or repositories as needed]
    Data --> Result[Return a result]
    Result --> View[View: render HTML]
    Result --> Response[Response: send data or a file]
    Result --> Redirect[Redirect: send a destination]
Loading

For example, a request to /catalogue matches a route. Its controller retrieves product data and returns a view. The view renders that data into the HTML sent to the browser.

A request for an API endpoint follows the same route and controller steps, but can return a JSON response instead. If no route matches, the framework returns a not-found response. Request protection can also stop execution before the controller runs.

How packages cooperate

Packages declare dependencies when they require another package. They can communicate through events, publish shared objects, or retrieve an executed runtime that has been made passable.

An event announces something that happened. A shared object makes a service or value available to another component. A passable runtime exposes capabilities such as registered controllers. These objects are available within the current request or CLI process; they are not automatically saved between requests.

Where application code belongs

Application behavior belongs in awt_packages/. Framework code lives in awt_src/, startup wiring lives in bootstrap/, and the web entry point lives in public/. Runtime data, configuration and storage live under awt_data/.

An AWT CMS or standalone application uses this same foundation. Its pages and features come from application packages; installing the framework alone does not create a complete CMS.

For a practical example, follow Your first package. Read Runtimes and Routing and controllers for the development APIs, or Framework Internals for detailed implementation references.

Clone this wiki locally