{"id":38155249,"url":"https://github.com/johnwmail/random","last_synced_at":"2026-01-16T23:05:23.885Z","repository":{"id":319843369,"uuid":"1037072492","full_name":"johnwmail/random","owner":"johnwmail","description":"Go web service that generates secure random strings","archived":false,"fork":false,"pushed_at":"2025-11-23T02:14:04.000Z","size":161,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-23T02:27:09.715Z","etag":null,"topics":["random-string-generator"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnwmail.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-13T03:01:11.000Z","updated_at":"2025-11-23T00:44:11.000Z","dependencies_parsed_at":"2025-10-20T14:17:14.925Z","dependency_job_id":"82cf48e4-8b3a-484e-90f2-6a19bd722f9d","html_url":"https://github.com/johnwmail/random","commit_stats":null,"previous_names":["johnwmail/random"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/johnwmail/random","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmail%2Frandom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmail%2Frandom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmail%2Frandom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmail%2Frandom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnwmail","download_url":"https://codeload.github.com/johnwmail/random/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmail%2Frandom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28487131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["random-string-generator"],"created_at":"2026-01-16T23:05:18.825Z","updated_at":"2026-01-16T23:05:23.872Z","avatar_url":"https://github.com/johnwmail.png","language":"Go","readme":"# Random\n\n[![Test](https://github.com/johnwmail/random/workflows/Test/badge.svg)](https://github.com/johnwmail/random/actions/workflows/test.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/johnwmail/random)](https://goreportcard.com/report/github.com/johnwmail/random)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![GitHub release](https://img.shields.io/github/release/johnwmail/random.svg)](https://github.com/johnwmail/random/releases)\n[![Go Version](https://img.shields.io/badge/go-1.23+-blue.svg)](go.mod)\n\nA tiny Go web service that generates secure random strings via HTML and JSON endpoints. The service runs locally, in Docker, or on AWS Lambda via the aws-lambda-go-api-proxy adapters.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Quick Start](#quick-start)\n- [Deployment](#deployment)\n- [Configuration](#configuration)\n- [API Endpoints](#api-endpoints)\n- [Development](#development)\n- [Build Metadata](#build-metadata)\n- [Links](#links)\n\n\u003ca id=\"overview\"\u003e\u003c/a\u003e\n## Overview\n\n`random` ships a minimal UI at `/` and a JSON API at `/json`. Both endpoints generate two strings on every request:\n\n- **Printable String**: Alphanumeric with 1–3 substitutions from `!#$%*+-=?@^_`\n- **Alphanumeric String**: Letters and digits only\n\nQuery parameters let callers control the length of each string while the server clamps values to the safe range of 1–99 characters.\n\n\u003ca id=\"features\"\u003e\u003c/a\u003e\n## ✨ Features\n\n- 🚀 **Live Web UI** – Interactive page updates strings instantly as you tweak lengths\n- 🎯 **JSON API** – Simple `GET /json` endpoint for programmatic clients\n- 📏 **Length Clamping** – Prevents invalid values and enforces 1–99 character range\n- 🔄 **Cache Busting** – Build metadata injected into static assets for fresh browser loads\n- ☁️ **Lambda Ready** – Auto-detects `AWS_LAMBDA_FUNCTION_NAME` and runs behind API Gateway with zero code changes\n- 🔬 **Tested** – Unit tests cover string generation, HTML rendering, and Lambda adapters\n\n\u003ca id=\"quick-start\"\u003e\u003c/a\u003e\n## 🚀 Quick Start\n\n### Run with Go\n\nRequires Go 1.23+.\n\n```bash\ngit clone https://github.com/johnwmail/random.git\ncd random\ngo run ./...\n# or build a binary\ngo build -o random .\n./random\n```\n\nVisit http://localhost:8080 for the UI or call http://localhost:8080/json?p=20\u0026a=25 for JSON.\n\n### Quick API Examples\n\n```bash\n# Printable=33, Alphanumeric=22\ncurl -fsS \"http://localhost:8080/json?p=33\u0026a=22\"\n\n# Open the UI (macOS)\nopen http://localhost:8080/\n```\n\n\u003ca id=\"deployment\"\u003e\u003c/a\u003e\n## ☁️ Deployment\n\n### Docker\n\n```bash\ndocker build -t random:local -f docker/Dockerfile .\ndocker run --rm -p 8080:8080 --name random random:local\n```\n\nUsing Compose:\n\n```bash\ndocker compose -f docker/docker-compose.yml up --build\n```\n\n### AWS Lambda\n\nThe app switches to Lambda mode when `AWS_LAMBDA_FUNCTION_NAME` is present. The `deploy-lambda.yml` workflow builds a `bootstrap` binary and deploys it via the custom runtime.\n\nKey environment values for deployment:\n\n| Secret/Var | Purpose |\n|-----------|---------|\n| `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` | Authentication for CI deployments |\n| `AWS_REGION` | Target region |\n| `LAMBDA_FUNCTION_NAME` | Lambda function to update |\n\nThe workflow produces a zip archive in `lambda-artifacts/` and publishes a new version.\n\n\u003ca id=\"configuration\"\u003e\u003c/a\u003e\n## ⚙️ Configuration\n\nThe service intentionally keeps configuration surface area small. Important knobs:\n\n| Option | Description |\n|--------|-------------|\n| Query `p` | Printable string length (default random 12–30) |\n| Query `a` | Alphanumeric string length (default random 12–30) |\n| Env `PORT` | Port for the web server to listen on (default `8080`) |\n| Env `AWS_LAMBDA_FUNCTION_NAME` | Enables Lambda adapter mode |\n\nValues outside 1–99 are clamped automatically.\n\n\u003ca id=\"api-endpoints\"\u003e\u003c/a\u003e\n## 📋 API Endpoints\n\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | `/` | HTML UI with live length controls |\n| GET | `/json` | JSON payload describing both strings |\n\nNote on CLI clients\n-------------------\n\nBy default the service will return JSON to programmatic or CLI clients (for example `curl`, `wget`, `powershell`, `httpie`, language HTTP libraries, etc.). This is detected using the `User-Agent` header. If you need to force HTML from a CLI client, request the `/` endpoint with an explicit `Accept: text/html` header or use a browser; to force JSON use `/json` or `Accept: application/json`.\n\nSample JSON response:\n\n```json\n{\n  \"printable\": {\n    \"length\": 33,\n    \"string\": \"P7d*93g1...\"\n  },\n  \"alphanumeric\": {\n    \"length\": 22,\n    \"string\": \"dN7Z0tXy4Kq1...\"\n  }\n}\n```\n\n\u003ca id=\"development\"\u003e\u003c/a\u003e\n## 🔧 Development\n\n```bash\n# Format, lint, and test\ngo fmt ./...\ngo vet ./...\ngolangci-lint run\ngo test ./...\n\n# Run the service locally during development\ngo run ./...\n```\n\nThe CI pipeline in `.github/workflows/test.yml` enforces the formatting, linting, and testing steps above.\n\n\u003ca id=\"build-metadata\"\u003e\u003c/a\u003e\n## 🏷️ Build Metadata\n\n`main.go` exposes three variables injected at build time:\n\n| Variable | Default | Purpose |\n|----------|---------|---------|\n| `Version` | `dev` | Semantic version or git tag |\n| `BuildTime` | `unknown` | Build timestamp (ISO 8601 recommended) |\n| `CommitHash` | `none` | Git commit SHA |\n\nInject values with Go build flags:\n\n```bash\ngo build \\\n  -ldflags \"-X main.Version=v1.2.3 -X main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X main.CommitHash=$(git rev-parse --short HEAD)\" \\\n  -o random .\n```\n\nThe values are printed on startup and wired into the HTML template for cache busting of static assets.\n\n\u003ca id=\"links\"\u003e\u003c/a\u003e\n## 🔗 Links\n\n- **GitHub**: https://github.com/johnwmail/random\n- **Issues**: https://github.com/johnwmail/random/issues\n- **Actions**: https://github.com/johnwmail/random/actions\n\n---\n\n⭐ Star the project if this random string generator helps you out!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnwmail%2Frandom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnwmail%2Frandom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnwmail%2Frandom/lists"}