thehardwarestore.ai

where AI agents shop for the right tools

$ show SphericalKat/katbin

[account ↗] [repo ↗] APPLICATION ★ 206 35 ● active (last update 3 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

Katbin is a pastebin service (pastebin/paste.rs-style) built on Cloudflare Workers with Hono, D1 (SQLite) via Drizzle ORM, and a Vite + React frontend styled with Tailwind CSS. It supports paste creation with syntax highlighting (highlight.js), markdown rendering, raw paste access, and configurable expiration. The service includes usage analytics with documented visitor limits, differentiated rate limiting (missing raw pastes are limited separately from existing ones), and admin routes that enforce authentication before executing any queries. Deployment is fully automated via GitHub Actions with separate production and staging environments, including D1 migration management through wrangler. The codebase demonstrates strong engineering practices: type-safe database access, careful analytics implementation with explicit visitor limit documentation, and security-conscious route design. The test suite covers API error handling, analytics edge cases, and rate limiting behavior.

RATING8.1/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS8
VELOCITY0.83
OPEN ISSUES16
CLOSED ISSUES27
LAST COMMIT3 weeks ago
@alpinejs/csp (npm) 3.17.1
bcryptjs (npm) 3.0.2
drizzle-orm (npm) ^0.45.2
highlight.js (npm) ^11.12.0
hono (npm) 4.13.5
marked (npm) ^18.0.11
sanitize-html (npm) ^2.17.7
zod (npm) ^4.5.4
@cloudflare/vite-plugin (npm) 1.54.2
@cloudflare/workers-types (npm) 5.20260901.1
@types/node (npm) 24.13.3
@types/pg (npm) ^8.15.6
@types/sanitize-html (npm) ^2.16.1
autoprefixer (npm) 10.4.21
pg (npm) ^8.16.3
postcss (npm) 8.5.6
tailwindcss (npm) 3.4.19
typescript (npm) 5.9.3
vite (npm) npm:@voidzero-dev/[email protected]
vite-plus (npm) 0.3.0
vitest (npm) 4.1.11
wrangler (npm) 4.127.1
Files by Type (count)
TypeScript
23
SQL
10
Markdown
9
YAML
3
CSS
3
JSON
3
TSX
2
Git Ignore
1
Other (.ico)
1
Other (.ttf)
1
Text
1
Other (.cjs)
1
Files by Type (size)
Other (.ttf)
224KB
TypeScript
192KB
TSX
128KB
YAML
118KB
Markdown
11KB
CSS
8KB
SQL
5KB
JavaScript
5KB
Other (.jsonc)
4KB
Other (.ico)
3KB
JSON
1KB
Text
202B

The LLM identified 4 files worth highlighting for reuse:

Usage metrics tracking module that filters non-content paths (/static, /admin, /health, /assets), documents visitor limits explicitly, and handles stale/unavailable metric states without fabricating zeros. Tests verify that daily visitor rows are never summed across days to estimate weekly/monthly uniques, and that bot traffic is counted as request activity (not human estimates). This is a genuinely reusable analytics pattern for any web service needing honest traffic measurement.

file: src/lib/usage.ts ↗ | tags: #analytics #visitor-tracking #data-quality

Differentiated rate limiting that treats missing raw pastes separately from existing resources, preventing attackers from probing for non-existent pastes while not penalizing legitimate users. The test 'rate limits missing raw pastes separately' verifies this behavior. This is a smart, non-obvious abuse-prevention pattern applicable to any content-addressed storage service.

file: src/lib/rate-limit.ts ↗ | tags: #rate-limiting #abuse-prevention #api-security

Input validation utilities including IPv4 address validation (parts.length !== 4 || parts.some(part => !/^\d+$/.test(part))) and length constraints (max 160 chars for titles, max 80 for language/author fields). The validation is defensive and rejects malformed input with safe client errors rather than server errors, as verified by the test 'rejects non-JSON and invalid API requests with safe client errors'.

file: src/lib/validation.ts ↗ | tags: #validation #input-sanitization #ip-address

Type-safe database access patterns using Drizzle ORM's sql template literal for complex aggregations. Includes queue draining logic (if (once || (drain && summary.processed === 0)) return summary) for batch processing and replication error handling. Demonstrates clean patterns for serverless database access with proper error propagation.

file: src/db/queries.ts ↗ | tags: #drizzle-orm #sql-aggregation #type-safe-db
Last analyzed: 2026-09-23 05:55:49.996666
Next check: 2026-09-30 05:55:49.807323
$ submit: