Apps API
Endpoint: GET/POST /api/apps.php
Auth: Session (GET), Session + Admin (POST)
List Apps
http
GET /api/apps.phpReturns all active apps for the current user, including system apps and user-specific custom apps. Apps listed in the disabled_apps system config are filtered out.
Response:
json
{
"apps": [
{
"id": 1,
"name": "Notes",
"slug": "notes",
"description": "Take notes",
"icon_url": "/assets/icons/notes.svg",
"app_path": "/apps/notes/",
"category": "productivity",
"supports_context": false,
"is_system": true
}
]
}Create App (Admin Only)
http
POST /api/apps.php
Content-Type: application/json
{
"name": "My Custom App",
"slug": "my-app",
"description": "A custom application",
"icon_url": "/assets/icons/custom.svg",
"app_path": "/apps/my-app/",
"category": "custom",
"supports_context": false,
"is_system": false
}Required: name, slug
Response (201):
json
{
"ok": true,
"id": 15
}App Architecture
System Apps
System apps are registered with is_system=true and are available to all users. They cannot be modified or deleted through the API.
Custom Apps
Custom apps are created via the App Builder and tracked with created_by_user_id. They appear only in the creator's dock.
App Loading
Each app loads in an iframe managed by the window manager:
WM.open('my-app')
→ Creates window chrome
→ Sets iframe src to app_path
→ App runs in isolated contextCommunication
Apps communicate with the desktop via postMessage:
javascript
// From app iframe to desktop
window.parent.postMessage({
type: 'niuton-open-app',
slug: 'files',
path: '/Documents'
}, '*');Available App Categories
| Category | Apps |
|---|---|
productivity | Notes, Files, Documents |
communication | Team Chat |
finance | Finance |
utility | Terminal, Settings, Routines |
entertainment | Chess |
ai | App Builder |
maps | Maps |
custom | User-created apps |