Skip to main content

MACT (Mirrored Active Collaborative Tunnel) - CLI tool for collaborative development

Project description

MACT (Mirrored Active Collaborative Tunnel)

A collaborative development platform that provides a single, persistent public URL for project "rooms" that live-mirrors the localhost of the developer with the latest Git commit.

๐Ÿš€ Quick Start

For End Users (Install CLI)

# Install via pip (easy!)
pip install git+https://github.com/int33k/M-ACT.git

# Initialize
mact init --name your-name

# Create your first room (from your project directory)
cd ~/your-project
mact create TelegramBot -port 3000

# ๐ŸŽ‰ Your room is live!
# Mirror:    https://telegrambot.m-act.live/
# Dashboard: https://telegrambot.m-act.live/dashboard

See .docs/QUICK_START.md for complete guide.

For Administrators (Run Server Locally)

# 1. Clone and setup
git clone https://github.com/int33k/M-ACT.git
cd M-ACT
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# 2. Start services (3 terminals)
python -m backend.app                    # Terminal 1: Backend (port 5000)
./scripts/run_frp_local.sh              # Terminal 2: FRP server (port 7100)
FRP_AUTOSTART=0 python -m proxy.app     # Terminal 3: Proxy (port 9000)

See INSTALL.md for detailed local development setup.
See .docs/PRODUCTION_DEPLOYMENT_GUIDE.md for production deployment.

For Server Administrators (Manage Production)

Once deployed to DigitalOcean, use the admin CLI to manage rooms and users:

# SSH into your droplet
ssh root@m-act.live

# List all rooms
mact-admin rooms list

# Delete a specific room
mact-admin rooms delete old-project

# Clean up empty rooms
mact-admin rooms cleanup

# Check system health
mact-admin system health

# View logs
mact-admin system logs backend

See .docs/ADMIN_CLI_GUIDE.md for complete admin reference.

What is MACT?

MACT eliminates deployment delays in collaborative development:

  • ๐Ÿ  Room-based collaboration - Multiple developers share one permanent URL
  • ๐Ÿ”„ Git-driven switching - Latest commit author becomes "active developer"
  • ๐Ÿชž Live mirroring - Room URL auto-proxies to active developer's localhost
  • ๐ŸŒ Subdomain routing - Clean URLs: project-name.m-act.live
  • โšก Zero configuration - One CLI command sets up tunnel + git hooks
  • ๐Ÿ“Š Real-time dashboard - WebSocket-powered status updates

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Browser   โ”‚ โ† User accesses project-name.m-act.live
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Proxy (Port 9000)                                โ”‚
โ”‚  โ€ข Subdomain routing                              โ”‚
โ”‚  โ€ข WebSocket auto-refresh                         โ”‚
โ”‚  โ€ข Dashboard UI                                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚               โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Backend    โ”‚   โ”‚  FRP Server (Port 7100)โ”‚
โ”‚  Port 5000  โ”‚   โ”‚  โ€ข Tunnel multiplexing โ”‚
โ”‚  โ€ข Rooms    โ”‚   โ”‚  โ€ข Vhost HTTP (7101)   โ”‚
โ”‚  โ€ข Commits  โ”‚   โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
                  โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚ Dev A    โ”‚  โ”‚ Dev B    โ”‚
                  โ”‚ :3000    โ”‚  โ”‚ :3001    โ”‚
                  โ”‚ (Active) โ”‚  โ”‚ (Idle)   โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Four Components:

  1. Backend - Flask REST API managing rooms, participants, commits
  2. Proxy - Starlette/ASGI server with subdomain routing + WebSocket support
  3. CLI - Developer tool for room creation, joining, and tunnel management
  4. FRP - Fast Reverse Proxy for localhost tunneling

Features

โœ… Core Functionality

  • Subdomain-based routing - project-name.localhost:9000 โ†’ active developer
  • Git-driven active developer - Latest commit author gets the spotlight
  • WebSocket auto-refresh - Dashboard & mirror update instantly on commits
  • Automatic tunnel setup - One CLI command handles everything
  • Real-time dashboard - See participants, commits, active developer
  • Production security - Input validation, auth, XSS prevention

๐Ÿงช Test Coverage

36 tests passing across all components:

  • Backend: 13 tests
  • Proxy: 8 tests
  • CLI: 7 tests
  • FRP Manager: 5 tests
  • Integration: 3 tests

๐Ÿ“ฆ Technology Stack

  • Backend: Python 3.12 + Flask
  • Proxy: Starlette/ASGI + uvicorn
  • Tunneling: frp v0.65.0 (vendored)
  • Testing: pytest
  • Security: Flask-Limiter + input validation

CLI Usage

# 1. Initialize your developer identity
mact init --name your-name

# 2. Create a room (from your git project directory)
# Simple syntax: mact create PROJECT_NAME -port PORT
mact create TelegramBot -port 5000

# Your room is now accessible at:
# ๐Ÿชž Mirror:    https://telegrambot.m-act.live/
# ๐Ÿ“Š Dashboard: https://telegrambot.m-act.live/dashboard

# 3. Another developer joins
mact join telegrambot -port 5001

# 4. Make commits - active developer switches automatically!
git commit -m "My feature"  # You become active
# Mirror now shows YOUR localhost:5000

# 5. Check status
mact status

# 6. Leave room
mact leave --room telegrambot

Key Features:

  • โœจ Simple syntax: mact create ProjectName -port 3000
  • ๐Ÿš€ Auto-subdomain: Generates subdomain automatically
  • ๐Ÿ”ง Zero config: One command does everything
  • ๐Ÿ“ฆ pip install: No manual setup needed

See .docs/QUICK_START.md for complete guide.
See cli/README.md for detailed CLI documentation.

API Endpoints

Endpoint Description
POST /rooms/create Create a new room
POST /rooms/join Join an existing room
POST /report-commit Report a Git commit (auto-called by git hook)
GET /get-active-url Get active developer's tunnel URL
GET /rooms/status Get room participants and state
GET /rooms/<room>/commits Get commit history
GET /health Health check

Proxy Endpoints:

Endpoint Description
http://<room>.localhost:9000/ Mirror - proxies to active developer
http://<room>.localhost:9000/dashboard Dashboard - room status UI
ws://<room>.localhost:9000/notifications WebSocket - real-time updates

See backend/README.md for API examples.

Port Configuration

Service Port Purpose
Backend 5000 REST API
Proxy 9000 Public entry point
FRP Server 7100 Tunnel control
FRP VHost 7101 HTTP tunnels (subdomain multiplexing)
Developer localhost 3000+ Your local dev servers

Testing

# Run all tests
pytest tests/ -v

# Run specific component
pytest tests/test_backend.py -v
pytest tests/test_proxy.py -v
pytest tests/test_cli.py -v

# Run with coverage
pytest --cov=. tests/

Test Status: 36 tests passing (13 backend + 8 proxy + 7 CLI + 5 FRP + 3 integration)

Production Deployment

MACT is production-ready with:

  • โœ… Systemd services with auto-restart
  • โœ… Nginx configuration for SSL/TLS termination
  • โœ… Security hardening (input validation, auth, XSS prevention)
  • โœ… Deployment scripts (setup, deploy, rollback)
  • โœ… Wildcard DNS support for subdomain routing

Quick Deploy (Ubuntu 22.04)

# 1. Setup server (as root)
cd deployment/scripts
./setup.sh

# 2. Configure environment
cp deployment/mact-*.env.template /etc/mact/
# Edit env files with your settings

# 3. Deploy
./deploy.sh

# 4. Configure DNS
# Add wildcard DNS: *.m-act.live โ†’ YOUR_SERVER_IP

# 5. Setup SSL (Let's Encrypt)
certbot --nginx -d m-act.live -d "*.m-act.live"

See .docs/DEPLOYMENT.md for complete guide.

Security Features

  • Input validation on all endpoints
  • Bearer token authentication for admin endpoints
  • XSS prevention with HTML sanitization
  • Rate limiting (nginx + Flask-Limiter)
  • Security headers (X-Frame-Options, CSP, etc.)

See .docs/SECURITY_THREAT_MODEL.md for threat analysis.

Documentation

๐Ÿ“š User Guides

๐Ÿ”ง Technical Documentation

๐Ÿ“– Additional Resources

Contributing

Academic research project. Code follows "Build in Units" methodology with strict adherence to PROJECT_CONTEXT.md.

License

MIT License - See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mact_cli-1.0.0.tar.gz (13.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mact_cli-1.0.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file mact_cli-1.0.0.tar.gz.

File metadata

  • Download URL: mact_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 13.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mact_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e98a15f7c982f1d8c281f1acb96ecfeda1241ab2734e62484cd42b6739a93694
MD5 791ec1df449f1e94bb1ad4afd9771ef8
BLAKE2b-256 f95186329c4dcd3249edb5ada2560e8e1356b9f5f02aae806c15c7d6937a4711

See more details on using hashes here.

File details

Details for the file mact_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mact_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mact_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88ebbe108b9700ec0d6614df66a04eadbc61c45f1bae4872475df5939248cb28
MD5 032c31fe0c30ea4584719ed2e4d57f89
BLAKE2b-256 df17ac979227add7f183345479ac0fbf2b27e4b407c29d13688365d39c5e5ea3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page