Open Source · Python PackageJul 2025OSS

km-pyapi

FastAPI-inspired REST framework, published to PyPI — built to understand framework internals from the ground up.

Role —Solo · open sourceTimeline —3 weeks
km-pyapi — product screenshot
PyPI
Published package
Open Source
MIT licensed
01Problem

What needed solving.

Most engineers use frameworks like FastAPI as black boxes. To genuinely understand backend architecture — routing, middleware, validation, auth, ORM integration — I wanted to rebuild a working framework from first principles, not just read about one.
02Approach

How I built it.

km-pyapi is a FastAPI-inspired REST framework distributed on PyPI. It implements its own routing layer, request validation, JWT auth, SQLAlchemy ORM integration, OpenAPI-style documentation, password hashing and CORS — packaged with Docker deployment and a Pytest suite so others can use it as a learning reference too.

Key engineering decisions
  • 01Built the routing layer from scratch using a radix-tree-inspired approach to understand how path matching and parameter extraction work before reaching for an existing router.
  • 02JWT auth is implemented without a framework helper to expose the token issuance, verification and expiry logic explicitly — the code is intentionally readable over optimized.
  • 03Published to PyPI early (before full feature parity) to practice the packaging and release workflow as part of the learning objective.
03Features

What it does.

Custom routing layer

Path matching, parameter extraction and method dispatch implemented from scratch — no ASGI/WSGI framework underneath, just Python.

JWT auth & SQLAlchemy ORM

Full auth flow with token issuance, verification and expiry, plus SQLAlchemy integration for model definition and query execution.

OpenAPI-style documentation & Pytest suite

Auto-generated endpoint documentation and a test suite covering routing, auth and validation — making it usable as a learning reference, not just a demo.

Full feature list (4 more)
  • 01Request validation
  • 02Password hashing
  • 03CORS support
  • 04Docker-ready deployment
04Results

What it shipped.

Published to PyPI. The project deepened my understanding of routing internals, WSGI mechanics, and how auth middleware is layered — knowledge that directly informs how I build and debug production FastAPI services. Occasional GitHub stars from other engineers learning Python internals.

05Stack

Built with.

PythonSQLAlchemyJWTDockerPytest
06Live & links

See it live.

07Next case study
Autonomous Security AI

Research on autonomous multi-agent AI systems for end-to-end workflow automation in U.S. private security.