How emon100/mypastebin works
Project type and purpose
• This is a full-stack, serverless pastebin application (“MyPastebin”) with:
• A React+TypeScript+Material-UI single-page frontend
• A Cloudflare Workers backend (REST API)
• A Cloudflare KV store for persistence
• Cloudflare Turnstile for CAPTCHA protection
• “Admin Panel” endpoints for management
File structure
• Top-level files:
• index.html, public/ – static shell & assets for the SPA
• src/ – frontend source code (App.tsx, components, assets)
• src/worker/index.ts – backend entrypoint
• wrangler.toml – Worker config
• .env* / .dev.vars* – environment variables for frontend & worker
• vite.config.ts, tsconfig*.json, eslint.config.js – build & lint
• Patterns:
• SPA served by Vite (dev) or static build
• Serverless API (Workers) calling KV namespace
• Separation of front-end and back-end env vars
README for additional insights
• The frontend calls the Worker API at VITE_API_URL
• Worker endpoints: create paste, view paste, admin list/delete
• Turnstile is used on both create-paste and admin operations
• Deployment involves Wrangler for Cloudflare
Detailed breakdown
• CreatePaste component → POST /api/paste
• ViewPaste component → GET /api/paste/:id
• AdminPanel component → GET/DELETE /api/admin/*
• Turnstile widget integrated on CreatePaste/AdminPanel forms
• HTTP handler (routes requests)
• Turnstile validation module
• KV read/write layer
• Configuration flow: Wrangler reads .dev.vars → sets secrets in Worker
Summary