Skip to content

christianfosli/new-uuid.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

new-uuid.com

.github/workflows/cicd.yaml

Have you ever wanted to quickly generate a uuid (universally unique identifier), without leaving the terminal, and without installing any tools?

Now you can 😄

Usage

# print to terminal
curl https://new-uuid.com

# copy to clipboard (Windows git-bash or WSL)
curl https://new-uuid.com | clip.exe

# copy to clipboard (Windows PowerShell)
curl.exe https://new-uuid.com | clip.exe

# copy to clipboard (Linux with Wayland)
curl https://new-uuid.com | wl-copy

# etc...

Development

I'm using Rust to create a web assembly (wasm32-wasi) binary, and running it on Cloudflare's serverless platform; Cloudflare workers.

This is inspired by a blogpost by Cloudflare.

Build web assembly wasm32-wasi binary

Prerequisites: Install rust. Add the wasm32-wasi target with rustup target add wasm32-wasi. Clone repository.

cargo build --target wasm32-wasi --release

Run locally with a wasm runtime

Prerequisites: Install a wasm runtime, e.g. wasmtime. Build a wasm binary (see above).

wasmtime ./target/wasm32-wasi/releases/new-uuid.wasm

Run on cloudflare worker for local development

Prerequisites: Install node/npm. Create a cloudflare account. Build a wasm binary (see above).

npx wrangler@wasm dev target/wasm32-wasi/release/new-uuid.wasm

# then test it with curl
curl http://localhost:8787

Deployment

Deployment to Cloudflare is automatic on push to main. See GitHub actions workflow for details.

Manual one-time steps
  • Buy new-uuid.com domain
  • Add new-uuid.com as a website in Cloudflare with free plan
  • Follow the suggested steps for DNS configuration and updating the domain registrar to use Cloudflare's name servers
  • Generate API token in Cloudflare
  • Add the API token and Account ID to GitHub actions secrets
  • Add custom domain for workers through Cloudflare dashboard

Releases

No releases published

Packages

No packages published

Languages