Prerequisites
Before starting, ensure you have:- ServFlow Pro installed (Installation Guide)
- A text editor
- A terminal or command-line interface
What You’ll Build
By the end of this tutorial, you’ll have a working “Hello World” API endpoint defined entirely in YAML, running without the dashboard UI.Step 1: Create Your Project Structure
Create a directory for your ServFlow project and the required folders:configs directory will hold your API configuration files.
Step 2: Create the TOML Configuration
Create aconfig.toml file in your project root:
- Listen for API requests on port
8080 - Load API definitions from the
./configsfolder
The
config_folder is the only required setting. ServFlow uses sensible defaults for everything else.Step 3: Create Your First API Configuration
Create a file namedhello-world.yaml in the configs directory:
| Field | Description |
|---|---|
http.method | The HTTP method this endpoint accepts (GET) |
http.listen_path | The URL path to listen on (/hello-world) |
responses.success | A response definition with status code and body |
entry | Where the workflow starts — directly returning the success response |
Step 4: Start ServFlow in Headless Mode
Run ServFlow without the--dashboard flag:
Without
--dashboard, ServFlow runs in headless mode — it serves your APIs but doesn’t start the web UI. This is the recommended mode for production deployments.Step 5: Test Your API
Open a new terminal and test your endpoint:Congratulations! You’ve created your first API using YAML configuration.
Adding Actions to Your Workflow
Most APIs need to do more than return static responses. Here’s an expanded example that demonstrates actions:- Accepts a
namequery parameter - Uses a
staticaction to build a dynamic response - Returns the greeting with the current timestamp
YAML Configuration Structure
Every API configuration file follows this structure:Hot Reloading
ServFlow automatically detects changes to YAML files in yourconfig_folder. When you save a file:
- New configurations are loaded immediately
- Modified configurations are updated
- Deleted files remove the corresponding endpoints
Version Control Best Practices
Since your APIs are defined in YAML files, you can:- Track changes with Git or other version control systems
- Review API changes through pull requests
- Deploy consistently across environments using the same configuration files
- Roll back to previous versions if issues arise
.gitignore for a ServFlow project:
Next Steps
Running Modes
Understand when to use headless mode vs. dashboard mode.
Actions Reference
Explore all available actions for your workflows.
Dynamic Content
Learn template syntax for dynamic values in your YAML.
Configuration Reference
Explore all TOML configuration options.