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.
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 fakeapiAfter deployment, visit http://localhost:8000/api/types to see all supported data types and start testing with your preferred API client.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
