Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

skiddle-archives/domain-randomizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Domain Randomizer

A Node.js application that provides domain randomization and redirection based on configurable rules. When accessed through specific domains, it generates random subdomains and redirects to configured target domains based on predefined rules.

Features

  • Domain-specific redirection rules
  • Random subdomain generation
  • RESTful API for managing domains and rules
  • MariaDB integration for persistent storage
  • Configurable through environment variables
  • Comprehensive logging of all redirects

Prerequisites

  • Node.js (v18 or higher)
  • MariaDB (v10.5 or higher)
  • npm or yarn

Installation

  1. Clone the repository:
git clone https://github.com/arcestia/domain-randomizer.git
cd domain-randomizer
  1. Install dependencies:
npm install
  1. Create and configure the .env file:
cp .env.example .env
# Edit .env with your database credentials and settings
  1. Set up the database:
mysql -u root < schema.sql

Configuration

Configure the application through the .env file:

DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=domainrandomizer
DB_PORT=3306
PORT=3000

Usage

  1. Start the server:
npm start
  1. The application will handle incoming requests based on the hostname used to access it.

Example:

  • Access through domainA.com → Redirects to random subdomain on either TargetA.com or TargetB.com
  • Access through domainB.com → Redirects to random subdomain on either TargetC.com or TargetD.com

API Documentation

See API.md for detailed API documentation.

Quick API examples:

  1. List all source domains:
curl http://localhost:3000/api/sources
  1. Add new target domain:
curl -X POST http://localhost:3000/api/targets \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com"}'
  1. Create new rule:
curl -X POST http://localhost:3000/api/rules \
  -H "Content-Type: application/json" \
  -d '{
    "source_domain": "source.com",
    "target_domain": "target.com"
  }'

Database Schema

The application uses four main tables:

  1. source_domains: Stores domains that can access the service
  2. target_domains: Stores potential redirect target domains
  3. domain_rules: Maps relationships between source and target domains
  4. redirects: Logs all redirections for tracking

Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Create .env file with your configuration
  4. Set up the database using schema.sql
  5. Run the application: npm start

Security Considerations

  1. Protect your .env file - never commit it to version control
  2. Implement proper authentication for API endpoints in production
  3. Use HTTPS for all production traffic
  4. Regularly backup your database
  5. Monitor redirect logs for abuse

Author

Laurensius Jeffrey


© Skiddle ID 2025
Licensed under MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published