This project is a FastAPI-based Blog API designed for managing blog posts, users, and comments. It supports RESTful operations, uses a database for persistence, and provides Docker support for deployment.
- User authentication and authorization by using PyJWT
- Blog post creation, retrieval, update, and deletion
- postgresql as database and SQLAlchemy as orm
- Database migrations using Alembic
- Easy deployment with Docker and Docker Compose
- Environment variable configuration for secure setup
- CI/CD pipeline setup using GitHub Actions for automated deployment and testing
- Comprehensive testing suite
Ensure you have the following installed:
- Python 3.10 or later
- Docker and Docker Compose (optional for containerized setup)
- A compatible OS (Ubuntu is recommended)
git clone <repository-url>
cd data-co-lab_blog_apimv env.example .envecho "SECRET_KEY=$(openssl rand -hex 32)" >> .envdocker compose up --build # docker-compose up --build for older version 127.0.0.1:7070/docs Move project file to server:
- make sure how setup .env file
- spin up project's docker
- requests are served on port 7070.
│
├── app.py # Main application file
├── core/ # Core application logic
| └── init.py
| └── users # users code base and logic
| └── post # posts code base and logic
├── config.py # Application configuration
├── database.py # Database initialization
├── dependencies.py # Dependency management
├── alembic/ # Database migrations
├── tests/ # Test suite
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── requirements.txt # Python dependencies
├── .env # Environment variables (excluded in version control)
├── .github/ # GitHub Actions workflow configuration
│ └── workflows/
│ └── ci-cd.yml # GitHub Actions CI/CD pipeline configuration