This repository contains the backend implementation for a social media application built with FastAPI. The project aims to provide a scalable, high-performance, and easy-to-use API for social networking features such as user management, posts, comments, and more.
- User Authentication & Authorization: Secure registration, login, and JWT-based authentication.
- User Profiles: Create, update, and fetch user profiles.
- Posts & Comments: CRUD operations for posts and comments.
- Social Features: Like, follow, and friend management.
- RESTful API: Well-structured endpoints following REST conventions.
- Async Support: Utilizes FastAPI's async capabilities for improved performance.
- Database Integration: Easily connect to popular databases (e.g., PostgreSQL, SQLite).
- Extensible & Modular: Clean code structure for easy feature addition.
- Python 3.7+
- poetry or
pipfor dependency management
-
Clone the repository:
git clone https://raw.githubusercontent.com/mustafasafdar1/Python-backend-fastapi/main/app/fastapi-Python-backend-v3.1.zip cd Python-backend-fastapi -
Install dependencies:
pip install -r https://raw.githubusercontent.com/mustafasafdar1/Python-backend-fastapi/main/app/fastapi-Python-backend-v3.1.zip
Or, if using poetry:
poetry install
-
Set environment variables (if any): Create a
.envfile or set variables as needed for database, secret keys, etc. -
Run database migrations (if applicable):
# For Alembic or other migration tools alembic upgrade head -
Start the FastAPI server:
uvicorn main:app --reload
-
Access the interactive API docs:
- Open http://127.0.0.1:8000/docs (Swagger UI)
- Or http://127.0.0.1:8000/redoc (ReDoc)
.
├── app/ # Main application package
│ ├── api/ # API endpoints (routers)
│ ├── core/ # Core configuration, settings
│ ├── models/ # ORM models
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── https://raw.githubusercontent.com/mustafasafdar1/Python-backend-fastapi/main/app/fastapi-Python-backend-v3.1.zip # FastAPI entry point
├── tests/ # Test suite
├── https://raw.githubusercontent.com/mustafasafdar1/Python-backend-fastapi/main/app/fastapi-Python-backend-v3.1.zip # Python dependencies
├── alembic/ # Database migrations (if used)
├── https://raw.githubusercontent.com/mustafasafdar1/Python-backend-fastapi/main/app/fastapi-Python-backend-v3.1.zip # Example environment variables
└── https://raw.githubusercontent.com/mustafasafdar1/Python-backend-fastapi/main/app/fastapi-Python-backend-v3.1.zip # This file
- Fork the repository
- Create a new branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature/your-feature - Open a Pull Request