Skip to content

duyet/api.duyet.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

191 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

api.duyet.net

CI/CD Pipeline Python 3.12 License: MIT Code style: black

πŸš€ Free Public API Service - A collection of utility APIs for developers, providing gender detection, sentiment analysis, skill normalization, datetime parsing, and more.

Live Website | Documentation | Report Issues

api.duyet.net

✨ Features

  • πŸ” Gender Detection - Predict gender from first names
  • 😊 Sentiment Analysis - Analyze text sentiment (positive/negative/neutral)
  • πŸ› οΈ Skill Normalization - Clean and standardize technology/skill names
  • πŸ“… DateTime Parser - Parse and normalize various datetime formats
  • πŸ‘€ Profile Generator - Generate fake user profile data
  • 🧠 Neural Network Playground - Interactive visualization of neural networks
  • ⚑ Rate Limited - 5000 requests/day, 500 requests/hour per endpoint
  • πŸ”’ Secure - HTTPS, security headers, input validation
  • πŸ“Š Performance - Response compression, optimized for speed
  • 🎨 Interactive Demos - UI demo pages for each API

πŸ“‹ Table of Contents

🌐 API Endpoints

Gender Detection

GET /api/v1/gender?name=Emily

Response:
{
  "name": "Emily",
  "gender": "female",
  "time": 0.001
}

Sentiment Analysis

GET /api/v1/senti?text=I love this!

Response:
{
  "probability": {
    "neg": 0.123,
    "neutral": 0.234,
    "pos": 0.643
  },
  "label": "pos"
}

Skill Cleaning

GET /api/v1/clean_skill?skill=JavaScript

Response:
{
  "raw": "JavaScript",
  "cleaned": "js",
  "time": 0.002
}

DateTime Parsing

GET /api/v1/clean_datetime?datetime=January 2020

Response:
{
  "raw": "January 2020",
  "cleaned": "2020-01-01",
  "time": 0.003
}

Profile Generator

GET /api/v1/profile_faker

Response:
{
  "name": "John Doe",
  "email": "[email protected]",
  "address": "123 Main St",
  ...
}

Health Check

GET /health

Response:
{
  "status": "healthy",
  "service": "api.duyet.net",
  "version": "2.0.0"
}

πŸš€ Quick Start

Using Docker (Recommended)

# Pull and run
docker pull duyetdev/api-duyet
docker run -p 8080:8080 duyetdev/api-duyet

# Or build locally
docker build -t api-duyet .
docker run -p 8080:8080 api-duyet

Visit http://localhost:8080

Local Development

Prerequisites:

  • Python 3.12+
  • pip

Setup:

# Clone the repository
git clone https://github.com/duyetdev/api.duyet.net
cd api.duyet.net

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the server
export FLASK_DEBUG=true
python main.py

Visit http://localhost:8080

πŸ› οΈ Development

Install Development Dependencies

pip install -r requirements-dev.txt
pre-commit install

Code Quality

# Format code
black .
isort .

# Lint
flake8
mypy .

# Security scan
bandit -r . -c pyproject.toml

# Run all pre-commit hooks
pre-commit run --all-files

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov

# Run specific test file
pytest tests/test_api_gender.py

# Run with verbose output
pytest -v

Project Structure

api.duyet.net/
β”œβ”€β”€ api/                    # API implementation modules
β”‚   β”œβ”€β”€ gender.py          # Gender detection logic
β”‚   β”œβ”€β”€ clean_skill.py     # Skill normalization
β”‚   β”œβ”€β”€ clean_datetime.py  # DateTime parsing
β”‚   β”œβ”€β”€ profile_faker.py   # Fake profile generation
β”‚   └── utils.py           # Utility functions
β”œβ”€β”€ templates/             # HTML templates
β”‚   β”œβ”€β”€ index.html        # Main documentation page
β”‚   β”œβ”€β”€ gender.html       # Gender API demo
β”‚   β”œβ”€β”€ senti.html        # Sentiment API demo
β”‚   └── nn/               # Neural network playground
β”œβ”€β”€ static/               # Static assets (CSS, JS)
β”œβ”€β”€ tests/                # Test suite
β”‚   β”œβ”€β”€ conftest.py
β”‚   β”œβ”€β”€ test_api_gender.py
β”‚   β”œβ”€β”€ test_api_clean_skill.py
β”‚   └── test_api_all.py
β”œβ”€β”€ main.py               # Flask application entry point
β”œβ”€β”€ requirements.txt      # Production dependencies
β”œβ”€β”€ requirements-dev.txt  # Development dependencies
β”œβ”€β”€ app.yaml             # Google App Engine configuration
β”œβ”€β”€ Dockerfile           # Docker configuration
β”œβ”€β”€ pyproject.toml       # Tool configurations
└── .pre-commit-config.yaml  # Pre-commit hooks

🚒 Deployment

Google App Engine

# Deploy to App Engine
gcloud app deploy

# View logs
gcloud app logs tail -s default

# Open in browser
gcloud app browse

Docker

# Build image
docker build -t api-duyet:latest .

# Run container
docker run -d -p 8080:8080 --name api-duyet api-duyet:latest

# Push to registry
docker tag api-duyet:latest gcr.io/your-project/api-duyet:latest
docker push gcr.io/your-project/api-duyet:latest

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details and CLAUDE.md for project philosophy and guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (pytest)
  5. Commit your changes (git commit -m 'feat: add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

πŸ†• Request New API

Have an idea for a new API endpoint? Create an issue with your suggestion!

πŸ“Š API Statistics

  • Rate Limits: 5000 requests/day, 500 requests/hour per endpoint
  • Uptime: 99.9%+
  • Response Time: < 100ms average
  • Free Forever: No API keys required

πŸ”’ Security

  • All external API calls use HTTPS
  • Security headers (HSTS, CSP, X-Frame-Options, etc.)
  • Input validation on all endpoints
  • Regular security scanning with Bandit
  • Rate limiting to prevent abuse

πŸ—οΈ Technology Stack

  • Backend: Flask 3.1.2, Python 3.12
  • Deployment: Google App Engine
  • Web Server: Gunicorn
  • Testing: Pytest
  • Code Quality: Black, Flake8, MyPy, Bandit
  • Frontend: TypeScript, D3.js, Material Design Lite
  • CI/CD: GitHub Actions

πŸ“ Changelog

Version 2.0.0 (2024)

  • πŸŽ‰ Major Update: Migrated from Python 2.7 to Python 3.12
  • πŸ”’ Security improvements (HTTPS, headers, input validation)
  • ⚑ Performance optimization (compression, caching)
  • πŸ§ͺ Added comprehensive test suite (pytest)
  • πŸ“š Improved documentation and API responses
  • 🐳 Docker support for local development
  • πŸ”§ Modern development tooling (Black, MyPy, pre-commit)
  • πŸ€– CI/CD pipeline with GitHub Actions

Version 1.0.0

  • Initial release with basic API endpoints

🎯 Project Philosophy

This project follows a clear set of principles and guidelines documented in CLAUDE.md.

Core Values:

  • Free & Accessible - No API keys, generous rate limits
  • Developer-First - Helpful errors, clear docs, fast responses
  • Production-Grade - Secure, tested, modern practices

Key Principles:

  • Keep it simple, but not simpler
  • Every error is an opportunity to teach
  • Security is not optional
  • Clarity over cleverness

For detailed architecture principles, code style guidelines, security best practices, and lessons learned from past bugs, see CLAUDE.md.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Van-Duyet Le (@duyetdev)

⭐ Support

If you find this project useful, please give it a ⭐ star on GitHub!

πŸ™ Acknowledgments

  • Neural Network Playground based on TensorFlow Playground
  • Thanks to all contributors who have helped improve this project
  • Built with ❀️ for the developer community

Made with ❀️ by duyet.net

Releases

No releases published

Packages

 
 
 

Contributors