This is a Flask-based web application that allows nonprofit organizations to register and generate shortened URLs and QR codes for their donation pages. The app also logs redirection events for future analysis.
The app uses an external service called CharityAPI.org (https://www.charityapi.org/) to validate the non-profit EINs. Get your API key and plug it into the .env file.
Note: This repo is currently a work in progress and may contain bugs or unfinished features. Please use with caution and feel free to submit issues or pull requests.
- Clone the repository
- Create a virtual environment for the app using
python -m venv venv
- Activate the virtual environment using
source venv/bin/activate
on Unix/MacOS orvenv\Scripts\activate
on Windows. - Install the required packages using
pip install -r requirements.txt
- Set up your
.env
file with the required configuration variables (example provided in the.env.example
file) - Run the Flask app using
flask run
Use the provided API endpoints to register nonprofits, generate short URLs and QR codes, and redirect users to the long URLs.
-
Method: POST
-
Description: Register a new nonprofit organization
-
Sample cURL command:
curl -X POST "http://localhost:5000/register" -H "Content-Type: application/json" -d '{"name": "Test Nonprofit", "email": "test@example.com", "password": "test_password", "long_url": "https://example.com/donate", "ein": "12-3456789"}'
- Method: POST
- Description: Authenticate the nonprofit and return a JWT token (Not implemented yet)
-
Method: GET
-
Description: Redirects the user to the long URL associated with the short URL
-
Sample cURL command:
curl -X GET "http://localhost:5000/abcdefgh"
- Implement the /login endpoint for user authentication and JWT token generation.