Platform Architecture

Platform Architecture

& Developer Reference

A complete technical reference for building applications on the OBTO platform. Covers the request lifecycle, collection architecture, component relationships, and full code blueprints for every artifact type.

Version 2.0 • March 2026

For AI Agents & Human Developers

1. Platform Overview

OBTO is a distributed, Kubernetes-hosted application platform that stores all application code as database artifacts in MongoDB. There is no traditional filesystem — every component (pages, scripts, routes, stylesheets) lives as a record in a specific collection. The platform uses Vite for frontend module resolution and Express.js for backend routing.

circle-info

Think of OBTO like a CMS for code. You don’t push files to a server — you upsert records into collections. The platform’s runtime reads those records and serves them as if they were files on disk. Understanding this abstraction is the foundation for everything else.

2. Core Concepts: Domain & Host

Every tool call in OBTO requires two scoping parameters. These are not interchangeable and serve distinct purposes:

Parameter
What It Is
Example
Scope

domain

The deployment environment. Determines which database and runtime instance serves the app.

staging, production

Session-level. Fixed for all tool calls in a given session.

host

The public hostname that serves pltf_page, pltf_javascript, and pltf_stylesheet records.

myapp.obto.co, app.custom.com

App-level. All page/JS/CSS records for one site share the same host.

appName

The unique identifier for the application. Used to scope all records.

my-shop, zsdsd

App-level. Every tool call requires it.

circle-info

One app (appName) exists in one domain (environment). That app can have one or more hosts. Records that share a host are served together as a cohesive website. A pltf_page with host=A cannot load a pltf_javascript with host=B.

3. Request Lifecycle

Understanding how a request flows through the platform is essential. Here is the complete path from browser to response:

3.1 Public Website Request (pltf_page + pltf_javascript)

  1. Browser requests https://myapp.obto.co/index

  2. Platform matches the host header against pltf_page records. Finds the page named index with matching host.

  3. Platform returns the HTML content from the page record.

  4. Browser encounters <script type="module" src="./App.tsx"> in the HTML.

  5. Browser requests ./App.tsx. Platform resolves this to a pltf_javascript record named App with the same host.

  6. Vite’s transform pipeline processes the module (JSX/TSX → JS), resolves imports (React, etc.), and serves it to the browser.

  7. React mounts to the #root div. Page is live.

circle-info

OBTO uses .tsx as the canonical file extension for all React modules, regardless of whether you write actual TypeScript. This is because Vite’s transform pipeline is configured to process .tsx by default. It’s a platform convention, not a language requirement.

3.2 API Request (pltf_route + pltf_script_server)

  1. Client sends a request to an API endpoint (e.g., POST /api/contact).

  2. Platform matches the path against pltf_route records for the app.

  3. The route handler executes as an Express.js handler with req and res objects.

  4. If the route calls a server script, it uses the xe. prefix to dynamically resolve and instantiate the pltf_script_server class.

  5. The server script executes, returns data, and the route sends the response.

3.3 Native App Request (pltf_script_client)

Native frontend scripts (pltf_script_client) follow a different path. They are not loaded via HTML script tags. Instead, the platform’s native app shell injects them into a pre-configured React runtime environment where all allowed globals are already available on the window object. The script must return a React component as its final statement.

4. Component Relationship Map

This is the single most important diagram in this document. It shows how every collection type connects to every other:

Binding Rules

  • pltf_page ↔ pltf_javascript: Bound by the <script src> tag in the HTML AND by sharing the same host value.

  • pltf_page ↔ pltf_stylesheet: Bound by the <link href> tag in the HTML AND by sharing the same host value.

  • pltf_route ↔ pltf_script_server: Bound by the xe. prefix at runtime. The platform dynamically resolves xe.ClassName to the matching pltf_script_server record in the same app.

  • pltf_script_server ↔ pltf_script_server: Server scripts can call each other using the same xe. prefix.

  • pltf_script_client: Standalone. No explicit binding needed — injected by the platform’s native app shell.

5. Collection Reference

Each collection type has strict rules about what code patterns are allowed. Violating these rules will cause runtime failures.

5.1 pltf_page — HTML Pages

Property
Value

Purpose

HTML layout that serves as the entry point for a public website.

Collection Name

pltf_page

Requires host?

Yes — must match the hostname serving this site.

Code Format

Standard HTML. No framework-specific syntax.

Blueprint

circle-exclamation

5.2 pltf_javascript — Public Frontend Modules

Property
Value

Purpose

React components and frontend logic for public-facing websites.

Collection Name

pltf_javascript

Requires host?

Yes — must match the page that loads it.

Code Format

Standard ESM. Imports ARE allowed.

Export Pattern

export default ComponentName;

Blueprint

circle-exclamation

5.3 pltf_script_client — Native Frontend Components

Property
Value

Purpose

React components for the native OBTO app shell (not public websites).

Collection Name

pltf_script_client

Requires host?

No.

Code Format

NO import/export statements. All libraries via window globals.

Final Statement

return [ComponentName];

Blueprint

Available Window Globals (Grouped by Purpose)

Category
Globals

Core React

React, ReactDOM, createRoot

UI Library

antd, antdIcons, lucidereact

State Management

Provider, store, RecoilRoot

Charts & Visualization

Highcharts, HighchartsReact, antdPlots, antv, reactFlow

Data & Utilities

_, moment, uuidv4, XLSX, format, http, cronstrue

Drag & Drop

Draggable, DraggableCore

Date/Timeline

Timeline, TimelineMarkers, TodayMarker, CustomMarker, CursorMarker

Wizards & Steppers

Stepper, Step, StepWizard

File & Export

saveAs, print, tus

Text & Code

markdownIt, HTMLEncode, hljs, prettierPluginBabel, prettierPluginEstree

Alerts & Progress

swal, NProgress

Other

CheckboxTree, ColumnSelect, DailyIframe, dco, fetchEventSource, loadStripe, pageService

circle-exclamation

5.4 pltf_route — Express.js Routes

Property
Value

Purpose

Express.js route handlers that serve as API endpoints.

Collection Name

pltf_route

Requires host?

No.

Code Format

CommonJS ONLY. No ES6 export statements.

Export Pattern

module.exports.[RouteName] = [RouteName];

Naming Rule

The exported name MUST exactly match the record’s name attribute.

Blueprint

What’s Available in the Route Context

  • req — Standard Express Request object (req.body, req.params, req.query, req.headers)

  • res — Standard Express Response object (res.json(), res.send(), res.status())

  • xe. — Dynamic resolver for pltf_script_server classes in the same app

5.5 pltf_script_server — Backend Logic

Property
Value

Purpose

Node.js classes containing business logic, data access, and backend processing.

Collection Name

pltf_script_server

Requires host?

No.

Code Format

Standard JS classes. NO module.exports.

Cross-Referencing

Use xe. prefix to call other server scripts.

Blueprint

circle-info

xe. is the platform’s dynamic class resolver. When you write new xe.ContactService(), the platform looks up the pltf_script_server record named “ContactService” in the current app, loads it, and instantiates the class. This works across both routes and other server scripts. It’s OBTO’s equivalent of require() or import.

5.6 pltf_stylesheet — CSS Stylesheets

Property
Value

Purpose

Global CSS files loaded by pltf_page via <link> tags.

Collection Name

pltf_stylesheet

Requires host?

Yes — must match the page that loads it.

Code Format

Standard CSS. No preprocessors (no SCSS/LESS).

Loaded Via

<link rel="stylesheet" href="./[Name].css" /> in pltf_page

6. Deployment Quick Reference

All deployment happens through a single tool: obto_upsert_record. Here are the required parameters for each collection type:

Collection
appName
domain
host
name
script

pltf_page

✓ Required

Page name (e.g., index)

HTML content

pltf_javascript

✓ Required

Module name (e.g., App)

React/JS code

pltf_stylesheet

✓ Required

Style name (e.g., main)

CSS content

pltf_script_client

✘ Not needed

Component name

React component

pltf_script_server

✘ Not needed

Class name

Node.js class

pltf_route

✘ Not needed

Route/function name

Express handler

circle-info

If it’s served to a browser directly (pages, JS modules, CSS), it needs a host. If it runs on the server (routes, server scripts) or is injected by the platform (native client scripts), it doesn’t.

7. Environment Boundaries

  • ALWAYS pass the current app’s appName to every tool call. Never hardcode a different app name.

  • NEVER hardcode domain as 'core' unless explicitly instructed. The domain is set per session.

  • If host is unknown, it MUST be retrieved from app configuration or confirmed with the user before deploying page/JS/CSS records.

  • Records with mismatched host values will not be served together. A page at host=A cannot load a script at host=B.

Appendix: Common Patterns

A. Full-Stack Example: Contact Form

This example shows how a public website form connects through all layers:

1

Frontend (pltf_javascript: ContactPage)

2

Route (pltf_route: ContactSubmit)

3

Server Script (pltf_script_server: ContactService)

4

Page (pltf_page: contact)

— End of Document —