npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

redirector-cli

v1.0.0

Published

Global CLI tool for managing Redirector backend services with Docker Compose

Downloads

5

Readme

Redirector CLI

npm version License: MIT

A global CLI tool for managing Redirector backend services with Docker Compose. Deploy and manage your Redirector API anywhere with zero configuration.

🚀 Quick Start

# Install globally
npm install -g redirector-cli

# Initialize project
mkdir my-redirector && cd my-redirector
redirector setup

# Start services
redirector start

# Check status
redirector status

Your Redirector API will be available at http://localhost:3000!

📋 Requirements

  • Node.js 16.0.0 or higher
  • Docker and Docker Compose
  • npm or yarn

🛠 Installation

Global Installation (Recommended)

npm install -g redirector-cli

Local Installation

npx redirector-cli setup

📖 Commands

redirector setup

Initialize a new Redirector project in the current directory.

redirector setup [options]

Options:
  -p, --port <number>              Backend API port (default: 3000)
  --postgres-port <number>         PostgreSQL port (default: 5432)
  -u, --docker-username <username> Docker Hub username (default: shivarajbakale)
  -f, --force                      Overwrite existing configuration
  --no-interactive                 Skip interactive prompts

Examples:

# Interactive setup
redirector setup

# Non-interactive with custom port
redirector setup --port 8080 --no-interactive

# Force overwrite existing project
redirector setup --force

redirector start

Start all Redirector services.

redirector start [options]

Options:
  --no-detach    Run in foreground (not detached)
  --pull         Pull latest images before starting
  --build        Build images before starting

Examples:

# Start services in background
redirector start

# Start with latest images
redirector start --pull

# Start in foreground
redirector start --no-detach

redirector stop

Stop all Redirector services.

redirector stop [options]

Options:
  -v, --remove-volumes    Also remove volumes and data

Examples:

# Stop services
redirector stop

# Stop and remove all data
redirector stop --remove-volumes

redirector restart

Restart all Redirector services.

redirector restart [options]

Options:
  --pull    Pull latest images before restarting

redirector reset

Stop services and remove all data and volumes.

redirector reset [options]

Options:
  -f, --force     Skip confirmation prompt
  -y, --confirm   Automatically confirm reset

⚠️ Warning: This will permanently delete all data!

redirector status

Show status of all services.

redirector status [options]

Options:
  -j, --json      Output status as JSON
  -v, --verbose   Show detailed information

Examples:

# Human-readable status
redirector status

# JSON output for scripts
redirector status --json

# Detailed information
redirector status --verbose

redirector logs

Show logs for services.

redirector logs [service] [options]

Arguments:
  service         Service name (backend, postgres, or all)

Options:
  -f, --follow    Follow log output
  -t, --tail <number>    Number of lines to show from end of logs

Examples:

# Show all logs
redirector logs

# Show backend logs only
redirector logs backend

# Follow all logs
redirector logs --follow

# Follow backend logs
redirector logs backend --follow

🔧 Configuration

The CLI uses the following configuration sources (in order of precedence):

  1. Command-line options
  2. Environment variables
  3. .redirector.json file
  4. Default values

Environment Variables

BACKEND_PORT=3000          # Backend API port
POSTGRES_PORT=5432         # PostgreSQL port
DOCKER_USERNAME=shivarajbakale  # Docker Hub username
PROJECT_NAME=redirector    # Project name
NODE_ENV=production        # Environment (production/development)

Configuration File

The CLI creates a .redirector.json file in your project:

{
  "backendPort": 3000,
  "postgresPort": 5432,
  "dockerUsername": "shivarajbakale",
  "projectName": "my-project",
  "environment": "production"
}

🏗 Project Structure

After running redirector setup, your project will contain:

my-redirector/
├── docker-compose.yml     # Docker Compose configuration
├── .env                   # Environment variables
├── .redirector.json       # CLI configuration
├── .gitignore            # Git ignore rules
├── README.md             # Project documentation
└── data/                 # Volume mount directory

🌐 API Endpoints

Once started, your Redirector API provides:

  • Health Check: GET /health
  • Groups: GET /groups/list, POST /groups/create
  • Requests: GET /requests, POST /requests/create

Full API documentation: Redirector API Docs

🐳 Docker Images

The CLI uses pre-built Docker images:

  • Backend: shivarajbakale/redirector-backend:latest
  • Database: postgres:15

Images are automatically pulled when starting services.

🔍 Troubleshooting

Docker Issues

# Check Docker installation
docker --version
docker compose version

# Check Docker daemon
docker info

# Check running containers
docker ps

Port Conflicts

# Check if port is in use
lsof -i :3000

# Use custom port
redirector setup --port 8080

Service Health

# Check service status
redirector status

# View service logs
redirector logs

# Test API health
curl http://localhost:3000/health

Reset Everything

# Complete reset
redirector reset --force

# Restart setup
redirector setup --force

🧪 Development

Building from Source

# Clone repository
git clone https://github.com/shivarajbakale/redirector-app.git
cd redirector-app/packages/backend/cli

# Install dependencies
npm install

# Build
npm run build

# Test locally
npm link
redirector --help

Running Tests

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

Linting

# Check code style
npm run lint

# Fix code style
npm run lint:fix

📝 Examples

Basic Usage

# Create new project
mkdir my-api && cd my-api
redirector setup

# Start services
redirector start

# Test API
curl http://localhost:3000/health

# Stop services
redirector stop

Custom Configuration

# Setup with custom ports
redirector setup --port 8080 --postgres-port 5433

# Start with latest images
redirector start --pull

# Monitor logs
redirector logs --follow

Production Deployment

# Setup production environment
redirector setup --no-interactive
export NODE_ENV=production

# Start services
redirector start

# Monitor status
redirector status --json

CI/CD Integration

#!/bin/bash
# deploy.sh

# Install CLI
npm install -g redirector-cli

# Setup project
redirector setup --no-interactive --force

# Start services
redirector start --pull

# Wait for health check
until curl -f http://localhost:3000/health; do
  echo "Waiting for API..."
  sleep 5
done

echo "Deployment successful!"

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

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

🔗 Links

🙏 Support

If you find this project helpful, please consider:

  • ⭐ Starring the repository
  • 🐛 Reporting bugs
  • 💡 Suggesting features
  • 📖 Improving documentation

Made with ❤️ by Shivaraj Bakale