{"id":30612450,"url":"https://github.com/fewsats/proxy402","last_synced_at":"2025-08-30T05:14:22.921Z","repository":{"id":292042987,"uuid":"971891453","full_name":"Fewsats/proxy402","owner":"Fewsats","description":"URL shortener","archived":false,"fork":false,"pushed_at":"2025-06-02T20:21:23.000Z","size":2137,"stargazers_count":18,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-03T03:45:03.344Z","etag":null,"topics":["ai","ai-agents","coinbase","llm","x402"],"latest_commit_sha":null,"homepage":"https://proxy402.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fewsats.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-04-24T08:04:35.000Z","updated_at":"2025-06-02T20:21:26.000Z","dependencies_parsed_at":"2025-05-26T15:39:21.319Z","dependency_job_id":null,"html_url":"https://github.com/Fewsats/proxy402","commit_stats":null,"previous_names":["fewsats/proxy402"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Fewsats/proxy402","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fewsats%2Fproxy402","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fewsats%2Fproxy402/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fewsats%2Fproxy402/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fewsats%2Fproxy402/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fewsats","download_url":"https://codeload.github.com/Fewsats/proxy402/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fewsats%2Fproxy402/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272805572,"owners_count":24995916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ai","ai-agents","coinbase","llm","x402"],"created_at":"2025-08-30T05:14:19.503Z","updated_at":"2025-08-30T05:14:22.913Z","avatar_url":"https://github.com/Fewsats.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proxy402 - Monetize APIs with x402\n\nProxy402 lets you monetize APIs by requiring x402 payments on Base before accessing your endpoints.\n\n## Quick Start (Client)\n\nTest Proxy402 instantly with our pre-configured client:\n\n```bash\n# Clone the repo\ngit clone https://github.com/Fewsats/proxy402.git\ncd proxy402/client\n\n# Copy sample env file\ncp .env.example .env\n\n# Add your wallet keys to the .env file\n# You can generate these keys with cast (google how to install foundry, cast is part of the suite)\n# Then run the following command to get a test address\ncast w new\n\n# You will need Base Sepolia ETH \u0026 USDC. Get them from these faucets:\n- [Base Sepolia ETH](https://portal.cdp.coinbase.com/products/faucet)\n- [Base Sepolia USDC](https://faucet.circle.com/)\n\n# Install dependencies\nnpm install\n\n# Run client against a test endpoint (returns Bitcoin whitepaper)\nnpm run client https://proxy402.com/wUUbqudYsM\n```\n\n## Running Your Own Server\n\n### Prerequisites\n\n- [Docker \u0026 Docker Compose](https://docs.docker.com/engine/install/)\n\n### Setup\n\n```bash\n# Clone the repo (if you haven't already)\ngit clone https://github.com/Fewsats/proxy402.git\ncd proxy402\n\n# Configure environment\ncp .env.example .env\n# Edit .env file with your details\n\n# Start the server with Docker Compose\ndocker compose up\n```\n\nImportant .env variables:\n- `X402_PAYMENT_ADDRESS`: Your Base wallet address for receiving payments (works for Base Sepolia \u0026 Base Mainnet)\n- `GOOGLE_CLIENT_ID` \u0026 `GOOGLE_CLIENT_SECRET`: For auth (obtain from [Google Cloud Console](https://console.cloud.google.com/apis/credentials))\n\n### Creating Monetized Routes\n\n1. Visit `http://localhost:8080` and log in\n2. Fill the form with:\n   - Target URL to monetize\n   - Price in USDC\n   - HTTP method\n   - Test mode (on/off)\n3. Use your new link: `http://localhost:8080/YOUR_SHORT_CODE`\n\n## Target URL Verification\n\nProxy402 adds a `Proxy402-Secret` header to forwarded requests:\n\n```javascript\n// Node.js example\napp.get('/api/data', (req, res) =\u003e {\n  if (req.headers['proxy402-secret'] !== 'YOUR_SECRET_FROM_USER_SETTINGS') {\n    return res.status(403).json({ error: 'Unauthorized' });\n  }\n  res.json({ data: 'Your protected data' });\n});\n```\n\n## Additional Information\n\n### Client Setup Details\n\nThe client uses your private key to make payments on Base:\n\n```dotenv\n# client/.env\nPRIVATE_KEY=\"YOUR_CLIENT_WALLET_PRIVATE_KEY\" # Never commit this to Git\n```\n\n### Server API Example\n\n```bash\n# Create route via API\ncurl -X POST http://localhost:8080/links/shrink \\\n     -H \"Authorization: Bearer YOUR_JWT_TOKEN\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\n           \"target_url\": \"https://raw.githubusercontent.com/ibz/bitcoin-whitepaper-markdown/refs/heads/master/bitcoin-whitepaper.md\",\n           \"method\": \"GET\",\n           \"price\": \"0.0001\", \n           \"is_test\": true\n         }'\n```\n\n### How It Works\n\n1. Client requests protected resource\n2. Server returns 402 with x402 payment token\n3. Client pays using Base and x402-axios library\n4. Client retries with proof of payment\n5. Server forwards request to target URL\n\nFor more details visit [x402.org](https://x402.org)\n\n### Cloudflare R2 CORS Configuration\n\nIf using file uploads with Cloudflare R2, configure CORS to allow direct browser uploads:\n\nYou can configure it via Cloudflare dashboard:\n1. Go to R2 \u003e Your bucket \u003e Settings \u003e CORS\n2. Add rules for both origins: `http://localhost:3009` and `https://your-domain.com`\n3. Allow methods: PUT, GET, HEAD, DELETE\n4. Allow all headers (`*`)\n\n## Need Help?\n\nJoin our [Discord](https://discord.gg/2tPYBgWzQm) for support and discussions.\n\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffewsats%2Fproxy402","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffewsats%2Fproxy402","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffewsats%2Fproxy402/lists"}