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:

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

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.

← Home