A FastAPI backend application with modular architecture, featuring user authentication, email verification, and JWT token management.
- User registration with email verification
- OTP-based email verification
- JWT-based authentication (access and refresh tokens)
- Modular architecture with clean separation of concerns
- Docker containerization
- Auto-reload during development - Changes to code automatically refresh the container
.
├── blog_app/
│ ├── api/ # API endpoints
│ ├── core/ # Configuration and security
│ ├── crud/ # Database operations
│ ├── db/ # Database models and session
│ ├── decorators/ # JWT decorators
│ ├── schemas/ # Pydantic models
│ └── utils/ # Utility functions (email, etc.)
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker services
└── requirements.txt # Python dependencies
- Docker and Docker Compose
- Python 3.11+
- External PostgreSQL server (local or remote)
- Gmail account with App Password for email functionality
- Clone the repository:
git clone <repository-url>
cd blog-app-backend-
Configure environment variables:
- Copy
env.exampleto.env - Update
.envwith your Gmail credentials and external MySQL connection details - Set a secure
SECRET_KEY
- Copy
-
Start the container:
# Start basic services
docker-compose up -d-
Ensure your PostgreSQL server is running and accessible
-
Access the API:
- API: http://localhost:8000
- Documentation: http://localhost:8000/docs
POST /api/auth/signup- User registrationPOST /api/auth/verify- Email verification with OTPPOST /api/auth/login- User login
This project is licensed under the MIT License.