Developer Quick Start
Developer Quick Start
1. Start flow8
The fastest way to get a local instance running:
# Create a .env file with minimum required valuescat > .env << 'ENVEOF'SERVER_PORT=4454MONGODB_URI=mongodb://mongo:27017MONGODB_DB=udAPI_URL=http://localhost:4454/api/ENV_KEY_SALT=$(openssl rand -hex 32)ENC_KEY_SECRET=$(openssl rand -hex 128)ENVEOF
# Start with Docker Composecurl -O https://raw.githubusercontent.com/your-org/flow8/main/docker-compose.ymldocker-compose up -dWait ~10 seconds, then verify:
curl http://localhost:4454/api/health# {"status":"ok"}2. Authenticate
Create a session and get your auth cookie:
curl -c cookies.txt -X POST http://localhost:4454/api/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"admin@example.com","password":"your-password"}'Or create an API key for programmatic access:
# First login to get session cookiecurl -c cookies.txt -b cookies.txt -X POST http://localhost:4454/api/auth/api-keys \ -H "Content-Type: application/json" \ -d '{"name":"my-integration-key"}'
# Response: {"id":"...","token":"eyJ..."}# Use token as: Authorization: Bearer eyJ...3. Create a Flow
curl -b cookies.txt -X POST http://localhost:4454/api/flows \ -H "Content-Type: application/json" \ -d '{ "name": "Hello World Flow", "enabled": true, "category": "Demo" }'# Response: {"id":"65abc123",...}4. Add a Module Step
Add a step that fetches a URL and extracts data:
FLOW_ID="65abc123"
# Add a cURL module stepcurl -b cookies.txt -X POST http://localhost:4454/api/flows/$FLOW_ID/layers \ -H "Content-Type: application/json" \ -d '{ "name": "Fetch API", "ref": "fetchApi", "appId": "curl", "index": 0, "args": { "method": "GET", "url": "https://httpbin.org/json", "headers": {} } }'
# Add a template step that uses the outputcurl -b cookies.txt -X POST http://localhost:4454/api/flows/$FLOW_ID/layers \ -H "Content-Type: application/json" \ -d '{ "name": "Format Result", "ref": "formatResult", "appId": "template", "index": 1, "args": { "template": "Got response: {{ .fetchApi.body }}" } }'5. Run the Flow
curl -b cookies.txt -X POST http://localhost:4454/api/flows/$FLOW_ID/run \ -H "Content-Type: application/json" \ -d '{}'# Response: {"playId":"65xyz789","state":"RUN"}6. Get Execution Results
PLAY_ID="65xyz789"
# Poll until donecurl -b cookies.txt http://localhost:4454/api/plays/$PLAY_ID
# Get step-by-step outputcurl -b cookies.txt http://localhost:4454/api/plays/$PLAY_ID/layersThe out field of each layer contains that module’s output, available to subsequent steps via expressions like {{ $prev.fetchApi.body }}.