SnackBin is a web application that allows users to create temporary endpoints (bins) to collect and inspect HTTP requests. It's a powerful tool for debugging webhooks, analyzing HTTP headers, payloads, and more.
- Create Temporary Bins: Generate unique endpoints to collect HTTP requests.
- Inspect Requests: View detailed information about requests, including headers, body, method, path, and query parameters.
- GitHub Webhook Integration: Handle GitHub webhook payloads.
- Basecamp Integration: Handle Basecamp payloads.
- Analytics: Analyze request patterns, popular methods, common paths, and more.
- Queue Management: Manage a queue of GitHub payloads.
- Real-time Updates: Utilize Socket.io for real-time updates.
- Node.js: Server-side JavaScript runtime.
- Express: Web application framework for Node.js.
- Mongoose: Elegant MongoDB object modeling for Node.js.
- PostgreSQL: Open-source relational database.
- Docker: Containerization platform.
- Socket.io: Real-time engine for web sockets.
- Clone the Repository:
git clone https://github.com/marwan37/snackbin.git
- Navigate to the Directory:
cd snackbin
- Install Dependencies:
npm install
- Build Docker Containers:
docker-compose up --build
- Initialize Database:
CREATE TABLE IF NOT EXISTS bins (
id SERIAL PRIMARY KEY,
endpoint_url VARCHAR(255),
created_at TIMESTAMP DEFAULT current_timestamp
);
CREATE TABLE IF NOT EXISTS requests (
id SERIAL PRIMARY KEY,
bin_id INT REFERENCES bins(id),
headers JSON,
body JSON,
method VARCHAR(10),
path VARCHAR(255),
query JSON,
created_at TIMESTAMP DEFAULT current_timestamp
);
- Create a New Bin:
POST /api/bin/new
- Get Bin by ID:
GET /api/bin/:id
- Delete a Request from a Bin:
DELETE /api/bin/:id/:rid
- Handle GitHub Webhook Payload:
POST /bin/:id/github-webhook
- Handle Basecamp Payload:
POST /bin/:id/basecamp
- Get Basecamp Payloads:
GET /api/bin/basecamp/:id
After creating a bin in the application, a unique URL will be generated containing an ID specific to that bin. You can use this URL to set up webhooks for Basecamp and GitHub by following these steps:
- Copy the unique bin URL.
- Append
/basecamp
to the URL. (e.g.,http://yourdomain.com/bin-id/basecamp
) - Paste this modified URL into the webhook settings in your Basecamp project.
- Copy the unique bin URL.
- Append
/github-webhook
to the URL. (e.g.,http://yourdomain.com/bin-id/github-webhook
) - Paste this modified URL into the webhook settings in your GitHub repository.
Make sure to replace http://yourdomain.com/bin-id
with the actual unique bin URL generated by the application. These endpoints will now receive payloads from Basecamp and GitHub respectively.
Feel free to fork the repository, create a feature branch, and submit a pull request.
This project is licensed under the MIT License.