domainapi/README.md
2025-04-08 23:41:24 +02:00

3.1 KiB

Domain and DNS Management System

A FastAPI application that allows users to upload CSV files containing domain and DNS records, storing them in a database and displaying them via an interactive UI and API interface.

Features

  • File upload system with detailed upload history, including ability to delete uploads
  • Main SLD view with filtering by upload and time
  • Comprehensive DNS Records view with multi-faceted filtering
  • TinyDB database storage with precise timestamps for data persistence
  • Deduplicated DNS records (by domain, class, and type) and domains (by FQDN) showing most recent entries
  • Option to view only records from a specific upload
  • Clean, simplified interface showing only the latest records
  • Server-side filtering by upload, record type, class, TLD, and SLD (no JavaScript needed)
  • Provides comprehensive RESTful API endpoints for programmatic access
  • Responsive design that works on desktop and mobile

Containerized Deployment

The application can be easily deployed in a secure rootless container using Podman or Docker.

For detailed container instructions, see CONTAINER_INSTRUCTIONS.md.

Quick start:

# Make the run script executable
chmod +x run_container.sh

# Run the container (automatically uses podman if available, falls back to docker)
./run_container.sh

Setup with Virtual Environment (Development)

  1. Create a virtual environment:

    python -m venv venv
    
  2. Activate the virtual environment:

    • On Windows:
      venv\Scripts\activate
      
    • On macOS/Linux:
      source venv/bin/activate
      
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Run the application:

    python main.py
    
  5. Access the application:

  6. Deactivate the virtual environment when finished:

    deactivate
    

CSV File Format

The application accepts CSV files with the following format:

domain.example.com,3600,IN,A,192.168.1.1
domain.example.com,3600,IN,MX,10 mail.example.com.
subdomain.example.com,3600,IN,CNAME,domain.example.com.

Where columns are:

  1. Domain name (fully qualified domain name)
  2. TTL (Time To Live) in seconds
  3. Record Class (usually IN for Internet)
  4. Record Type (A, AAAA, MX, CNAME, TXT, etc.)
  5. Record Data (IP address, hostname, or other data depending on record type)

API Endpoints

  • /api/uploads - Get all uploads
  • /api/slds - Get all SLDs (Second Level Domains)
  • /api/slds/{sld} - Get domains by SLD
  • /api/dns - Get all DNS records
  • /api/dns/types - Get unique values for filters

Query Parameters

You can filter the API results using the following query parameters:

  • upload_id - Filter by specific upload
  • record_type - Filter by DNS record type
  • record_class - Filter by DNS record class
  • tld - Filter by Top Level Domain
  • sld - Filter by Second Level Domain
  • domain - Search by domain name

Example: /api/dns?record_type=A&tld=com&upload_id=upload_20250408120000