{"id":50928360,"url":"https://github.com/persteenolsen/fastapi-jwt-auth-render-three","last_synced_at":"2026-06-17T01:31:10.272Z","repository":{"id":361591391,"uuid":"1255037105","full_name":"persteenolsen/fastapi-jwt-auth-render-three","owner":"persteenolsen","description":"FastAPI with JWT Auth using MariaDB hosted at Render","archived":false,"fork":false,"pushed_at":"2026-05-31T11:29:03.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T12:15:10.953Z","etag":null,"topics":["fastapi","jwt","mariadb","python"],"latest_commit_sha":null,"homepage":"https://fastapi-jwt-auth-render-three.onrender.com/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/persteenolsen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T10:18:29.000Z","updated_at":"2026-05-31T11:29:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/persteenolsen/fastapi-jwt-auth-render-three","commit_stats":null,"previous_names":["persteenolsen/fastapi-jwt-auth-render-three"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/persteenolsen/fastapi-jwt-auth-render-three","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-jwt-auth-render-three","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-jwt-auth-render-three/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-jwt-auth-render-three/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-jwt-auth-render-three/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/persteenolsen","download_url":"https://codeload.github.com/persteenolsen/fastapi-jwt-auth-render-three/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-jwt-auth-render-three/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34430688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","jwt","mariadb","python"],"created_at":"2026-06-17T01:31:09.620Z","updated_at":"2026-06-17T01:31:10.252Z","avatar_url":"https://github.com/persteenolsen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 FastAPI + Render + MariaDB + JWT Authentication (Alembic Ready)\n\nLast updated\n\n- 03-06-2026\n\n# Version\n\nAt Render I use the PYTHON_VERSION environment variable to tell Render to use Python version 3.11. Locally I am using Python 3.12\n\nA production-ready backend built with FastAPI, MariaDB (HelioHost), JWT authentication, bcrypt password hashing, and Alembic migrations hosted at Render.\n\n---\n\n## 🧱 Tech Stack\n\n- FastAPI\n- Hosted at Render\n- MariaDB (HelioHost)\n- SQLAlchemy ORM\n- Alembic (migrations)\n- JWT Authentication (python-jose)\n- bcrypt\n- Uvicorn\n- PyMySQL driver\n\n---\n\n## ✨ Features\n\n- User registration (DEV mode only)\n- Secure password hashing (bcrypt)\n- JWT login system\n- Protected routes\n- MariaDB cloud database (HelioHost)\n- Alembic migrations\n- Swagger UI testing\n\n---\n\n## 📦 Setup \u0026 Installation\n\n### Clone repository\ngit clone https://github.com/your-username/your-repo.git\ncd your-repo\n\n### Create virtual environment\npython -m venv .venv\n\n### Activate virtual environment\n\nWindows:\n.venv\\Scripts\\activate\n\nMac/Linux:\nsource .venv/bin/activate\n\n### Install dependencies\npip install -r requirements.txt\n\n---\n\n## ⚙️ Environment Variables\n\nCreate a `.env` file:\n\nDATABASE_URL=mysql+pymysql://USER:PASSWORD@HOST:3306/DATABASE  \nSECRET_KEY=your-secret-key  \nALGORITHM=HS256  \nACCESS_TOKEN_EXPIRE_MINUTES=30  \nDEV_MODE=true  \n\n---\n\n## 🗄️ Database (Alembic)\n\nInitialize Alembic:\nalembic init alembic\n\nCreate migration:\nalembic revision --autogenerate -m \"create users table\"\n\nApply migration:\nalembic upgrade head\n\n---\n\n## 🚀 Run the server\n\nuvicorn app:app --reload\n\n---\n\n## 🌐 API Endpoints\n\nRegister user (DEV ONLY):\nPOST /register\n\n{\n  \"email\": \"user@example.com\",\n  \"password\": \"12345678\"\n}\n\n---\n\nLogin:\nPOST /token\n\n- username = email\n- password = password\n\n---\n\nProtected route:\nGET /protected\n\nAuthorization:\nBearer YOUR_TOKEN\n\n---\n\n## 📚 Swagger UI\n\nhttp://127.0.0.1:8000/docs\n\n---\n\n## 🧠 Architecture\n\nFastAPI → SQLAlchemy → MariaDB (HelioHost)\n→ Alembic migrations\n→ bcrypt + JWT authentication\n\n---\n\n## 🔐 Security\n\n- bcrypt password hashing\n- JWT authentication\n- Environment variables\n- No hardcoded secrets\n- DEV_MODE protection for user creation\n\n---\n\n## ☁️ Deployment Notes\n\nRender Start Command:\n\ngunicorn app:app -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:$PORT\n\nBefore deploying:\n- Run migrations locally:\n  alembic upgrade head\n\n- Set environment variables in Render\n\n---\n\n## 📌 Important\n\n- Do NOT use create_all()\n- Always use Alembic migrations\n- Ensure MariaDB connection uses PyMySQL:\n  mysql+pymysql://USER:PASSWORD@HOST:3306/DB\n\n---\n\n## 📜 License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersteenolsen%2Ffastapi-jwt-auth-render-three","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpersteenolsen%2Ffastapi-jwt-auth-render-three","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersteenolsen%2Ffastapi-jwt-auth-render-three/lists"}