{"id":28218879,"url":"https://github.com/twfksh/assesment-python-flask-api","last_synced_at":"2025-08-13T06:14:12.150Z","repository":{"id":293265727,"uuid":"983212910","full_name":"twfksh/assesment-python-flask-api","owner":"twfksh","description":"A simple authentication API built with Flask, SQLModel, and JWT","archived":false,"fork":false,"pushed_at":"2025-05-15T09:33:04.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T05:42:59.351Z","etag":null,"topics":["flask","flask-api","jwt-authentication","python","python3","sqlite3","sqlmodel"],"latest_commit_sha":null,"homepage":"","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/twfksh.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}},"created_at":"2025-05-14T03:52:07.000Z","updated_at":"2025-05-15T09:33:59.000Z","dependencies_parsed_at":"2025-05-14T13:58:37.895Z","dependency_job_id":"ecba7e67-0fb8-4e30-b865-0c2fe0a24e29","html_url":"https://github.com/twfksh/assesment-python-flask-api","commit_stats":null,"previous_names":["twfksh/assesment-python-flask-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/twfksh/assesment-python-flask-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-flask-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-flask-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-flask-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-flask-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twfksh","download_url":"https://codeload.github.com/twfksh/assesment-python-flask-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twfksh%2Fassesment-python-flask-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270191647,"owners_count":24542279,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"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":["flask","flask-api","jwt-authentication","python","python3","sqlite3","sqlmodel"],"created_at":"2025-05-18T02:10:46.525Z","updated_at":"2025-08-13T06:14:12.121Z","avatar_url":"https://github.com/twfksh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask Auth API\n\nA simple authentication API built with Flask, SQLModel, and JWT. This project provides user registration, login, token-based authentication, and user management endpoints.\n\n## Features\n\n- User registration and login with hashed passwords\n- JWT-based authentication (access and refresh tokens)\n- Token revocation (logout)\n- User listing and retrieval\n- Pydantic validation for request data\n- SQLModel ORM for database access with validation\n\n## Project Structure\n\n- [`app.py`](app.py): Application entry point and Flask app setup\n- [`components.py`](components.py): API route definitions (register, login, logout, user management)\n- [`services.py`](services.py): Business logic for authentication and user management\n- [`models.py`](models.py): SQLModel database models (`User`, `TokenBlocklist`)\n- [`schemas.py`](schemas.py): Pydantic schemas for request validation\n- [`database.py`](database.py): Database engine and initialization\n- `.env.sample`: Example environment variables\n\n## Setup\n\n1. **Clone the repository**\n    ```sh\n    git clone https://github.com/twfksh/assesment-python-flask-api\n    cd assesment-python-flask-api\n    ```\n\n2. **Install dependencies**\n\n   ```sh\n   uv venv\n   uv pip install -r requirements.txt\n   ```\n\n3. **Configure environment variables**\n\n   Copy `.env.sample` to `.env` and fill in the required values:\n\n   ```\n   cp .env.sample .env\n   ```\n\n   Set at least:\n   - `SQLMODEL_DATABASE_URL`\n   - `FLASK_SECRET_KEY`\n   - `FLASK_JWT_SECRET_KEY`\n\n4. **Initialize the database**\n\n   The database tables are created automatically on app startup.\n\n5. **Run the application**\n\n   ```sh\n   uv run flask run\n   ```\n\n## API Endpoints\n\n### Auth\n\n- `POST /api/auth/register`  \n  Register a new user.  \n  **Body:** `{ \"username\": \"user\", \"password\": \"password\" }`\n\n- `POST /api/auth/login`  \n  Login and receive access/refresh tokens.  \n  **Body:** `{ \"username\": \"user\", \"password\": \"password\" }`\n\n- `GET /api/auth/whoami`  \n  Get current user info (JWT required).\n\n- `GET /api/auth/refresh`  \n  Refresh access token (refresh JWT required).\n\n- `GET /api/auth/logout`  \n  Logout and revoke the current token.\n\n### Users\n\n- `GET /api/users/all`  \n  List all users (JWT required).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwfksh%2Fassesment-python-flask-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwfksh%2Fassesment-python-flask-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwfksh%2Fassesment-python-flask-api/lists"}