Skip to main content
The Fake API is a lightweight backend service that serves static JSON, XML, and RSS files. It simulates upstream services that KrakenD would typically aggregate and transform.

Overview

This service runs a simple HTTP server using BusyBox that serves files from the data/ directory. It provides raw data that KrakenD can fetch, transform, and aggregate.

Port

The Fake API runs on port 8000:
http://localhost:8000

How It Works

The service uses a BusyBox container running httpd to serve static files:
fake_api:
  image: busybox:latest
  volumes:
    - ./data:/var/www/
  ports:
    - "8000:80"
  command: httpd -f -h /var/www/
All files in the data/ folder are accessible via HTTP requests.

Adding Custom Data Files

You can easily add or modify data by placing files in the data/ directory:
  1. Create your data file (JSON, XML, or RSS)
  2. Save it in the data/ folder
  3. Access it at http://localhost:8000/your-file.json
The service automatically serves any file you add to the data/ directory - no restart required.

Example Endpoints

Here are some examples of how to use the Fake API:

JSON Data

curl http://localhost:8000/data.json

XML Data

curl http://localhost:8000/feed.xml

RSS Feeds

curl http://localhost:8000/news.rss

Usage in KrakenD

The KrakenD configuration references the Fake API as a backend host:
{
  "host": ["http://fake_api"],
  "url_pattern": "/your-endpoint"
}
KrakenD can then fetch data from this service, combine it with other backends, transform the response, and return it to clients.

File Structure

The typical structure for data files:
data/
├── users.json
├── products.json
├── feed.xml
├── news.rss
└── custom-data.json
This is a development/demo service only. In production environments, you would connect KrakenD to real backend services and APIs.

Build docs developers (and LLMs) love