1. External UIs that invoke HTTP APIs
Any application can interact with Autonomy apps by invoking built-in or custom HTTP APIs. This approach works for:- Mobile applications (iOS, Android).
- Desktop applications.
- Web applications hosted separately.
- CLI tools.
- Integration with existing systems.
external-app/client.ts
2. Simple UI with index.html
For a basic interface, place anindex.html directly in your container image directory:
index.html exists in the container image directory, the Autonomy Node
automatically serves it at the root of its HTTP server. This is perfect for simple
applications and prototypes.
Example structure:
images/main/index.html
3. Custom UI in a separate container
For larger applications, split the UI into its own container within the same pod. This provides complete separation between UI and API layers while maintaining fast internal communication. Example structure:autonomy.yaml:
autonomy.yaml
images/api/main.py):
images/api/main.py
images/ui/next.config.ts):
images/ui/next.config.ts
- Both containers run in the same pod and share a network namespace.
- They communicate via
localhost- the API container listens on port 9000. - The UI container proxies
/api/*requests tolocalhost:9000. - Only the UI container (port 8000) is exposed publicly.
- The API container remains internal to the pod.
images/ui/Dockerfile
Ensure the API container binds to
0.0.0.0 (not just localhost) so it’s
accessible from other containers in the pod. The UI framework must proxy API
requests to the correct internal port.4. Custom UI with Static Files
You can also compile you UI code to static files and configure FastAPI to serve these static files.- Write your UI code in
ui/using your chosen framework. - Compile the UI to static files (HTML, CSS, JS).
- Move compiled files from build output to
images/main/public/. - Set up FastAPI to serve the
public/directory usingStaticFiles. - Copy the
public/directory into the container image.
package.json in ui/ for Next.js:
next.config.js for static export:
main.py to serve static files:
images/main/main.py
- You must manually configure FastAPI with
StaticFilesto serve thepublic/directory. - The
ui/directory is not included in the Docker image. - Only the compiled
public/directory goes into the image. - Your UI framework can be anything that outputs static files.
- The FastAPI
StaticFilesmount must be last (after all API routes). - The
html=Trueparameter enables servingindex.htmlwhen a directory is requested.
The static files mount must be last in your FastAPI configuration (after all API routes).

