Skip to content

shadowfax92/docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📎 docs

Share documents with short, clean URLs.

One command. File uploaded, link in your clipboard.

Upload a PDF, HTML, or Markdown file and get a short URL that renders it directly in the browser. No login walls, no download prompts, no ugly Google Drive links.

  • One commanddocs upload report.pdf → short URL copied to clipboard
  • Renders in browser — PDFs display inline, HTML served as-is, Markdown rendered with GitHub styling
  • Short URLshttps://your-domain.com/xK9mRt2p — clean and shareable
  • Fast & global — served from Cloudflare's edge network via R2 + Workers
  • Simple auth — bearer token for uploads, public read for viewing

Install

Requires Go 1.22+.

git clone <repo>
cd docs
make install

Setup

1. Deploy the Worker

cd worker
npm install
npx wrangler login          # if not already logged in
npx wrangler r2 bucket create docs-cli
npx wrangler deploy
npx wrangler secret put AUTH_TOKEN

Generate a token with openssl rand -hex 32 and paste when prompted.

2. Configure the CLI

docs config

Enter your worker URL (printed after wrangler deploy) and the same auth token.

Config stored at ~/.config/docs/config.yaml:

url: https://docs.yourdomain.workers.dev
token: your-auth-token

Usage

docs upload report.pdf           # upload PDF, get short URL
docs upload page.html            # upload HTML page
docs upload notes.md             # upload Markdown (rendered with GitHub CSS)

The URL is printed and copied to your clipboard automatically.

Supported File Types

Extension Rendering
.pdf Displayed inline in browser's PDF viewer
.html, .htm Served as-is with original formatting
.md, .markdown Rendered with GitHub-flavored Markdown (light theme)

How It Works

docs upload file.pdf
     │
     ▼
┌─────────┐    PUT /upload     ┌──────────────────┐     put()    ┌─────────┐
│  CLI     │ ──────────────▶   │  Cloudflare       │ ──────────▶ │  R2     │
│  (Go)    │   Bearer token    │  Worker           │             │  Bucket │
└─────────┘                    └──────────────────┘             └─────────┘
     ▲                                │
     │                                │
     └── { url: "https://…/xK9mRt2p" }

Browser GET /xK9mRt2p  ──▶  Worker  ──▶  R2  ──▶  file served
  • CLI sends the file to the Worker with a bearer token
  • Worker generates an 8-character short ID, stores the file in R2
  • Worker returns the short URL, CLI copies it to clipboard
  • Anyone with the URL can view the document — no auth required

Commands

Command Description
docs upload <file> Upload a file and get a short URL
docs config Set worker URL and auth token
docs help Show help

Custom Domain

To use your own domain instead of *.workers.dev:

  1. Add a custom domain in the Cloudflare dashboard under Workers → your worker → Triggers → Custom Domains
  2. Update your CLI config: docs config with the new URL

Built for sharing docs fast between co-founders. No frills, just works.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors