Platform Overview
Architecture, three operating modes, directory structure, and how the runtime works.
Runtime Reference
Request lifecycle, config loading, route dispatch, template rendering, static files.
CLI Reference
All --action commands, options, expected output, and usage examples.
Config Reference
appnow.json schema — paths, features, security, branding, and per-route overrides.
Function Reference
Every built-in function: signature, parameters, return value, and usage examples.
Common Patterns
How to add a page, create a route, include CSS, configure branding, and more.
Runtime Reference
The Appnow runtime (appnow.license) is organized into numbered sections. Here is how a request flows through the system:
- Section 1 — Init: Define constants, version, error handling
- Section 2 — Config:
gatherConfig()walksappnow.json/tree - Section 3 — Helpers: Utility functions (
noScript(),mfileTime(),cliResponse()) - Section 4 — HTML Builders:
buildHead(),buildNav(),buildFooter() - Section 5 — Static Files: ETag, Last-Modified, MIME types, 304 handling
- Section 6 — Security: Path checks, directory blocking, access controls
- Section 7 — Route Config:
loadRouteConfig()per-route settings - Section 8 — Content Routing:
routeRequest()maps URLs tocontent/ - Section 9 — API Dispatch: Routes checked before mode switch
- Section 10 — Mode Switch: app-server, api-gateway, or custom-service
- Section 11 — CLI: Shell detection,
--actioncommands,--help
CLI Reference
Run any app from the command line for diagnostics and testing:
appnow.license --action health
# Returns JSON: {"status": "ok", "app": "...", "version": "0.2", ...}
appnow.license --action config
# Returns sanitized app config (secrets redacted)
appnow.license --action services
# Lists all configured routes/services
appnow.license --action test-route --route /about/
# Tests that a route resolves without executing it
appnow.license --action status
# Full diagnostic: disk, paths, permissions, supervisor, uptime
appnow.license --help
# Shows all available options and actions
Config Reference
The root config file (appnow.json/_.json) defines your application:
{
"version": "0.1",
"mode": "app-server", // app-server | api-gateway | custom-service
"name": "My Application",
"vhost_id": "2026000060-cloud",
"server": "myapp.com",
"timezone": "America/New_York",
"title": "Page title",
"description": "Meta description",
"paths": {
"home": "/srv/apps/{vhost_id}/",
"storage": "/srv/apps/{vhost_id}/storage/",
"logs": "/srv/apps/{vhost_id}/logs/"
},
"features": {
"cors": false, // Enable CORS headers
"logging": true // Enable request logging
},
"security": {
"block_underscore_dirs": true, // Block _prefixed paths
"block_python_files": true // Block .py file access
},
"branding": {
"nav_logo_text": "My App",
"nav_links": [
{"label": "Home", "href": "/"}
],
"icons": {
"favicon": "/images/favicon.ico",
"192": "/images/icon-192x192.png",
"512": "/images/icon-512x512.png"
},
"chat": {
"enabled": true,
"title": "Assistant",
"subtitle": "AI Help",
"greeting": "Hello! How can I help?",
"placeholder": "Type a message...",
"route": "/chat/"
}
}
}
Route-specific configs go in subdirectories. For example, appnow.json/about/_.json can set "title", "no_chat": true, and "css": {"exclude": [...]}.
Function Reference
Runtime Functions
gatherConfig()— Walksappnow.json/directory tree, returns merged config arrayloadRouteConfig($path)— Loads per-route config. Passnullfor root configbuildHead($options)— Outputs<head>with title, meta, icons, CSS auto-discoverybuildNav()— Outputs navigation bar with logo and links from configbuildFooter()— Outputs footer, chat widget (if configured), and JS auto-discoveryrouteRequest()— Maps URL path tocontent/filesystem (app-server mode)mfileTime($path)— Returns file modification timestamp for cache-bustingnoScript($str)— HTML-escapes output for safe renderingcliResponse($data, $success)— Outputs JSON response for CLI actions
Common Patterns
Adding a Page (App Server)
// content/about/index — a new page
buildHead([
'title' => 'About — My App',
'description' => 'About this application.',
]);
buildNav();
<div class="page-header">
<h1>About</h1>
</div>
<div class="content">
<p>Your content here.</p>
</div>
buildFooter();
Adding an API Route
// routes/my-endpoint/index — a new API endpoint
// Set response type
header('Content-Type: application/json');
// Access app config
$config = appnow_config();
// Check request method
if ($method !== 'POST') {
respond(405, ['error' => 'Method not allowed']);
}
// Your logic here
respond(200, ['status' => 'ok']);
Adding CSS or JS
Drop .css files in content/html/css/ and .js files in content/html/js/. The runtime auto-discovers and includes them. No config changes needed.