Over the past few hours, I've been deep into refactoring one of my FastAPI projects with a clear goal: make it production-ready and showcase it live through my portfolio at nicolasandrescl.pythonanywhere.com đĄ
Hereâs what I accomplished:
â What Changed
Refactored the entire project structure into clearly separated layers:
routers/ for endpoints
repository/ for data access logic
schemas/ for Pydantic models
models/ for SQLAlchemy models
services/ for business logic
core/ for configuration and DB connections
Integrated a MySQL database using SQLAlchemy and PyMySQL for full persistence.
Switched to Pydantic v2, updating all .dict() references to .model_dump() to stay aligned with the latest standards.
Added error handling and validation, including custom messages and constraints (e.g. rejecting names under 3 characters).
Wrote an integration test for user creation using pytest + TestClient, and installed httpx, email-validator, cryptography, and other missing dependencies.
Resolved merge conflicts cleanly and pushed the finalized version to GitHub.
Updated the README.md with architecture overview, setup instructions, and feature highlights.
đ§ Whatâs Next?
Iâm preparing to deploy the API backend publicly so that visitors to my portfolio can see it in action. The /user/ endpoint will be testable directly from Swagger UI.
Live site: đ nicolasandrescl.pythonanywhere.com Repo: đ github.com/NicolasAndresCL/FastAPI
đ ïž Stack
FastAPI, SQLAlchemy, PyMySQL
MySQL, Pydantic v2, Uvicorn
Pytest, TestClient, HTTPX
đ§” Letâs Connect
If you're working on API design, backend structure, or transitioning to production, I'd love to exchange ideas!
Top comments (0)