Skip to content

bigdatapersonnel/fastapi-async-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Async RESTful API Service with FastAPI

🎯 Project Overview

This is a lightweight asynchronous REST API built with FastAPI and Python’s native async/await features. It demonstrates non-blocking request handling and structured API documentation using Pydantic and OpenAPI.

Key Features

  • Asynchronous API using async def + await

  • POST endpoint: /process — transforms input with artificial delay

  • Request validation with Pydantic

  • Auto-generated interactive docs: /docs (Swagger UI), /redoc

  • Powered by Uvicorn ASGI server


🛆 Requirements

pip install -r requirements.txt
pip install fastapi uvicorn

🚀 How to Run

uvicorn main:app --reload

Then open your browser:


📮 Example API Usage

Endpoint

POST /process

Sample Request Body (JSON)

{
  "text": "hello fastapi"
}

Sample Response

{
  "input": "hello fastapi",
  "result": "HELLO FASTAPI"
}

📁 Project Structure

.
├── main.py             # FastAPI app with /process endpoint
├── requirements.txt    # Dependencies
├── README.md           # You're here
└── .gitignore          # Ignore __pycache__, venv, etc.


🛠️ Tech Stack

  • Languages: Python

  • Frameworks: FastAPI, Pydantic

  • Async Programming: async/await

  • API Docs: Swagger UI, ReDoc (via OpenAPI)

  • Web Server: Uvicorn

  • Tools: Git, cURL, VS Code, Jupyter Notebook

📜License

MIT License © 2025

🙇‍♂️ Author

Built by Yazhuo Tian — feel free to connect!

Last Updated: September 2025

About

An async REST API demo built with FastAPI and Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages