A romantic REST API that serves random sweet nothings, compliments, and affectionate phrases. Perfect for building romantic apps, sending automated love notes, or just spreading some digital affection!
π Live Demo: https://sweet.swakes.codes
- π― Gender-Specific Categories: Get sweet nothings tailored for male, female, or neutral audiences
- β‘ Fast & Lightweight: Built with FastAPI for high performance
- π Rate Limited: Prevents abuse with built-in rate limiting (120 requests/minute)
- π³ Docker Ready: Includes Dockerfile and docker-compose for easy deployment
- π Custom Swagger UI: Beautiful, branded API documentation
- π² Random Selection: Get completely random phrases or filter by category
- β€οΈ 100+ Phrases: Extensive collection of romantic messages across all categories
- Clone the repository:
git clone https://github.com/yourusername/sweet-nothings-api.git
cd sweet-nothings-api- Build and run with Docker Compose:
docker-compose up -d- Access the API:
- Swagger UI: http://localhost:8000
- API Endpoint: http://localhost:8000/sn
- Install dependencies:
pip install -r requirements.txt- Run the server:
python main.pyOr with uvicorn:
uvicorn main:app --reload --host 0.0.0.0 --port 8000Get a random sweet nothing.
Query Parameters:
gender(optional):male,female, orneutral(default:neutral)
Example Request:
curl "http://localhost:8000/sn?gender=female"Example Response:
{
"sweet_nothing": "Your smile lights up my entire world",
"gender": "female",
"total_available": 100
}Get a completely random sweet nothing from any gender category.
Example Request:
curl "http://localhost:8000/random"Get all available gender categories and counts.
Example Response:
{
"genders": ["male", "female", "neutral"],
"counts": {
"male": 100,
"female": 100,
"neutral": 136
},
"total_genders": 3,
"total_sweet_nothings": 336
}Health check endpoint.
Example Response:
{
"status": "healthy",
"service": "Sweet Nothings as a Service",
"version": "1.5.0",
"total_sweet_nothings": 336
}| Variable | Description | Default |
|---|---|---|
ALLOWED_ORIGINS |
CORS allowed origins (comma-separated) | * (all origins) |
PORT |
Server port | 8000 |
Example - Restrict CORS:
export ALLOWED_ORIGINS="https://yourdomain.com,https://www.yourdomain.com"
docker-compose up -dOr in docker-compose.yml:
environment:
- ALLOWED_ORIGINS=https://yourdomain.com,https://www.yourdomain.comdocker build -t sweet-nothings-api .docker run -d \
-p 8000:8000 \
-e ALLOWED_ORIGINS="*" \
--name sweet-nothings \
sweet-nothings-api# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downsweet-nothings-api/
βββ main.py # FastAPI application
βββ sweet_nothings.py # Database of phrases
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker Compose configuration
βββ start.sh # Startup script
βββ test_api.py # API tests
βββ templates/
β βββ swagger_ui.html # Custom Swagger UI
βββ logo.png # API logo
python test_api.pyEdit sweet_nothings.py and add phrases to the appropriate category:
SWEET_NOTHINGS = {
"male": [
"Your new sweet nothing here",
# ... more phrases
],
"female": [
"Your new sweet nothing here",
# ... more phrases
],
"neutral": [
"Your new sweet nothing here",
# ... more phrases
]
}- Rate Limiting: 120 requests/minute per IP for main endpoints
- Non-root Docker User: Container runs as unprivileged
appuser - CORS Configuration: Configurable allowed origins
- Input Validation: Strict parameter validation
- Health Monitoring: Built-in health check endpoint
| Endpoint | Limit |
|---|---|
/sn |
120/minute |
/random |
120/minute |
/genders |
60/minute |
/health |
Unlimited |
Contributions are welcome! Here are some ways you can contribute:
- Add More Phrases: Submit PRs with new sweet nothings
- Improve Documentation: Help make the docs clearer
- Report Bugs: Open issues for any bugs you find
- Feature Requests: Suggest new features or improvements
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Dating Apps: Add romantic elements to your app
- Reminder Apps: Send sweet notifications to loved ones
- Chatbots: Make your bot more romantic
- Valentine's Day Campaigns: Spread the love!
- Relationship Apps: Daily affirmations for couples
- Greeting Card Generators: Create personalized cards
For production deployment, consider:
-
Set CORS restrictions:
export ALLOWED_ORIGINS="https://yourdomain.com"
-
Use a reverse proxy (NGINX, Traefik, Caddy)
-
Enable HTTPS (Let's Encrypt, Cloudflare)
-
Monitor with health checks:
curl http://localhost:8000/health
-
Set up logging and monitoring
Have questions or suggestions? Open an issue on GitHub!
Made with β€οΈ for spreading digital affection
