Serve a static site
Applies to workflow mode.
Overview
In this tutorial you serve a folder of static files (HTML, CSS, JS, images) over HTTP using web server mode. There are no resources and no LLM - kdeps acts as a plain static file server driven by workflow.yaml.
This tutorial is for developers who have completed the quickstart. It assumes you know:
- Basic YAML
- Basic HTML
By the end you will be able to:
- Configure web server mode with a static route
- Serve a
public/directory - Understand when to use web server mode instead of the API server
Background
kdeps has two server modes. The API server (apiServer:) routes JSON requests to resources. Web server mode (webServer:) serves static files or proxies to another process - useful for a frontend, a docs site, or a dashboard sitting in front of an agent API.
Before you start
- kdeps installed (
kdeps --version). - A working directory for the project.
Step 1: create the project and content
mkdir static-site
cd static-site
mkdir publicCreate public/index.html:
<!doctype html>
<html>
<head><title>Hello from kdeps</title></head>
<body>
<h1>It works</h1>
<p>Served by kdeps web server mode.</p>
</body>
</html>Step 2: configure web server mode
Create workflow.yaml:
# workflow.yaml
apiVersion: kdeps.io/v1
kind: Workflow
metadata:
name: static-site
version: "1.0.0"
targetActionId: "none" # no resource runs; the server just serves files
settings:
webServer:
portNum: 16395
routes:
- path: "/"
serverType: "static" # serve files from disk
publicPath: "./public" # the directory to servetargetActionId: "none" tells kdeps there is no resource graph to run.
Step 3: validate and run
kdeps validate .
kdeps run .Open http://localhost:16395/ in a browser, or:
curl http://localhost:16395/You get the contents of public/index.html. Any other file under public/ is served at its matching path.
Step 4: serve a built frontend (optional)
The same route serves a compiled single-page app - point publicPath at the build output:
# workflow.yaml
settings:
webServer:
portNum: 16395
routes:
- path: "/"
serverType: "static"
publicPath: "./frontend/build" # e.g. Vite or Create React App outputSummary
You served a static directory by:
- Using
webServer:instead ofapiServer: - Setting
serverType: staticandpublicPath - Setting
targetActionId: "none"because no resource runs
Next steps
- Web server mode - reverse proxy, Streamlit, Gradio, Flask
- Workflow configuration - the full
settingsblock - Docker deployment - ship the site as an image
- TLS and HTTPS - serve it over HTTPS
