| data | ||
| essential | ||
| operational | ||
| run | ||
| .gitignore | ||
| CHANGELOG.md | ||
| go.mod | ||
| LICENSE.md | ||
| Makefile | ||
| README.md | ||
API Framework
Description
API Framework is a layered API application framework designed to provide a structured foundation for building maintainable, scalable, and extensible web services.
The framework separates framework capabilities, application capabilities, resource management, request processing, policy enforcement, and runtime execution into clearly defined architectural layers. It provides standardized request handling, response generation, execution pipelines, reusable utility services, and runtime orchestration while maintaining strict ownership boundaries between framework and application components.
The framework supports:
- API request routing
- Request processing
- Response generation
- Policy-driven execution
- Authentication and authorization pipelines
- Rate limiting and validation policies
- Runtime lifecycle management
- Reusable infrastructure services
The architecture is organized into four primary layers:
- Data — Framework and application resources.
- Essential — Reusable framework capabilities and infrastructure.
- Operational — Application-specific business capabilities and policies.
- Run — Runtime initialization, execution, and request processing.
This separation enables developers to focus on application behavior while relying on a consistent framework foundation for API processing, security, policy enforcement, utility services, and runtime coordination.
Purpose
API Framework exists to provide a consistent, maintainable, and extensible architecture for building API-driven applications while establishing clear boundaries between framework responsibilities and application responsibilities.
Objectives
- Establish clear separation of concerns.
- Standardize API request and response processing.
- Distinguish framework-owned and application-owned resources.
- Provide reusable infrastructure and utility capabilities.
- Centralize policy enforcement and access control.
- Simplify application development through a structured architecture.
- Improve maintainability and scalability.
- Enable controlled application extensibility.
- Protect internal framework implementation details.
- Encourage consistent API design and execution patterns.
Design Principles
Layered Architecture
Each architectural layer is responsible for a specific concern and communicates through clearly defined boundaries.
Ownership Separation
Framework-owned capabilities remain separate from application-owned capabilities to prevent implementation leakage and architectural drift.
Extensibility
Applications extend the framework through approved extension surfaces without modifying framework internals.
Reusability
Common functionality is implemented once and reused throughout both framework and application layers.
Encapsulation
Internal framework implementation details remain hidden behind stable interfaces.
Policy-Driven Execution
Request processing and business operations are governed through dedicated execution pipelines and policy enforcement mechanisms.
Consistency
Request handling, response generation, execution patterns, and resource management follow standardized conventions throughout the framework.
Architecture
High-Level Structure
source
├── data
├── essential
├── operational
└── run
The architecture is organized into four primary layers that collectively provide resource management, reusable framework capabilities, application capabilities, policy enforcement, and runtime execution.
Data Layer
The Data Layer stores all framework-owned and application-owned resources.
source/data
├── framework
│ ├── metadata
│ └── glossary
└── application
├── metadata
└── glossary
Responsibilities
- Store framework metadata and configuration resources.
- Store framework glossary and terminology resources.
- Store application metadata and configuration resources.
- Store application glossary and terminology resources.
- Provide centralized resource ownership boundaries.
Ownership
| Area | Owner |
|---|---|
| data/framework | Framework |
| data/application | Application |
Essential Layer
The Essential Layer contains reusable framework capabilities, infrastructure services, request processing capabilities, and shared functionality.
source/essential
├── exchange
├── hidden
└── visible
Essential Exchange
Provides the framework API interaction model.
exchange
├── router
├── request
├── response
└── imperative
Responsibilities
- API request routing.
- Request processing.
- Response generation.
- Imperative execution.
- Framework-level API orchestration.
Essential Hidden
Contains internal framework capabilities that are not intended for application consumption.
hidden
└── service
└── management
Management
Framework runtime management capabilities.
management
├── initialize
├── lifecycle
├── config
├── monitor
└── cleaner
Initialize
Responsible for framework and runtime initialization.
Lifecycle
Responsible for:
- Startup
- Shutdown
- Restart operations
Config
Responsible for runtime configuration management.
Monitor
Responsible for runtime health and operational monitoring.
Cleaner
Responsible for maintenance and cleanup operations.
Responsibilities
- Runtime initialization.
- Lifecycle management.
- Runtime configuration.
- Monitoring and observability.
- Maintenance operations.
Essential Visible
Contains reusable framework capabilities available to applications.
visible
└── service
└── helper
Available helper capabilities include:
retriever
status
log
progress
filesystem
datetime
marker
key
hash
cipher
codec
Responsibilities
- Resource retrieval.
- Status reporting.
- Structured logging.
- Progress tracking.
- Filesystem operations.
- Date and time utilities.
- Identifier generation.
- Key generation.
- Hash calculation and comparison.
- Encryption and decryption.
- Encoding and decoding.
Operational Layer
The Operational Layer contains all application-specific behavior, business capabilities, and policy definitions.
source/operational
├── exchange
├── pipeline
└── service
This is the primary application development area.
Operational Exchange
Provides the application API interaction model.
exchange
├── router
├── request
├── response
└── imperative
Responsibilities
- Application request routing.
- Application request processing.
- Application response generation.
- Imperative execution.
- Application-level API orchestration.
Operational Pipeline
Contains application-defined policy execution capabilities.
pipeline
└── policy
├── validation
└── ratelimit
Validation
Responsible for request validation policies.
Examples:
- Schema validation
- Payload validation
- Business rule validation
Rate Limit
Responsible for request throttling and usage control.
Examples:
- Client limits
- Endpoint limits
- Resource protection
Responsibilities
- Request validation.
- Request throttling.
- Policy definition.
- Application-specific execution controls.
Operational Service
Contains application-specific business capabilities.
service
└── [service]
└── [feature]
Example:
service
├── user
│ ├── create
│ └── delete
├── customer
│ └── register
└── invoice
└── generate
Feature structure:
service
└── user
└── create
├── function.go
└── function-data.json
Responsibilities
- Implement business rules.
- Manage application workflows.
- Execute domain-specific operations.
- Consume reusable framework capabilities.
Runtime Layer
The Runtime Layer initializes, secures, coordinates, and executes API requests.
source/run
├── exchange
├── pipeline
└── main
Runtime Exchange
Receives incoming requests and dispatches execution.
exchange
├── router
├── request
├── response
└── imperative
Responsibilities
- Runtime request handling.
- Request dispatching.
- Response delivery.
- Execution coordination.
Runtime Pipeline
Provides execution-time access control and policy enforcement.
pipeline
├── access
└── policy
Access
Access control pipeline.
access
├── authentication
└── authorization
Authentication
Verifies the identity of the request originator.
Examples:
- API Keys
- JWT Tokens
- Session Authentication
Authorization
Determines whether authenticated entities can access requested resources.
Examples:
- Role-based access control
- Permission-based access control
- Scope validation
Policy
Responsible for runtime policy enforcement.
policy
└── enforce.go
Responsibilities:
- Execute policy decisions.
- Enforce validation outcomes.
- Enforce access decisions.
- Coordinate runtime controls.
Runtime Main
Application bootstrap and startup.
main
└── main.go
Responsibilities
- Framework initialization.
- Application initialization.
- Runtime startup.
- Lifecycle coordination.
- API server bootstrap.
Request Lifecycle
The framework follows a layered request processing model.
Client Request
│
▼
Runtime Exchange
│
▼
Access Pipeline
(Authentication / Authorization)
│
▼
Policy Enforcement
│
▼
Application Exchange
│
▼
Application Policies
(Validation / Rate Limiting)
│
▼
Application Service
│
▼
Framework Services
│
▼
Resource Layer
│
▼
Response
Ownership Model
| Layer | Owner | Responsibility |
|---|---|---|
| data/framework | Framework | Framework resources |
| data/application | Application | Application resources |
| essential | Framework | Reusable framework capabilities |
| operational | Application | Business capabilities and policies |
| run | Framework | Runtime execution and enforcement |
Extension Surface
Applications are expected to extend the framework through the following locations:
source/data/application
source/operational
Applications should consume reusable framework capabilities from:
source/essential/visible
Applications should not directly depend on:
source/essential/hidden
as these components are considered internal framework implementation details and may change without notice.