{"id":26500111,"url":"https://github.com/0xtlt/webhook-to-bucket","last_synced_at":"2026-05-17T22:35:19.436Z","repository":{"id":281644860,"uuid":"945895468","full_name":"0xtlt/webhook-to-bucket","owner":"0xtlt","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-10T11:41:47.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T05:51:42.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/0xtlt.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}},"created_at":"2025-03-10T09:46:59.000Z","updated_at":"2025-03-10T11:41:50.000Z","dependencies_parsed_at":"2025-03-10T11:47:23.479Z","dependency_job_id":"1c8b9180-47d2-4cb9-b49e-d0599f1ed714","html_url":"https://github.com/0xtlt/webhook-to-bucket","commit_stats":null,"previous_names":["0xtlt/webhook-to-bucket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fwebhook-to-bucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fwebhook-to-bucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fwebhook-to-bucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fwebhook-to-bucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xtlt","download_url":"https://codeload.github.com/0xtlt/webhook-to-bucket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244639405,"owners_count":20485870,"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","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":[],"created_at":"2025-03-20T15:28:46.486Z","updated_at":"2026-05-17T22:35:14.403Z","avatar_url":"https://github.com/0xtlt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webhook to Bucket\n\nA lightweight AdonisJS application that provides a webhook endpoint to store data directly to any S3-compatible storage service.\n\n## Features\n\n- Simple API endpoint `/set` to store data to S3 buckets\n- Password-based authentication to prevent unauthorized access\n- Accepts both string data and file uploads\n- Compatible with any S3-compatible storage service (AWS S3, DigitalOcean Spaces, MinIO, etc.)\n- Docker ready for easy deployment\n- Configurable via environment variables\n\n## Prerequisites\n\n- Node.js 18+ (for local development)\n- Docker and Docker Compose (for containerized deployment)\n- S3-compatible storage service credentials\n\n## Installation\n\n### Local Development\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/webhook-to-bucket.git\n   cd webhook-to-bucket\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Copy `.env.example` to `.env` and configure your environment variables:\n   ```bash\n   cp .env.example .env\n   ```\n\n4. Update the `.env` file with your S3 credentials and webhook password:\n   ```\n   DRIVE_DISK=spaces\n   SPACES_KEY=your_access_key_id\n   SPACES_SECRET=your_secret_access_key\n   SPACES_REGION=your_region\n   SPACES_BUCKET=your_bucket_name\n   SPACES_ENDPOINT=https://your_region.digitaloceanspaces.com\n   APP_PASSWORD=your_secure_webhook_password\n   ```\n\n5. Start the development server:\n   ```bash\n   node ace serve --watch\n   ```\n\n### Docker Deployment\n\n1. Configure your environment variables in `.env` as described above\n\n2. Build and start the Docker container:\n   ```bash\n   docker-compose up -d\n   ```\n\n## Usage\n\nSend a POST request to the `/set` endpoint with the following parameters and the authentication header:\n\n### Required Header\n\n- `X-Webhook-Password`: The password defined in your `.env` file for authentication\n\n### Required Parameters\n\n- `path`: The file path where the data should be stored in the bucket\n\n### Data Parameters (one of the following is required)\n\n- `dataString`: String or JSON content to store\n- `dataFile`: A file upload (using multipart/form-data)\n\n### Example using cURL (string data)\n\n```bash\ncurl -X POST http://localhost:3333/set \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-Webhook-Password: your_secure_webhook_password\" \\\n  -d '{\"path\": \"example/file.json\", \"dataString\": {\"message\": \"Hello, world!\"}}'\n```\n\n### Example using cURL (file upload)\n\n```bash\ncurl -X POST http://localhost:3333/set \\\n  -H \"X-Webhook-Password: your_secure_webhook_password\" \\\n  -F \"path=example/uploaded/image.jpg\" \\\n  -F \"dataFile=@/path/to/local/image.jpg\"\n```\n\n### Example using JavaScript (string data)\n\n```javascript\nfetch('http://localhost:3333/set', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Webhook-Password': 'your_secure_webhook_password'\n  },\n  body: JSON.stringify({\n    path: 'example/file.json',\n    dataString: { message: 'Hello, world!' }\n  }),\n})\n.then(response =\u003e response.json())\n.then(data =\u003e console.log(data))\n.catch(error =\u003e console.error('Error:', error));\n```\n\n### Example using JavaScript (file upload)\n\n```javascript\nconst formData = new FormData();\nformData.append('path', 'example/uploaded/image.jpg');\nformData.append('dataFile', fileInput.files[0]); // Assuming fileInput is an input element of type=\"file\"\n\nfetch('http://localhost:3333/set', {\n  method: 'POST',\n  headers: {\n    'X-Webhook-Password': 'your_secure_webhook_password'\n  },\n  body: formData,\n})\n.then(response =\u003e response.json())\n.then(data =\u003e console.log(data))\n.catch(error =\u003e console.error('Error:', error));\n```\n\n## API Response\n\nA successful API response will look like:\n\n```json\n{\n  \"status\": \"success\",\n  \"message\": \"Data stored successfully\",\n  \"path\": \"example/file.json\"\n}\n```\n\nError responses (401 for authentication failure, 422 for validation errors):\n\n```json\n{\n  \"status\": \"error\",\n  \"message\": \"Unauthorized: Invalid or missing password\"\n}\n```\n\n```json\n{\n  \"status\": \"error\",\n  \"message\": \"Validation failed\",\n  \"errors\": {\n    \"path\": [\"The path field is required\"],\n    \"dataString\": [\"Either dataString or dataFile must be provided\"]\n  }\n}\n```\n\n## Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `PORT` | Port to run the server on | `3333` |\n| `HOST` | Host to run the server on | `localhost` |\n| `NODE_ENV` | Node environment | `development` |\n| `DRIVE_DISK` | Default storage disk to use | `spaces` |\n| `SPACES_KEY` | S3 access key ID | - |\n| `SPACES_SECRET` | S3 secret access key | - |\n| `SPACES_REGION` | S3 region | - |\n| `SPACES_BUCKET` | S3 bucket name | - |\n| `SPACES_ENDPOINT` | S3 endpoint URL | - |\n| `APP_PASSWORD` | Password for webhook authentication | - |\n\n## Security Considerations\n\n- Always use a strong, unique password for the `APP_PASSWORD` environment variable\n- Consider using HTTPS in production to encrypt the password sent in headers\n- If deploying publicly, consider implementing rate limiting to prevent brute force attacks\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fwebhook-to-bucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xtlt%2Fwebhook-to-bucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fwebhook-to-bucket/lists"}