io-oidis-localhost
Core server runtime for the Oidis Framework. Provides HTTP server, routing, connectors, and backend utilities.
Package Purpose
io-oidis-localhost is the foundation for all Oidis server-side applications. It provides:
- HTTP Server — Full HTTP/HTTPS server with WebSocket support
- Request Processing Pipeline — HttpServer → HttpManager → HttpResolver → Resolvers
- Connectors — Elastic, FileSystem, FileTransfer, Runtime, Terminal
- Decorators —
@Extern()for LCP/RPC,@Route()for REST endpoints - Response API — Typed response handlers (REST, Stream, LiveContent, Web)
- Log Processor — Logger with File, JSON, Std, Sentry adapters
- Utilities — CertsManager, Cron, Firewall, Metrics, SchemaValidator, StringReplace
Dependency Position
io-oidis-commons ← io-oidis-services ← io-oidis-localhost ← io-oidis-hub
← io-oidis-gui ←↑
Localhost depends on commons, services, and gui. It is a direct dependency of io-oidis-hub, io-oidis-builder, io-oidis-connector, and all solution projects.
io-oidis-connector extends localhost with agent mode, reverse tunneling, native dialogs, network tunneling, and multi-platform deployment — used as the base for agent applications instead of localhost directly.
Source Structure
source/typescript/Io/Oidis/Localhost/
├── Connectors/ — Elastic, FileSystem, FileTransfer, Runtime, Terminal
├── Enums/ — ColorType, HttpServerEventType, LogAdapterType, etc.
├── ErrorPages/ — Browser, Exception, Http301, Http403, Http404
├── Events/ — EventsManager, HttpServerEventArgs
├── HttpProcessor/ — HttpServer, Resolvers (14), Response API
├── IOApi/ — ScriptHandler, VMHandler
├── Interfaces/ — IConnector, IRoute, IResponse, etc.
├── LogProcessor/ — Logger, FileAdapter, JsonAdapter, StdAdapter
├── Primitives/ — BaseConnector, Decorators (@Extern, @Route)
├── Utils/ — CertsManager, Cron, Firewall, Metrics, etc.
├── Loader.ts — Singleton entry point
└── EnvironmentArgs.ts — Server environment configuration
Entry Point
The Loader class is the singleton entry point. It extends io-oidis-services Loader and initializes the HTTP server, connectors, logger, and all subsystems via the static Load() method.
import { Loader } from "@io-oidis-localhost/Io/Oidis/Localhost/Loader.js";
Loader.Load(appConfig);
const loader : Loader = Loader.getInstance() as Loader;
loader.getHttpServer().Start();
Configuration
Server configuration is provided via IProject interface in the project's config files. Key settings include:
- HTTP/HTTPS ports
- SSL certificate paths
- Firewall rules
- Log adapter configuration
- Connector settings
Exported API
| Class | Location | Purpose |
|---|---|---|
Loader | Loader.ts | Singleton entry point — initializes all subsystems |
HttpServer | HttpProcessor/HttpServer.ts | HTTP/HTTPS server lifecycle |
HttpManager | HttpProcessor/HttpManager.ts | Request dispatch and resolver selection |
HttpResolver | HttpProcessor/HttpResolver.ts | Base resolver orchestration |
RESTResolver | HttpProcessor/Resolvers/RESTResolver.ts | Handles @Route() decorated endpoints |
Logger | LogProcessor/Logger.ts | Log processor with pluggable adapters |
FileAdapter | LogProcessor/Adapters/FileAdapter.ts | Writes logs to file |
JsonAdapter | LogProcessor/Adapters/JsonAdapter.ts | Structured JSON log output |
StdAdapter | LogProcessor/Adapters/StdAdapter.ts | Console/stdout log output |
BaseConnector | Primitives/BaseConnector.ts | Base class for all connectors |
ConnectorsRegister | Connectors/ConnectorsRegister.ts | Registry of active connectors |
FileSystemHandler | Connectors/FileSystemHandler.ts | File system access connector |
Terminal | Connectors/Terminal.ts | Shell command execution connector |
Elastic | Connectors/Elastic.ts | Elasticsearch client connector |
ResponseFactory | HttpProcessor/ResponseApi/ResponseFactory.ts | Creates typed response instances |
CertsManager | Utils/CertsManager.ts | SSL certificate provisioning (ACME) |
Cron | Utils/Cron.ts | Scheduled task manager |
FirewallManager | Utils/FirewallManager.ts | IP-based access control |
Metrics | Utils/Metrics.ts | Runtime error and performance metrics |
SchemaValidator | Utils/SchemaValidator.ts | JSON schema validation utility |
EnvironmentHelper | Utils/EnvironmentHelper.ts | Runtime environment detection |
Decorators
@Extern()
Marks a connector method for external access via LCP (Local Communication Protocol) or RPC. Registered at load time via ForceCompile.ts.
import { Extern } from "@io-oidis-localhost/Io/Oidis/Localhost/Primitives/Decorators.js";
@Extern()
public async FetchData($params : any) : Promise<any> {
// ...
}
@Route(path, method?)
Registers a method as a REST endpoint handled by RESTResolver.
import { Route } from "@io-oidis-localhost/Io/Oidis/Localhost/Primitives/Decorators.js";
@Route("/api/resource", "GET")
public async GetResource($req : IRoute, $res : IResponse) : Promise<void> {
// ...
}
Sub-pages
- HTTP Processing Pipeline — HttpServer → HttpManager → HttpResolver chain
- Response API — Typed response handlers (REST, Stream, LiveContent, Web, Callback)
See also: Architecture Overview | Connector Overview | HTTP Processing Pipeline | Response API | Routing