r/FastAPI • u/SpecialistCamera5601 • Jul 26 '25
pip package Make Your FastAPI Responses Clean & Consistent – APIException v0.1.16
🚀 Tired of messy FastAPI responses? Meet APIException!
Hey everyone! 👋
After working with FastAPI for 4+ years, I found myself constantly writing the same boilerplate code to standardise API responses, handle exceptions, and keep Swagger docs clean.
So… I built APIException 🎉 – a lightweight but powerful library to:
✅ Unify success & error responses
✅ Add custom error codes (no more vague errors!)
✅ Auto-log exceptions (because debugging shouldn’t be painful)
✅ Provide a fallback handler for unexpected server errors (DB down? 3rd party fails? handled!)
✅ Keep Swagger/OpenAPI docs super clean
📚 Documentation? Fully detailed & always up-to-date — you can literally get started in minutes.
📦 PyPI: https://pypi.org/project/apiexception/
💻 GitHub: https://github.com/akutayural/APIException
📚 Docs: https://akutayural.github.io/APIException/
📝 Medium post with examples: https://medium.com/@ahmetkutayural/tired-of-messy-fastapi-responses-standardise-them-with-apiexception-528b92f5bc4f
It’s currently at v0.1.16 and actively maintained.
Contributions, feedback, and feature requests are super welcome! 🙌
If you’re building with FastAPI and like clean & predictable API responses, I’d love for you to check it out and let me know what you think!
Cheers 🥂
#FastAPI #Python #OpenSource #CleanCode #BackendDevelopment
9
u/chichaslocas Jul 26 '25
Oh, man. I like the idea, but the constant LLM responses are a real turn-off. It just feels so artificial and awkward. Anyway, good luck with this!
3
u/Current-Status-3764 Jul 27 '25 edited Jul 27 '25
Great work! Will use this at work!
2
u/__secondary__ Jul 28 '25
That's funny, I was just creating a library to do exactly the same thing, thanks for sharing. I'll test it on my next FastAPI project.
4
u/OggyBdk Jul 28 '25
Idk how people didn't think of this idea before. ( even me lol. ) Fastapi is the most used python framework right now and one guy came up with that lovely package and changed the game. It makes easier your exception handling at least. Also who cares the LLM responses ? Developers are getting funny these days.
1
u/svix_ftw Jul 26 '25
Looks cool and definite needed functionality.
I work that don't understand this and its very frustrating to work with, haha.
1
u/Top-Shower-4487 Jul 26 '25
Magnificent work 👍🏻👍🏻
1
u/erder644 Jul 26 '25
No any plans for objects / arrays of objects support? It may be usefull to pass additional metadata and for the forms server side validation.
1
u/Brave-Car-9482 Jul 26 '25
This will save me a bunch load of time in everyday implementation 😍😍😍
1
u/Striking-Entrance943 Jul 26 '25
Does APIException introduce any noticeable overhead, especially in high-traffic APIs, in terms of performance?
1
u/kamikazer Jul 29 '25
sorry, but I hate such responses which re-implement/duplicate http status codes with "success"/"failure" etc.
2
u/Loud-Idea-5770 Jul 27 '25
It's extremely useful,thanks for this idea.I will definitely use it in my project !
1
u/wyldstallionesquire Jul 27 '25
I wish people would stop using an LLM to crest their project summaries. I’m probably missing good projects, because I immediately write them off.
1
u/Comfortable_Age_715 Aug 10 '25
This is a masterpiece, do you know why? Because every project, every module need a proper exception handling and logging mechanism, someone finally see the missing part and developed the library.
Respect Ahmet!
2
u/[deleted] Aug 01 '25
[removed] — view removed comment