Boost Front‑End Prototyping with FakeAPI: Instant Mock Data Generation

This article introduces FakeAPI, a FastAPI‑based mock data service that lets front‑end developers quickly generate realistic JSON payloads, explains its endpoints, payload formats, repeat feature, and shows how to deploy it locally using Docker.

21CTO
21CTO
21CTO
Boost Front‑End Prototyping with FakeAPI: Instant Mock Data Generation

FakeAPI Overview

FakeAPI is a tool that generates mock data via an API, helping front‑end developers who need large amounts of data during application development and prototyping.

FakeAPI URLs

https://fakeapi.tk/

https://fakedataapi.vercel.app/

GitHub Repository

https://github.com/amalshaji/fakeapi

How FakeAPI Works

FakeAPI is built with FastAPI and uses the Faker library to generate data. The API supports all data types.

Endpoints

[GET] /api/types – Returns all supported data types.

[POST] /api/ – Accepts a JSON payload where each key is an identifier and each value specifies a data type; the service returns generated mock data matching the payload.

Example payload:

{
    "name": "name"
}

Resulting mock data:

{
    "name": "Amal Shaji"
}

Supported Payloads

FakeAPI can handle simple key‑value payloads as well as complex nested JSON structures, allowing you to define arrays, objects, and repeated data blocks.

You can use the repeat keyword to duplicate any data block up to ten times; the key inside the repeated block becomes n for each generated item.

The data generation is recursive: when the function encounters a dict, it calls itself to resolve nested structures.

Deployment

Local Docker Deployment

git clone https://github.com/amalshaji/fakeapi
cd fakeapi
docker build -t fakeapi .
docker run -p 8000:8000 fakeapi

After deployment, visit http://localhost:8000/api/types to see all supported data types and start testing with your preferred API client.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Dockerfrontend developmentFastAPIFakerFake DataAPI mock
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.