This repository contains a full-featured blogging application built with FastAPI, SQLAlchemy, and PostgreSQL. The application is designed to provide a foundation for a modern web application, including user authentication, CRUD operations for blog posts, and more.
- Features
 - Installation
 - Running the Application
 - Running Tests
 - Project Structure
 - Environment Variables
 - License
 
- User Authentication: Secure user authentication with password hashing.
 - CRUD Operations: Create, read, update, and delete posts and user profiles.
 - Dependency Injection: Efficient dependency management using FastAPI's dependency injection system.
 - Asynchronous Support: Leverages Python's 
asynciofor non-blocking I/O operations. - Database Integration: Uses SQLAlchemy as the ORM and PostgreSQL as the database.
 - Testing: Comprehensive test suite using 
pytest, including fixtures for setup and teardown. 
To get started with this project, follow the steps below:
- Python 3.9+
 - PostgreSQL
 virtualenv(optional but recommended)
git clone https://github.com/KiyoshiSama/fastapi-blog-sqlalchemy-v2.git
cd fastapi-blog-sqlalchemy-v2python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`pip install -r requirements.txtBefore running the application, you need to set up the database and configure environment variables.
- Ensure PostgreSQL is running on your machine.
 - Create a new PostgreSQL database.
 
psql -U postgres
CREATE DATABASE fastapi_blog;Create a ".env" file in the root directory of the project and add the following configuration. Adjust the values according to your setup:
DATABASE_URL=postgresql+asyncpg://<username>:<password>@localhost:5432/fastapi_blog
SECRET_KEY=<your_secret_key>
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30alembic upgrade headuvicorn app.main:app --reloadThis project uses "pytest" for testing. To run the tests, use the following command:
pytestThis project is licensed under the MIT License. See the LICENSE file for more information.