A simple RESTful API for a personal blogging platform built with FastAPI. It supports full CRUD operations and search functionality.
- Create a blog post
- Get all blog posts
- Get a single blog post
- Update a blog post
- Delete a blog post
- Search blog posts by title, content, or category
- Input validation using Pydantic
- Auto-generated API documentation (Swagger UI)
- Python
- FastAPI
- Uvicorn
- Pydantic
blog_api/ │ ├── main.py ├── schemas.py └── routes/ └── posts.py
pip install fastapi uvicorn
python -m uvicorn main:app --reload
API: http://127.0.0.1:8000
Swagger Docs: http://127.0.0.1:8000/docs
POST /posts → Create Post
GET /posts → Get All Posts
GET /posts/{post_id} → Get Single Post
PUT /posts/{post_id} → Update Post
DELETE /posts/{post_id} → Delete Post
GET /posts?term=tech → Search Posts
POST /posts { "title": "First Post", "content": "Learning FastAPI step by step", "category": "Tech", "tags": ["fastapi", "python"] }
{ "id": 1, "title": "First Post", "content": "Learning FastAPI step by step", "category": "Tech", "tags": ["fastapi", "python"], "createdAt": "2026-05-04T15:20:19Z", "updatedAt": "2026-05-04T15:20:19Z" }
-
Run server: python -m uvicorn main:app --reload
-
Test:
- POST → create post
- GET → all posts
- GET /{id} → single post
- PUT → update post
- DELETE → delete post
- GET ?term= → search
- REST API design
- CRUD operations
- HTTP methods (GET, POST, PUT, DELETE)
- Status codes
- Pydantic validation
- FastAPI routing
- Swagger testing
Built while learning backend development with FastAPI.