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

@studiometa/trafic-agent

v0.1.6

Published

Server agent for DDEV preview environments — auth, scale-to-zero, auto-start

Readme

@studiometa/trafic-agent

Server agent for DDEV preview environments — auth, scale-to-zero, and auto-start.

Part of Trafic, a tool for managing DDEV preview environments on Linux servers.

Features

  • Forward auth — Traefik middleware for IP whitelist, basic auth, and token auth
  • Scale-to-zero — Automatically stop idle DDEV projects to save RAM
  • Auto-start — Show a waiting page and restart stopped projects on request
  • Per-project config — Override auth and idle timeout per project

Installation

npm install -g @studiometa/trafic-agent

Commands

trafic-agent serve

Start the agent server.

trafic-agent serve
# or with custom config
trafic-agent serve --config /etc/trafic/config.toml

trafic-agent setup

Interactive server setup — installs Docker, DDEV, configures DNS, and sets up the agent as a systemd service.

trafic-agent setup --tld previews.example.com

Requirements:

  • Ubuntu 24.04 LTS
  • Root access (for initial setup)
  • Wildcard DNS pointing to the server

Configuration

Create /etc/trafic/config.toml:

# Required: TLD for DDEV projects
tld = "previews.example.com"

# Agent HTTP server port (default: 9876)
port = 9876

# Scale-to-zero: stop idle projects after this duration
idle_timeout = "4h"

# Authentication
[auth]
default_policy = "basic"  # allow, deny, basic, or token

# IP whitelist (bypasses auth)
allowed_ips = ["192.168.1.0/24", "10.0.0.0/8"]

# Bearer tokens for CI/API access
tokens = ["your-ci-token"]

# Basic auth credentials
basic_auth = ["user:password"]

# Per-hostname rules
[[auth.rules]]
match = "*.public.*"
policy = "allow"

[[auth.rules]]
match = "admin.*"
policy = "basic"

Per-project configuration

Create .ddev/config.trafic.yaml in your project:

# Override auth policy for this project
auth_policy: allow  # allow, deny, basic, or token

# Override idle timeout (or disable with "never")
idle_timeout: never

How it works

HTTPS request
     │
     ▼
Traefik (DDEV router)
     │
     ├─► forwardAuth → trafic-agent
     │        │
     │        ├─► 200 OK → DDEV project
     │        └─► 401 → Basic auth prompt
     │
     └─► 502 error → errors middleware → trafic-agent
                          │
                          ├─► known project → Waiting page + auto-start
                          └─► unknown → Error page

The agent:

  1. Handles forward auth requests from Traefik
  2. Checks IP whitelist, tokens, or basic auth
  3. Tracks project activity for scale-to-zero
  4. Starts stopped projects when requested
  5. Shows a waiting page while projects start

Endpoints

| Endpoint | Description | |----------|-------------| | GET /auth | Forward auth for Traefik | | GET /errors | Error handler for stopped projects | | GET /status | Health check | | GET /projects | List all projects (JSON) |

License

MIT — see LICENSE