Welcome to the FastAPI project! This modern web application leverages the high-performance capabilities of FastAPI, a powerful framework for building APIs with Python 3.9+. The application integrates various essential functionalities like AWS S3 storage, model relations, background tasks, email handling, and secure JWT authentication, making it a comprehensive solution for web development.
- FastAPI Framework: Utilize the speed and simplicity of FastAPI to build robust RESTful APIs.
- AWS S3 Integration: Seamlessly store and retrieve files using Amazon S3. 📁
- JWT Authentication: Securely authenticate users with JSON Web Tokens. 🔒
- Relational Models: Define and manage one-to-many and many-to-many relationships between database models. 🔄
- Background Tasks: Execute time-consuming tasks in the background without disrupting the main application flow. ⏳
- Email Functionality: Send emails asynchronously as part of background tasks. 📧
- File Handling: Efficiently handle file uploads and downloads within your application. 📄
- Custom Responses: Tailor API responses to enhance user experience. ✨
To set up and run this FastAPI application, follow these steps:
-
Clone the Repository:
git clone https://github.com/yourusername/yourprojectname.git cd yourprojectname
-
Install Dependencies:
Use pip to install the required packages:
pip install -r requirements.txt
-
Set Up Environment Variables:
Configure the necessary environment variables to enable key functionalities:
AWS_ACCESS_KEY_ID
: Your AWS S3 access key ID.AWS_SECRET_ACCESS_KEY
: Your AWS S3 secret access key.AWS_BUCKET_NAME
: The name of your AWS S3 bucket.DATABASE_URL
: The connection URL for your database.EMAIL_USER_NAME
: The username for the email account used to send emails.EMAIL_USER_PASSWORD
: The password for the email account used to send emails.JWT_SECRET_KEY
: The secret key used to sign JWT tokens.JWT_REFRESH_SECRET_KEY
: The secret key used to refresh JWT tokens.
-
Start the Application:
You can start the FastAPI application using either of the following commands:
-
Using Uvicorn directly:
uvicorn main:app --reload
-
Using Docker Compose:
docker-compose up --build
-
Once the application is running, navigate to http://localhost:8000/docs
in your web browser to explore the interactive API documentation provided by FastAPI's built-in Swagger UI. Here, you can test the API endpoints and see how they work.