Skip to content

r3rc/srce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

srce

Private package registry for Bun and Deno with JSR-style imports.

Features

  • JSR-style imports@scope/package@version/file.ts
  • Scoped tokens — Fine-grained access control per scope
  • Symlinks mode — Local development without republishing
  • Zero external services — SQLite + filesystem storage
  • Lightweight — Single binary, minimal dependencies

Installation

bun add -g @r3rc/srce

Quick Start

# Initialize registry (creates admin token)
srce init --data ./registry

# Start server
srce serve --port 4873 --data ./registry

# Login to registry
srce login http://localhost:4873 --token <admin-token>

# Publish a package
cd my-package
srce publish

CLI Commands

Server

srce serve [options]
  --port <port>       Port to listen on (default: 4873)
  --data <dir>        Data directory (default: ./data)
  --symlinks <dir>    Symlinks directory for local dev

Registry Management

srce init [options]
  --data <dir>        Data directory (default: ./data)

Tokens

srce token create <name> [options]
  --scopes <scopes>   Comma-separated scopes (e.g. @r3/*,@internal/*)
  --admin             Create admin token
  --data <dir>        Data directory

srce token list [options]
srce token revoke <id> [options]

Packages

srce list [options]
  --registry <url>    Registry URL (or use local mode)
  --data <dir>        Data directory for local mode

srce info <@scope/name> [options]

srce publish [options]
  --registry <url>    Registry URL
  --token <token>     Auth token
  --dir <dir>         Package directory (default: .)

srce deprecate <@scope/name@version> <message> [options]
srce undeprecate <@scope/name@version> [options]

Authentication

srce login <registry> [options]
  --token <token>     Auth token (or enter interactively)

srce logout
srce whoami

Importing Packages

Deno

import { something } from "http://localhost:4873/@scope/package@1.0.0/mod.ts";

With import map:

{
    "imports": {
        "@scope/package": "http://localhost:4873/@scope/package@1.0.0/mod.ts"
    }
}

Bun

Configure bunfig.toml:

[install.scopes]
"@scope" = "http://localhost:4873"

Then import normally:

import { something } from "@scope/package";

Package Structure

Packages need a package.json with:

{
    "name": "@scope/package",
    "version": "1.0.0",
    "exports": {
        ".": "./mod.ts",
        "./utils": "./utils.ts"
    }
}

API Endpoints

Method Endpoint Description
GET /@:scope/:name/meta.json Package metadata
GET /@:scope/:name@:version/* File contents
GET /api/packages List all packages
GET /api/packages/@:scope/:name Package details
POST /api/publish Publish package
PATCH /api/packages/@:scope/:name/:version Deprecate version
DELETE /api/packages/@:scope/:name/:version Delete version
GET /api/tokens List tokens (admin)
POST /api/tokens Create token (admin)
DELETE /api/tokens/:id Delete token (admin)

Development

# Install dependencies
bun install

# Run dev server
bun run dev

# Lint
bun run lint

# Format
bun run fmt

# Type check
bun run check

Symlinks Mode

For local development without republishing:

srce serve --symlinks /path/to/packages

Files are served from the symlinks directory, falling back to stored versions.

License

MIT

About

A lightweight private registry for the post-Node era. Native support for Deno and Bun.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors