Skip to content

Feature: jsserve - npx serve alternative with write support (new repo) #108

Open

Description

@melvincarvalho

Summary

Create jsserve - a thin wrapper package around JSS that provides a drop-in alternative to npx serve with added REST write capabilities (PUT/DELETE).

New repo: github.com/JavaScriptSolidServer/jsserve

Difficulty: 20/100
Estimated Effort: 1 day
Dependencies: #107 (--public flag)


Motivation

npx serve is hugely popular for quick static file serving, but it's read-only. Developers often need:

  • Quick file upload endpoint for testing
  • Simple WebDAV-like functionality
  • REST API for local development
  • File sync between devices on LAN

jsserve fills this gap: "serve, but you can write too"


Comparison

Feature npx serve npx jsserve
Zero config ✅ ✅
Static file serving ✅ ✅
Directory listings ✅ ✅
CORS ✅ ✅
Custom port ✅ ✅
SPA mode ✅ ✅
PUT (write files) ❌ ✅
DELETE ❌ ✅
PATCH ❌ ✅
ETags/caching ❌ ✅
Conditional requests ❌ ✅
Upgrade to Solid ❌ ✅

Usage

# Install
npm i -g jsserve

# Serve current directory (read + write enabled)
jsserve

# Serve specific folder
jsserve ./public

# Custom port
jsserve -p 8080

# Read-only mode (exactly like npx serve)
jsserve --read-only

# With basic auth
jsserve --auth user:pass

# Enable full Solid features
jsserve --solid

Output

   ┌─────────────────────────────────────────┐
   │                                         │
   │   Serving!                              │
   │                                         │
   │   - Local:    http://localhost:3000     │
   │   - Network:  http://192.168.1.5:3000   │
   │                                         │
   │   GET/PUT/DELETE enabled                │
   │                                         │
   └─────────────────────────────────────────┘

REST API Examples

# Read file
curl http://localhost:3000/file.txt

# Write file
curl -X PUT -d "content" http://localhost:3000/file.txt

# Delete file
curl -X DELETE http://localhost:3000/file.txt

# Conditional update (optimistic concurrency)
curl -X PUT -H 'If-Match: "etag"' -d "new" http://localhost:3000/file.txt

Repository Structure

github.com/JavaScriptSolidServer/jsserve/
├── bin/
│   └── jsserve.js          # CLI entry point (~80 LOC)
├── package.json            # Depends on jss
├── README.md
└── LICENSE

Implementation

The wrapper is ~80 LOC that:

  1. Parses serve-compatible CLI args
  2. Translates to JSS flags
  3. Spawns JSS with --public flag
  4. Prints a nice banner
{
  "name": "jsserve",
  "bin": { "jsserve": "./bin/jsserve.js" },
  "dependencies": {
    "commander": "^12.0.0",
    "jss": "^0.1.0"
  }
}

Difficulty Breakdown

Component LOC Difficulty
CLI wrapper ~80 10/100
Package setup ~20 5/100
README/docs ~100 5/100
Total ~200 20/100

Related Issues

Activity

  1. added
    enhancement
    on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions