Modules
iii Architecture is very modular. Composed of a few Layers: Engine, Modules, Adapters.
Let's break down each layer:
- Engine: The core of iii. It is the engine that powers the iii architecture.
- Modules: The core modules that make up the iii architecture.
- Adapters: The adapters that connect the iii architecture to the outside world.
Summary
Summary of all the core modules.
Engine
The engine is the orchestration layer. Responsible for connecting the modules to the workers.
Core Modules
Built with Rust for exceptional speed and memory efficiency, Core Modules deliver top-tier performance.
Examples of Modules:
- REST API Module: Build REST APIs with ease.
- Streams Module: Build durable streams for real-time data subscriptions.
- Event Module: Redis-backed pub/sub for asynchronous messaging.
- Cron Module: Schedule functions with cron expressions.
- Logging Module: System observability and log management.
Within these modules, there's an Adapter Layer, where we can configure external services to be used as their backend. For example: in Queues Module, we can configure Redis to be used as BullMQ, or we can configure RabbitMQ to manage queues.
How to configure the Engine
Let's use the Streams Module as an example. The following file is the main configuration file for iii.
Add it to your project as config.yaml and iii will automatically load the modules and adapters.
modules:
- class: modules::streams::StreamModule
config:
port: ${STREAMS_PORT:31112}
host: 0.0.0.0
auth_function: motia.streams.authenticate
adapter:
class: modules::streams::adapters::RedisAdapter
config:
redis_url: ${REDIS_URL:redis://localhost:6379}In the example above, we're configuring only Streams Module in the Engine. We can configure the port to listen on, the host to listen on, and the authentication function to use.
We're also configuring the adapter to use for the Streams Module. In this case, we're using the modules::streams::adapters::RedisAdapter.
We can configure the Redis URL to use for the RedisAdapter.
REST API
Build REST APIs with ease.
Event
Event bus for pub/sub messaging.
Cron
Schedule functions with cron expressions.
Logging
System observability and log management.
Streams
Build durable streams for real-time data subscriptions.
KV Server
Key-Value storage server for persistent data storage
Exec
Execute commands in the shell.
Bridge
Connect to another iii instance