{"id":22447290,"url":"https://github.com/yahrdev/fastapi_project","last_synced_at":"2026-04-18T17:04:29.238Z","repository":{"id":247759861,"uuid":"826773822","full_name":"yahrdev/fastapi_project","owner":"yahrdev","description":"This project is a backend application built with FastAPI and MySQL. It uses FastAPI Users (https://fastapi-users.github.io/fastapi-users/latest/) for user management and employs asynchronous programming for improved performance.","archived":false,"fork":false,"pushed_at":"2024-07-10T12:33:00.000Z","size":409,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T16:09:52.996Z","etag":null,"topics":["alembic","async","backend","fastapi","mysql","python","sqlalchemy"],"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/yahrdev.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}},"created_at":"2024-07-10T10:53:53.000Z","updated_at":"2024-07-10T15:12:54.000Z","dependencies_parsed_at":"2024-07-10T13:10:15.268Z","dependency_job_id":null,"html_url":"https://github.com/yahrdev/fastapi_project","commit_stats":null,"previous_names":["yahrdev/fastapi_project"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2Ffastapi_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2Ffastapi_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2Ffastapi_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2Ffastapi_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahrdev","download_url":"https://codeload.github.com/yahrdev/fastapi_project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245834735,"owners_count":20680067,"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":["alembic","async","backend","fastapi","mysql","python","sqlalchemy"],"created_at":"2024-12-06T04:15:39.988Z","updated_at":"2026-04-18T17:04:24.197Z","avatar_url":"https://github.com/yahrdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This project is a backend application built with FastAPI and MySQL. It provides endpoints for user registration, login, adding posts, retrieving posts, and deleting posts. The application follows the MVC design pattern and uses SQLAlchemy for database interactions. *It also uses **FastAPI Users (https://fastapi-users.github.io/fastapi-users/latest/)** for user management and employs asynchronous programming for improved performance.*\n\n\u003cimg src=\"fastapi_users_project.png\" width=\"700\"\u003e\n\n## API Endpoints\n\n### 1. login endpoint\n- **Description**: Allows users to sign up with their email and password.\n- **Inputs**: `email`, `password`\n- **Output**: Returns a token (JWT).\n\n### 2. register endpoint\n- **Description**: Authenticates users using their email and password.\n- **Inputs**: `email`, `password`\n- **Output**: Returns the user's data.\n\n### 3. AddPost endpoint\n- **Description**: Adds a new post.\n- **Inputs**: `text`, `token`\n- **Output**: Returns `postID`.\n- **Details**: Validates the payload size (the payload should not exceed 1 MB in size) and saves the post in memory.\n\n### 4. GetPosts endpoint\n- **Description**: Retrieves all posts added by the authenticated user.\n- **Inputs**: `token`\n- **Output**: Returns all posts added by the user.\n- **Details**: Implements response caching for consecutive requests from the same user for up to 5 minutes.\n\n### 5. DeletePost endpoint\n- **Description**: Deletes a specified post.\n- **Inputs**: `postID`, `token` (to authenticate the request)\n- **Output**: Confirms deletion of the corresponding post from memory.\n\n---------------------------------------------------------------------------------------------------------------\n\n## Moduls/programs used\n\n- Python and FastAPI: Core of the application.\n- MySQL: Database for storing user and post data.\n- Alembic: For database migrations.\n- Pydantic: For data validation.\n- JWT: For authentication.\n- FastAPI Users: For managing user registration, login, and authentication.\n- Asynchronous Programming: To handle concurrent requests efficiently.\n\n------------------------------------------------------------------------------------------------------------------\n\n## Requirements \n\n- Python 3.9 or higher installed.\n- MySQL server installed.\n\n------------------------------------------------------------------------------------------------------------------\n\n### Installation\n\nClone the repository:\n\n```bash\ngit clone \u003crepository_url\u003e\ncd fastapi_users_project\n```\n\nCreate and activate a virtual environment:\n\n```bash\npython -m venv venv\nsource venv/bin/activate   # On Windows use `venv\\Scripts\\activate`\n```\n\nInstall the required dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\nCreate a .env file in the project root with the following content:\n\n```bash\nDB_USER = your_db_user\nDB_PASS = your_db_password\nDB_HOST = localhost\nDB_NAME = fastapiproj\nDB_PORT = 3306\n\nMODE = PROD\n\nSECRET = your_secret_key\nJWT_LIFETIME_MINUTES = 30\n```\n\nSet up the database:\n\n```bash\nmysql -u root -p\nCREATE DATABASE fastapiproj;\n```\n\nUse Alembic to create the tables:\n\n```bash\nalembic revision --autogenerate -m \"Initial migration\"\nalembic upgrade head\n```\n\nStart the FastAPI application:\n\n```bash\nuvicorn src.main:app --host 0.0.0.0 --port 8000\n```\n\nAccess the application at http://localhost:8000. You can view the automatically generated API documentation at http://localhost:8000/docs.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahrdev%2Ffastapi_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahrdev%2Ffastapi_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahrdev%2Ffastapi_project/lists"}