This is a FastAPI-based newsletter subscription service integrated with Resend.com for email management.
-
Clone the repository:
git clone <repository_url> cd <repository_name>
-
Install the required dependencies:
pip install poetry poetry install
-
Set up environment variables: Create a
.env
file in the root directory and add the following variables:RESEND_API_KEY=your_resend_api_key_here RESEND_AUDIENCE_ID=your_resend_audience_id_here
-
Customize email templates: Edit the
welcome_email_template.html
file to customize the welcome email sent to new subscribers.
-
Start the FastAPI server:
poetry run python main.py
-
Access the application: Open a web browser and navigate to
http://localhost:8000
to view the subscription form and analytics dashboard.
- Newsletter subscription and unsubscription
- Welcome email sent to new subscribers
- Rate limiting to prevent abuse
- Analytics dashboard
- Customizable email templates
POST /subscribe
: Subscribe a new userPOST /unsubscribe
: Unsubscribe a userGET /analytics
: Get subscription analyticsGET /preferences/{email}
: Get subscriber preferences
To run the application in development mode with auto-reloading:
uvicorn main:app --reload
This application is designed to be deployed on Replit. Follow these steps to deploy:
- Create a new Repl on Replit
- Upload the project files to the Repl
- Set up the environment variables in the Repl's Secrets tab
- Click on the "Run" button to start the application
The application will be accessible via the URL provided by Replit.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.