{"id":15187253,"url":"https://github.com/yaojiach/docker-flask","last_synced_at":"2025-10-02T01:31:21.026Z","repository":{"id":39827392,"uuid":"79972469","full_name":"yaojiach/docker-flask","owner":"yaojiach","description":"Docker NGINX Flask JWT","archived":true,"fork":false,"pushed_at":"2022-05-25T05:19:06.000Z","size":484,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-28T18:05:51.609Z","etag":null,"topics":["docker","flask","gunicorn","jwt","nginx","psql","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yaojiach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-25T01:31:21.000Z","updated_at":"2024-05-15T09:52:44.000Z","dependencies_parsed_at":"2022-09-16T07:41:14.509Z","dependency_job_id":null,"html_url":"https://github.com/yaojiach/docker-flask","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaojiach%2Fdocker-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaojiach%2Fdocker-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaojiach%2Fdocker-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaojiach%2Fdocker-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaojiach","download_url":"https://codeload.github.com/yaojiach/docker-flask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234922785,"owners_count":18907828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","flask","gunicorn","jwt","nginx","psql","python"],"created_at":"2024-09-27T18:06:30.407Z","updated_at":"2025-10-02T01:31:15.746Z","avatar_url":"https://github.com/yaojiach.png","language":"Python","readme":"# Docker Flask Boilerplate\n\n**Tested on Mac, Linux, Windows**\n\n`Docker` + `Flask` + `JWT` boilerplate with `gunicorn`, `nginx`, and external (dockerized for dev) `Postgres` database. Good for quickly set up an authentication backend (for example for a frontend development). Implemented user registration, user login, access token, refresh token, and token revocation.\n\n* Use `Pipfile` for dependency management.\n* Use `Flask-Restful` as the REST API framework.\n* Use `Flask-JWT-Extended` as the (opinionated) JWT framework. Including features like `refresh token` and `token revoking`.\n\n## Features\n\n* Docker\n* nginx\n* gunicorn\n* flask\n* jwt\n* Postgres\n* redis (Used to store jwt token information)\n\n## Non-Features\n\n* external `Postgres`\n* Dockerized `Postgres` for dev\n\n## Usage\n\nDev with dockerized `Postgres`\n\n```sh\ndocker-compose --file docker-compose-dev.yml up --build\n```\n\nStand up external `Postgres` database\n\n```sh\nbash db/init.sh\n```\n\nBuild containers\n\n```sh\ndocker-compose up --build\n```\n\nFull clean up (remove `Postgres` volume)\n\n```sh\ndocker stop $(docker ps -a -q)\ndocker-compose rm -fs\ndocker system prune\nrm -rf postgres_data\n```\n\nUser Registration example\n\n```json\n{\n    \"email\": \"test@test.com\",\n    \"password\": \"12345\"\n}\n```\n\nExample in `Postman`:\n\n![Registration Example](https://github.com/yaojiach/docker-flask-boilerplate/blob/master/postman-example.png)\n\n## Gotchas\n\nSet `PROPAGATE_EXCEPTIONS` to propagate exceptions from `flask-jwt-extended`\n\n```python\nclass Config:\n    ...\n    PROPAGATE_EXCEPTIONS = True\n```\n\nMust include `Pipfile.lock` for `pipenv` to install system-wide in docker\n\n```dockerfile\n...\nCOPY Pipfile.lock /home/project/web\n...\n```\n\nUse `host.docker.internal` inside container to access host machine's localhost\n\n```sh\nDATABASE_URL=postgresql://dev:12345@host.docker.internal:5432/jwt\n```\n\n## Caveats\n\n* Should use external `redis` for production\n\n## References\n\n* https://github.com/oleg-agapov/flask-jwt-auth\n* https://github.com/sladkovm/docker-flask-gunicorn-nginx\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaojiach%2Fdocker-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaojiach%2Fdocker-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaojiach%2Fdocker-flask/lists"}