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

tragarz-server

v1.1.0

Published

Server component for Tragarz - lightweight Git alternative for solo developers

Downloads

8

Readme

Tragarz Server

HTTP server component for Tragarz file synchronization system.

Installation

npm install -g tragarz-server

Quick Start

1. Initialize Server

# Create a directory for your server
mkdir ~/my-tragarz-server
cd ~/my-tragarz-server

# Initialize server (creates config and projects directory)
tragarz-server init

This creates:

  • tragarzserver.json - Server configuration
  • projects/ - Directory for project files

2. Configure (Optional)

Edit tragarzserver.json:

{
  "port": 8080,
  "password": "admin123",
  "dataDir": "./projects",
  "maxProjectSize": "1GB",
  "allowedHosts": ["*"]
}

3. Start Server

tragarz-server start

The server will:

  • Load configuration from current directory
  • Create projects directory if needed
  • Start listening on configured port

Commands

tragarz-server init

Initialize server in current directory. Creates:

  • Configuration file (tragarzserver.json)
  • Projects directory

tragarz-server start

Start the server using configuration from current directory.

tragarz-server help

Show help message with all available commands.

Configuration

tragarzserver.json

| Option | Type | Default | Description | |--------|------|---------|-------------| | port | number | 8080 | Server port | | password | string | "admin123" | Authentication password | | dataDir | string | "./projects" | Projects storage directory | | maxProjectSize | string | "1GB" | Maximum project size | | allowedHosts | array | ["*"] | CORS allowed hosts |

Security

  • Change the default password immediately
  • Use HTTPS in production (reverse proxy recommended)
  • Limit allowedHosts to specific domains if needed
  • Keep maxProjectSize reasonable to prevent abuse

API Endpoints

Authentication

  • POST /auth - Authenticate and get token

Projects

  • GET /projects - List all projects
  • POST /projects/:name - Create new project
  • GET /projects/:name/info - Get project info

Files

  • GET /projects/:name/files - List project files
  • POST /projects/:name/files - Upload files
  • GET /projects/:name/files/* - Download file
  • DELETE /projects/:name/files/* - Delete file

Snapshots

  • POST /projects/:name/snapshot - Create snapshot
  • GET /projects/:name/snapshots - List snapshots
  • POST /projects/:name/restore/:snapshotId - Restore snapshot

Development

Local Development

cd server
npm install
npm link

# In your test directory
mkdir ~/test-tragarz
cd ~/test-tragarz
tragarz-server init
tragarz-server start

Project Structure

server/
├── src/
│   ├── server.js           # Main server class
│   ├── auth.js            # Authentication manager
│   ├── projectManager.js  # Project operations
│   ├── fileManager.js     # File operations
│   └── snapshotManager.js # Snapshot operations
├── bin/
│   └── tragarz-server.js  # CLI wrapper
└── package.json

Security Features

  • Password-based authentication
  • Token-based session management (JWT)
  • Rate limiting (100 requests per 15 minutes)
  • Path traversal protection
  • File size limits
  • Input validation
  • CORS configuration
  • Helmet security headers

Deployment

Simple Deployment

# On your server
npm install -g tragarz-server
cd /var/tragarz
tragarz-server init

# Edit config
nano tragarzserver.json

# Start (consider using pm2 or systemd)
tragarz-server start

With PM2

npm install -g pm2
cd /var/tragarz
tragarz-server init

# Create ecosystem file
pm2 start "tragarz-server start" --name tragarz
pm2 save
pm2 startup

With systemd

Create /etc/systemd/system/tragarz.service:

[Unit]
Description=Tragarz Server
After=network.target

[Service]
Type=simple
User=tragarz
WorkingDirectory=/var/tragarz
ExecStart=/usr/bin/tragarz-server start
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl enable tragarz
sudo systemctl start tragarz

Behind Nginx

server {
    listen 80;
    server_name tragarz.example.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Troubleshooting

Port Already in Use

# Change port in config
nano tragarzserver.json
# Set "port": 8081

Permission Issues

# Make sure projects directory is writable
chmod 755 projects/

Can't Find Configuration

Server looks for tragarzserver.json in the current working directory.

Make sure you:

  1. Run tragarz-server init in your desired directory
  2. Run tragarz-server start from the same directory
# Wrong
cd ~
tragarz-server init
cd /tmp
tragarz-server start  # Will fail - no config here!

# Correct
cd ~/my-tragarz
tragarz-server init
tragarz-server start  # Works - config is here

License

MIT