50 Modules
Every module is a shared library (.so) that exports 4 functions. Each does one thing. Together, they compose into any system.
Infrastructure
mod_cli
CLI over UNIX socket. Full line editing with arrow keys, history (64 commands), tab completion. Per-client state: current path, auth session. Connect via portal -r or portalctl.
mod_web
HTTP/HTTPS REST API gateway. Maps HTTP methods to Portal methods. Auto-generates API index from live paths. Three auth methods: API Key, Bearer Token, HTTP Basic Auth. CORS enabled. Configurable bind address.
v0.8.0 · Infrastructuremod_node
Node federation over TCP/TLS. Connects Portal instances into a distributed network. Worker thread pool per peer. Wire protocol PORTAL02. Hub routing for NAT traversal. Federation key auth (SHA-256). Auto-reconnect.
v0.4.0 · Infrastructuremod_ssh
SSH server for remote CLI access. Any standard SSH client connects and gets the full interactive CLI. Uses Portal's own user/password system.
v1.0.0 · Infrastructuremod_config_sqlite
SQLite storage backend. Transparent — registers as core storage provider. Auto-creates tables. WAL mode for concurrency.
v0.6.0 · Infrastructuremod_config_psql
PostgreSQL storage backend. Transparent — registers as core storage provider. Auto-creates database and tables. Parameterized queries (SQL injection safe).
v0.5.0 · InfrastructureData & Messaging
mod_cache
In-memory key-value cache with TTL expiry. Thread-safe hash table. CLI: cache set/get/del/keys/flush. Emits events on changes.
v1.0.0 · Datamod_kv
Persistent key-value store. File-backed, survives restarts. Each key stored as a file. Thread-safe, path traversal protection.
v1.0.0 · Datamod_shm
Named POSIX shared memory regions. Create, read, write, destroy. Emits events on create.
v1.0.0 · Datamod_queue
Thread-safe FIFO message queues. Push, pop, peek. Emits events on push/pop.
v1.0.0 · Datamod_websocket
WebSocket server for real-time push to browsers. Clients send path names, receive responses.
v1.0.0 · Datamod_mqtt
Lightweight MQTT broker. Clients publish/subscribe to topics. MQTT publish maps to Portal event emit.
v1.0.0 · Datamod_email
SMTP email sender. Configurable server and auth. Emits event on send.
v1.0.0 · Datamod_file
Sandboxed filesystem operations. Read, write, list, delete, info, mkdir. Path traversal protection. Configurable max file size and base directory.
v1.0.0 · DataLogic & Scripting
mod_logic
Application logic framework. Language-agnostic orchestrator. Manages scripts, routes, event handlers. Delegates execution to language engines via path messages.
v1.0.0 · Logicmod_logic_lua
Lua 5.4 embedded interpreter. In-process, zero-copy. API: portal.get(), portal.call(), portal.set(), portal.route(), portal.on(), portal.log().
v1.0.0 · Logicmod_logic_python
Python 3 in forked subprocess. JSON pipe bridge. import portal, same API. Avoids CPython signal conflicts with libev.
v1.1.0 · Logicmod_logic_c
C scripting engine. Compiles .c files with gcc at load time, produces .so, dlopens. Native speed with hot-reload. Uses portal.h directly.
v1.0.0 · Logicmod_logic_pascal
Free Pascal scripting engine. Compiles .pas files with fpc. Exports app_load, app_handle, app_unload with cdecl convention.
v1.0.0 · LogicSystem & Monitoring
mod_metrics
Real-time system metrics from /proc: CPU usage, memory, disk space, load average, uptime.
v1.0.0 · Systemmod_health
Liveness/readiness probes. Kubernetes/Docker compatible. CLI: health, uptime.
v1.0.0 · Systemmod_sysinfo
System information: hostname, OS, kernel, CPU count, network interfaces, environment variables.
v1.0.0 · Systemmod_process
Sandboxed system command execution via popen. Configurable whitelist. Rejects dangerous patterns. Admin-only.
v1.0.0 · Systemmod_log
Access Portal instance logs via path system. Tail, search by pattern, list log files, rotate.
v1.0.0 · Systemmod_audit
Circular buffer audit log. Subscribes to /events/* automatically. Searchable by user or path. Optional file persistence.
v1.0.0 · Systemmod_cron
Interval-based job scheduler. Jobs trigger path calls. CLI: cron add/remove/trigger/jobs. Emits events.
v1.0.0 · Systemmod_scheduler
One-shot delayed task scheduler. Tasks execute once at a specific time. Complement to mod_cron intervals.
v1.0.0 · Systemmod_worker
Named thread pools for background task execution. Configurable thread counts, submit jobs, track completion/failure stats.
v1.0.0 · Systemmod_backup
Create tar.gz backups of instance config and data. Restore from archives. List and delete backups. Admin-only.
v1.0.0 · SystemNetwork & Integration
mod_proxy
HTTP reverse proxy with named routes. Map portal paths to upstream servers. Error tracking per route.
v1.0.0 · Networkmod_dns
DNS utility: resolve hostnames (A/AAAA), reverse lookup (PTR), full lookup with aliases.
v1.0.0 · Networkmod_http_client
Outbound HTTP/HTTPS requests. CLI: curl <url>. Used by other modules for external API calls.
v1.0.0 · Networkmod_webhook
Register webhook URLs, auto-dispatch on Portal events. Configurable timeout and retry. Subscribes to /events/*.
v1.0.0 · Networkmod_api_gateway
External API routing with response caching (mod_cache), rate limiting (mod_firewall), auth header passthrough, configurable timeout.
v1.0.0 · Networkmod_tunnel
Raw TCP port forwarding through federation connections. Zero-overhead byte relay using select(). Enables SSH, HTTP, or any TCP service across NAT.
v1.0.0 · Networkmod_acme
ACME/Let's Encrypt certificate automation. Auto-detects certbot or acme.sh, falls back to self-signed. Request, check expiry, auto-renew.
v1.0.0 · NetworkSecurity
mod_firewall
Source-based firewall: explicit allow/deny rules + automatic rate limiting. Configurable requests per window. Thread-safe.
v1.0.0 · Securitymod_crypto
SHA-256 hash, MD5 hash, Base64 encode/decode, hex encode/decode. All zero-dependency (embedded implementations).
v1.0.0 · Securitymod_ldap
Authenticate users against LDAP/Active Directory servers. Simple LDAP bind protocol (BER encoded). Connection test function.
v1.0.0 · Securitymod_validator
Validate: email, IPv4/IPv6, URL, JSON, number ranges, POSIX regex, hostnames. Returns valid/invalid with details.
v1.0.0 · SecurityIoT
mod_iot
Complete IoT device management. Discovery (ARP scan + MAC identification + KLAP probe), control (on/off/toggle), monitoring. Drivers: MQTT (Tasmota/Shelly/Sonoff), HTTP (Shelly/Hue), Tapo KLAP v2 (TP-Link plugs, bulbs, hub, vacuum), GPIO.
v1.0.0 · IoTmod_gpio
GPIO pin control via Linux sysfs. Export/unexport pins, set direction, read/write values. Simulation mode on non-GPIO hardware.
v1.0.0 · IoTCompression
mod_xz
XZ/LZMA compression via liblzma. Configurable level (0-9). Buffer-based API.
v1.0.0 · Systemmod_gzip
Gzip compression via zlib. Configurable level (1-9). Proper gzip header format.
v1.0.0 · SystemRendering
mod_template
Template rendering with {{variable}} syntax. Load from files, cache in memory, render with substitution.
v1.0.0 · Systemmod_admin
Web administration dashboard (SPA). Dashboard with metrics, module browser, node federation view, user/group management, config editor, audit log viewer.
v2.0.0 · SystemExamples
mod_hello
Minimal example module demonstrating the 4-export interface. Template for new modules.
v1.0.0 · Examplemod_myapp
Example application with counter, events, and ACL demonstration.
v1.0.0 · ExampleModule Interface
Every module exports exactly 4 symbols:
portal_module_info_t *portal_module_info(void); // descriptor
int portal_module_load(portal_core_t *core); // initialize
int portal_module_unload(portal_core_t *core); // cleanup
int portal_module_handle(portal_core_t *core, // handle messages
const portal_msg_t *msg,
portal_resp_t *resp);
Runtime Management
portal:/> module list # all loaded modules
portal:/> module load mymod # hot-load
portal:/> module unload mymod # safe unload (waits for active calls)
portal:/> module reload mymod # atomic unload + load