{"id":34979692,"url":"https://github.com/persteenolsen/fastapi-auth-demo","last_synced_at":"2026-04-14T15:33:27.225Z","repository":{"id":329391713,"uuid":"1119390350","full_name":"persteenolsen/fastapi-auth-demo","owner":"persteenolsen","description":"Python FastAPI serving Authentication by JWT towards a PostgreSQL Database","archived":false,"fork":false,"pushed_at":"2026-02-13T09:04:35.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-13T17:13:39.010Z","etag":null,"topics":["alembic","fastapi","postgresql","python"],"latest_commit_sha":null,"homepage":"https://fastapi-auth-demo.vercel.app/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":"security/__init__.py","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":"2025-12-19T07:42:48.000Z","updated_at":"2026-02-13T09:04:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/persteenolsen/fastapi-auth-demo","commit_stats":null,"previous_names":["persteenolsen/fastapi-auth-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/persteenolsen/fastapi-auth-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-auth-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-auth-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-auth-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-auth-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/persteenolsen","download_url":"https://codeload.github.com/persteenolsen/fastapi-auth-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/persteenolsen%2Ffastapi-auth-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31803455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["alembic","fastapi","postgresql","python"],"created_at":"2025-12-27T00:55:25.825Z","updated_at":"2026-04-14T15:33:27.220Z","avatar_url":"https://github.com/persteenolsen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python + FastAPI + PostgreSQL + Alembic + SQLAlchemy and JWT Authentication \n\nA REST API that serves Registration + JWT Authentication\n\nLast updated:\n\n- 28-03-2026\n\nPython Version:\n\n- 3.12\n\n# Get startet\n\n- Clone the repository from my GitHub \n\n- Create a virtual environment by Powershell or VS Code:\n\n\"python -m venv \u003cname_of_venv\u003e\"\n\n- Go to the virtual environment's directory and activate it:\n\n\"Scripts/activate\"\n\n- Install the requirements:\n\n\"pip3 install -r requirements.txt\"\n\n# Try the Vue 3 frontend for testing the Web API\n\n- [`The Vue 3 Client at GitHub`](https://github.com/persteenolsen/vue-fastapi-jwt-auth-client) - The Vue 3 Client using JWT Authentication\n\n# Swagger documentation / Testing the API\n\nFastAPI provides the Swagger documentation of the API where you can perform CRUD operations\n\nTo access the documentation, we must run uvicorn:\n\n\"uvicorn main:app --reload\"\n\nIf everything works fine, the FastAPI and Swagger documentation is now available at: \n\n`http://127.0.0.1:8000/docs`\n\n- Use the Swagger for Register a User in the PostgreSQL DB and try to perform Login operations\n\n- You can go to the PostgreSQL at Neon to test your data in the DB\n\nWhen you make a change to the models and start run the Web App the PostgreSQL should be updated\n\n# JWT Authentication\n\n- The token will expire after 5 minutes for testing and demo. Then a 401 status will happen\n\n# The structure of the API by folders for scalability\n\n- The Database functionality is placed in files inside the directory db\n\n- The User Routes are placed in files inside the directory routes/user.py\n\n- The simple Routes are placed in files inside the directory routes/simple.py\n\n- The Models are placed in files inside the directory models\n\n- The Schemas are placed in files inside the directory schemas\n\n- The functionality of authentication is placed inside the directory security\n\n- The functionality like get current user, called from the Routes, is placed inside the directory services\n\n# Migration with Alembic\n\n- Install and use Alembic for Migration and run:\n\n- alembic init alembic\n\n- For demonstration I added name in the User Model and Schema and generated and applied migration:\n\n- alembic revision --autogenerate -m \"create column name\"\n\n- alembic upgrade head\n\n- Then run the FastAPI again and check that everything works fine\n\n# Deployment to Vercel\n\n- Take a look at the file \"vercel.json\"\n\n- Create a Project at Vercel from your repository at GitHub with the code of this FastAPI\n\n- Create the envirement variables from .env at Vercel with the connection to PostgreSQL\n\n- Make a commit to your GitHub\n\n- Go to Vercel and check that the build and deployment happened and your site is in Production\n\nHappy use of FastAPI :-)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersteenolsen%2Ffastapi-auth-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpersteenolsen%2Ffastapi-auth-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersteenolsen%2Ffastapi-auth-demo/lists"}