Skip to content

Developer toolkit for collecting and debugging HTTP requests & webhooks in real-time (Socket.io, PostgreSQL, MongoDB)

Notifications You must be signed in to change notification settings

marwan37/snackbin

Repository files navigation

SnackBin - A RequestBin-like Web Application

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.

Table of Contents

  1. Features
  2. Technologies
  3. Installation
  4. Usage
  5. Contributing
  6. License

Features

  • 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.

Technologies

  • 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.

Installation

  1. Clone the Repository:
git clone https://github.com/marwan37/snackbin.git
  1. Navigate to the Directory:
cd snackbin
  1. Install Dependencies:
npm install
  1. Build Docker Containers:
docker-compose up --build
  1. 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
);

Usage

  • 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

Setting up Webhooks for Basecamp and Github

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:

For Basecamp:

  1. Copy the unique bin URL.
  2. Append /basecamp to the URL. (e.g., http://yourdomain.com/bin-id/basecamp)
  3. Paste this modified URL into the webhook settings in your Basecamp project.

For GitHub:

  1. Copy the unique bin URL.
  2. Append /github-webhook to the URL. (e.g., http://yourdomain.com/bin-id/github-webhook)
  3. 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.

Contributing

Feel free to fork the repository, create a feature branch, and submit a pull request.

License

This project is licensed under the MIT License.

About

Developer toolkit for collecting and debugging HTTP requests & webhooks in real-time (Socket.io, PostgreSQL, MongoDB)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published