G
YouTube TikTok Games
Skip to content
devabusayedPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

APIForge

Self-Hosted API Builder & Management Platform

APIForge is a Django-based platform where developers can easily create, manage, secure, and monitor APIs from a dashboard.

Screenshots

Home Login Sign Up
Home Login Sign Up
Dashboard Projects Create Project
Dashboard Projects Create Project

Features

  • Authentication System: User signup, login, logout, password reset, and email verification using django-allauth
  • Dashboard: Overview of all APIs, requests, API keys, and recent activity
  • API Project Management: Create and organize API projects with multiple endpoints
  • API Endpoint Builder: Visual endpoint creation with method, path, parameters, and documentation
  • API Key System: Generate, revoke, and manage API keys with usage tracking
  • Rate Limiting: Configurable rate limits per API key (requests per day)
  • Analytics Dashboard: Real-time usage analytics with charts showing requests, response times, and error rates
  • Automatic API Documentation: Auto-generated Swagger-like documentation for each project
  • Request Logging: Detailed logs of all API requests with filtering and search
  • Admin Panel: Full admin interface for managing users, projects, API keys, and usage

Tech Stack

Backend

  • Python 3.12
  • Django 5
  • Django REST Framework
  • PostgreSQL
  • Redis
  • Celery

Frontend

  • Django Templates
  • TailwindCSS
  • Alpine.js
  • Chart.js

Dev Tools

  • Docker & Docker Compose
  • Black & Ruff (code formatting)
  • pytest (testing)

Quick Start

Using Docker (Recommended)

  1. Clone the repository

    git clone <repository-url>
    cd apiforge
  2. Copy environment file

    cp .env.example .env
  3. Start the services

    docker-compose up -d
  4. Run migrations

    docker-compose exec django python manage.py migrate
  5. Create a superuser

    docker-compose exec django python manage.py createsuperuser
  6. Access the application

Manual Setup

  1. Create a virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies

    pip install -r requirements/development.txt
  3. Install Node.js dependencies for TailwindCSS

    npm install
    npm run build:css
  4. Set up environment variables

    cp .env.example .env
    # Edit .env with your configuration
  5. Set up PostgreSQL and Redis

    • Create a PostgreSQL database
    • Start Redis server
  6. Run migrations

    python manage.py migrate
  7. Create a superuser

    python manage.py createsuperuser
  8. Start the development server

    python manage.py runserver
  9. Start Celery (in a separate terminal)

    celery -A config worker -l INFO

Configuration

Environment Variables

Variable Description Default
SECRET_KEY Django secret key Required
DEBUG Debug mode False
ALLOWED_HOSTS Allowed hostnames localhost,127.0.0.1
DATABASE_URL PostgreSQL connection URL Required
REDIS_URL Redis connection URL redis://localhost:6379/0
CELERY_BROKER_URL Celery broker URL redis://localhost:6379/1
EMAIL_BACKEND Email backend Console backend

Project Structure

apiforge/
├── manage.py
├── config/
│   ├── settings/
│   │   ├── base.py          # Base settings
│   │   ├── development.py   # Development settings
│   │   └── production.py    # Production settings
│   ├── urls.py
│   ├── wsgi.py
│   ├── asgi.py
│   └── celery.py
├── apps/
│   ├── accounts/            # User authentication
│   ├── dashboard/           # Main dashboard
│   ├── projects/            # API projects
│   ├── apis/                # API endpoints & keys
│   └── analytics/           # Usage analytics & logs
├── templates/
│   ├── base.html
│   ├── base_dashboard.html
│   ├── components/
│   ├── account/
│   ├── dashboard/
│   ├── projects/
│   ├── apis/
│   └── analytics/
├── static/
│   └── css/
├── requirements/
├── docker-compose.yml
├── Dockerfile
└── README.md

API Usage

Authentication

All API requests require authentication via API key:

curl -X GET "http://localhost:8000/api/v1/products" \
  -H "Authorization: Bearer af_your_api_key_here"

Rate Limiting

API keys have configurable rate limits. Rate limit information is included in response headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: midnight UTC

Example: Creating an API Endpoint

  1. Log in to the dashboard

  2. Create a new project

  3. Add endpoints with:

    • Name: Get All Products
    • Method: GET
    • Path: /products
    • Parameters and example responses
  4. Generate an API key

  5. Use the key in your applications

Development

Code Formatting

black .
ruff check --fix .

Running Tests

pytest

Building CSS

npm run watch:css  # Development
npm run build:css  # Production

Deployment

Production with Docker

docker-compose -f docker-compose.prod.yml up -d

Manual Production Deployment

  1. Set DEBUG=False in environment
  2. Configure proper SECRET_KEY
  3. Set up PostgreSQL and Redis
  4. Run with Gunicorn behind Nginx
  5. Configure SSL/TLS certificates

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License

Support

For issues and questions, please open a GitHub issue.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages