-
This application is a web service built using FastAPI, SQLAlchemy, and Alembic. It provides a robust and efficient API for Social Media Posting.
-
The application is designed to handle multiple users, posts, and comments, with features for creating, reading, updating, and deleting (CRUD) operations.
-
The Application is live at Fastapi-Socio
- FastAPI: A modern, fast (high-performance), web framework for building APIs with Python.
- SQLAlchemy: SQL toolkit and Object-Relational Mapping (ORM) system.
- Alembic: Database migration tool for SQLAlchemy.
- Python 3.7+
- PostgreSQL or your preferred database
- Virtual environment tool (e.g.,
venv
)
- Clone the repository and navigate to the project directory.
- Create a virtual environment and activate it.
- Install the required dependencies using
pip
. - Configure the necessary environment variables in a
.env
file, such as the database URL. - Run the database migrations using Alembic.
- Start the FastAPI application using Uvicorn. The API will be available at
http://127.0.0.1:8000
.
- GET /posts/: Fetch a list of posts.
- POST /posts/: Create a new post.
- PUT /posts/{id}: Update an existing post.
- DELETE /posts/{id}: Delete a post.
For detailed API documentation, visit /docs
or /redoc
when the application is running.
After modifying the SQLAlchemy models, create a new migration with Alembic and apply it.
Run tests using pytest
.