Skip to main content

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​

ClassLocationPurpose
LoaderLoader.tsSingleton entry point — initializes all subsystems
HttpServerHttpProcessor/HttpServer.tsHTTP/HTTPS server lifecycle
HttpManagerHttpProcessor/HttpManager.tsRequest dispatch and resolver selection
HttpResolverHttpProcessor/HttpResolver.tsBase resolver orchestration
RESTResolverHttpProcessor/Resolvers/RESTResolver.tsHandles @Route() decorated endpoints
LoggerLogProcessor/Logger.tsLog processor with pluggable adapters
FileAdapterLogProcessor/Adapters/FileAdapter.tsWrites logs to file
JsonAdapterLogProcessor/Adapters/JsonAdapter.tsStructured JSON log output
StdAdapterLogProcessor/Adapters/StdAdapter.tsConsole/stdout log output
BaseConnectorPrimitives/BaseConnector.tsBase class for all connectors
ConnectorsRegisterConnectors/ConnectorsRegister.tsRegistry of active connectors
FileSystemHandlerConnectors/FileSystemHandler.tsFile system access connector
TerminalConnectors/Terminal.tsShell command execution connector
ElasticConnectors/Elastic.tsElasticsearch client connector
ResponseFactoryHttpProcessor/ResponseApi/ResponseFactory.tsCreates typed response instances
CertsManagerUtils/CertsManager.tsSSL certificate provisioning (ACME)
CronUtils/Cron.tsScheduled task manager
FirewallManagerUtils/FirewallManager.tsIP-based access control
MetricsUtils/Metrics.tsRuntime error and performance metrics
SchemaValidatorUtils/SchemaValidator.tsJSON schema validation utility
EnvironmentHelperUtils/EnvironmentHelper.tsRuntime 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​


See also: Architecture Overview | Connector Overview | HTTP Processing Pipeline | Response API | Routing