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

@browser.style/asset-server

v1.0.1

Published

Asset management server

Readme

Asset Server

A server for managing digital assets with automatic image processing, WebP conversion, and tag management.

Features

  • Organized Storage Structure: Assets are stored in a hierarchical directory structure based on SKU/ID
  • Image Processing: On-the-fly image resizing and WebP conversion
  • WebP Conversion: Automatic conversion to WebP format for better performance
  • Compression: Brotli compression for supported clients
  • Caching: Efficient caching system for resized images
  • Tagging System: Attach metadata tags to assets
  • API-Driven: RESTful API for all operations
  • Validation: Input validation for all endpoints

Technologies

  • Node.js: JavaScript runtime
  • Express: Web framework
  • Multer: File upload handling
  • Sharp: Image processing and WebP conversion
  • PM2: Process management and auto-restart
  • express-validator: Input validation

Installation

Prerequisites

  • Node.js 16+ (LTS recommended)
  • npm or yarn

Setup

  1. Clone the repository:

    git clone https://github.com/madsstoumann/asset-server.git
    cd asset-server
  2. Install dependencies:

    npm install
  3. Create environment file:

    cp .env.example .env
  4. Edit .env file with your configuration settings

Configuration

Configure your server through the .env file:

| Variable | Description | Default | |----------|-------------|---------| | PORT | Server port | 3000 | | NODE_ENV | Environment (development or production) | development | | ALLOWED_ORIGINS | CORS allowed origins (comma-separated) | http://localhost:5500 | | ALLOWED_WIDTHS | Permitted image resize widths | 75,200,400,800,1200,1600 | | ALLOWED_TAGS | Valid tags for assets | front,back,inside,spine | | ALLOWED_TYPES | Permitted file types | image/jpeg,image/png,image/gif,application/pdf | | MAX_FILE_SIZE | Maximum upload file size (MB) | 10 | | ENABLE_COMPRESSION | Enable Brotli compression | true | | COMPRESSION_LEVEL | Compression level (0-11) | 11 |

API Endpoints

Asset Management

| Method | Endpoint | Description | |--------|----------|-------------| | GET | /api/asset/:id | Get asset by ID | | POST | /api/asset/:id | Upload new asset(s) | | GET | /api/asset-list/:id | List assets by folder ID | | PUT | /api/asset/:id/tags | Update asset tags | | DELETE | /api/asset/:id | Delete asset |

Configuration

| Method | Endpoint | Description | |--------|----------|-------------| | GET | /api/config/client | Get client configuration |

Query Parameters

Asset Retrieval

  • w or width: Resize image to specified width
  • h or height: Resize image to specified height
  • dpi: Set image DPI

Asset Deletion

  • filename: Specify file to delete

Usage Examples

Upload an Asset

curl -X POST http://localhost:3000/api/asset/12345 -F "assets=@/path/to/your/file.jpg"

Get an Asset

curl http://localhost:3000/api/asset/12345?w=200

List Assets in a Folder

curl http://localhost:3000/api/asset-list/12345

Update Asset Tags

curl -X PUT http://localhost:3000/api/asset/12345/tags -d '{"tags":["front","back"]}' -H "Content-Type: application/json"

Delete an Asset

curl -X DELETE http://localhost:3000/api/asset/12345?filename=file.jpg

Additional Features

Image Processing

  • Resize: Resize images on-the-fly to specified dimensions.
  • WebP Conversion: Convert images to WebP format for better performance.
  • DPI Setting: Set DPI for images.

Compression

  • Brotli Compression: Enable Brotli compression for supported clients to reduce file size.

Caching

  • Efficient Caching: Cache resized images to improve performance on subsequent requests.

Tagging System

  • Metadata Tags: Attach metadata tags to assets for better organization and retrieval.

Validation

  • Input Validation: Validate input for all endpoints to ensure data integrity.

License

This project is licensed under the ISC License.