{"id":19436580,"url":"https://github.com/mvarrone/fastapi-social-media-app","last_synced_at":"2025-04-14T18:41:47.437Z","repository":{"id":154841364,"uuid":"613053168","full_name":"mvarrone/fastapi-social-media-app","owner":"mvarrone","description":"FastAPI backend project about a social media app using API REST, Python 3, Postgres, Docker and OAuth2 ","archived":false,"fork":false,"pushed_at":"2023-04-02T15:06:13.000Z","size":50,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T07:11:15.542Z","etag":null,"topics":["api","api-rest","backend","docker","docker-compose","fastapi","python"],"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/mvarrone.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":"2023-03-12T18:45:48.000Z","updated_at":"2024-09-17T09:28:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"f139399c-fb8e-46b5-b79a-be0c791fd83f","html_url":"https://github.com/mvarrone/fastapi-social-media-app","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/mvarrone%2Ffastapi-social-media-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvarrone%2Ffastapi-social-media-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvarrone%2Ffastapi-social-media-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvarrone%2Ffastapi-social-media-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvarrone","download_url":"https://codeload.github.com/mvarrone/fastapi-social-media-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248938253,"owners_count":21186371,"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":["api","api-rest","backend","docker","docker-compose","fastapi","python"],"created_at":"2024-11-10T15:11:52.646Z","updated_at":"2025-04-14T18:41:47.410Z","avatar_url":"https://github.com/mvarrone.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Social Media App\n\nA social media web application built with FastAPI, PostgreSQL and *soon* Jinja2 Templates. This project is intended to demonstrate how to build a full-stack web application using modern web technologies.\n\n## Features\n\n- It allows to create, delete and update a post\n- It retrieves all of the available posts or just one by using an ID\n- User registration\n- Schemas implemented to validate input and output data\n- Users cannot update nor delete posts that do not own\n- Users can vote posts: Add and delete votes to a post\n- User authentication and authorization using JWT tokens.\n\nLanguage: Python v3.11.1\n\n## Tech stack\n\n1. Backend: FastAPI v0.92.0 FastAPI - Python web framework.\n2. Fronted: Jinja2 Templates will be implemented in order to build a frontend\n3. Testing: pytest v7.2.2 (fixtures, parametrization and HTML/CSS report)\n4. Containerization: Docker v20.10.23\n5. Alembic: v1.10.2\n6. Postman: v10.12.7 Collections and environment variables provided at [postman](https://github.com/mvarrone/fastapi-social-media-app/tree/main/postman) folder on this repository\n7. Database: PostgreSQL v15.2\n8. Models: SQLAlchemy v1.4.23\n9. Security:\n    - JWT and OAuth2 implementation\n    - Hashed passwords in database using passlib v1.7.4\n10. CI/CD: Implemented using GitHub Actions\n    - Build: \n        - Pull repo\n        - Install python 3\n        - Upgrade pip\n        - Install all dependencies\n        - Test\n        - Docker: Login to Docker Hub, build, push and digest the image\n\n    - Deploy:\n        - Deploy to a Ubuntu server on Digital Ocean\n\n## Getting started: Without Docker\n\na) Clone repository into your machine\n\n```md\ngit clone https://github.com/mvarrone/fastapi-social-media-app.git\ncd fastapi-social-media-app\n```\n\nb) Create a virtual environment\n\n\u003cdetails\u003e\n\u003csummary\u003eOn Windows\u003c/summary\u003e\n1.Creating a virtual environment\n\n```md\npython -m venv venv\n```\n\n2.Activating it\n\na) Using CMD\n\n```md\n.\\venv\\Scripts\\activate.bat\n```\n\nb) Using PowerShell\n\n```md\n.\\venv\\Scripts\\Activate.ps1\n```\n\n3.Installing dependencies\n\n```md\npip install -r requirements.txt\n```\n\n4.(OPTIONAL) Deactivating the virtual environment\n\n```md\ndeactivate\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eOn Linux/Mac\u003c/summary\u003e\n1. Creating a virtual environment\n\n```md\npython3 -m venv venv\n```\n\n2.Activating it\n\n```md\nsource venv/bin/activate\n```\n\n3.Installing dependencies\n\n```md\npip install -r requirements.txt\n```\n\n4.(OPTIONAL) Deactivating the virtual environment\n\n```md\ndeactivate\n```\n\u003c/details\u003e\n\nc) Run app\n\n```md\nuvicorn app.main:app --host 0.0.0.0 --port 8000 \n```\n\n## Getting started: With Docker\na) Clone repository\n\n```md\ngit clone https://github.com/mvarrone/fastapi-social-media-app.git\ncd fastapi-social-media-app\n```\n\nb) Start\n```md\ndocker compose -f .\\docker-compose-dev.yml up -d\n```\n\nb) Stop\n```md\ndocker compose -f .\\docker-compose-dev.yml down\n```\n\n## Documentation\n1. Swagger UI\n\n    ```linux\n    http://localhost:8000/docs\n    ```\n2. Redocly\n\n    ```linux\n    http://localhost:8000/redoc\n    ```\n\n\u003e Note 1: Credentials for documentation\n\nI have added some security level to the documentation. For that, both cases require the following credentials to be used:\n- Username: admin\n- Password: pass\n\n    Stored at the .env file\n\n\u003e Note 2: About .env file\n\nA ```.env``` file has been provided to facilitate the implementation and testing of this project. The reason to include this file is that it is a publicly available project on the Internet\n\n\u003e Note 3: About this project\n\nProject learnt from [fastapi-course](https://github.com/Sanjeev-Thiyagarajan/fastapi-course) by Sanjeev Thiyagarajan\n\n## Next improvements\n\n    1) Implement a simple frontend using Jinja2 Templates\n    2) Finish deploy to Digital Ocean\n    3) Postman:\n        - Create one example for each request\n        - Create Tests for each request (based on status code)\n        - Implement a Postman Flow\n        - Export collection data\n        - Export environment data\n    4) Implement roles: admin and user\n    5) Add documentation credentials to a db or json file (implement a hashed password)\n\n## Contributing\nContributions to this project are welcome. If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request.\n\n## License\nThis project is licensed under the MIT License. See the [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvarrone%2Ffastapi-social-media-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvarrone%2Ffastapi-social-media-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvarrone%2Ffastapi-social-media-app/lists"}