Grabid is a utility service for grabbing and streaming content from URLs. It consists of a secure Go backend that acts as a proxy/streamer and a modern React frontend for user interaction.
- Probe URL: Check the size and content type of a remote resource without downloading the full content.
- Stream Content: Stream data from a remote URL to the client, acting as a proxy.
- Authentication: Optional security layer using a secret token (
GRAB_SECRET) to restrict access. - Dockerized: Fully containerized with Docker Compose for easy deployment.
-
Clone the repository:
git clone https://github.com/CodeTease/grabid.git cd grabid -
Start the application:
docker-compose up --build
-
Access the application: Open your browser and navigate to
http://localhost.
You can also run the application directly from the GitHub Container Registry without cloning the repository.
-
Create a Docker network:
docker network create grabid-net
-
Start the backend:
docker run -d \ --name grabid-backend \ --network grabid-net \ -p 8080:8080 \ -e GRAB_SECRET=your_secret \ ghcr.io/codetease/grabid-backend:latest
-
Start the frontend:
docker run -d \ --name grabid-frontend \ --network grabid-net \ -p 80:80 \ ghcr.io/codetease/grabid-frontend:latest
The application can be configured using environment variables. You can set these in the docker-compose.yml file or in a .env file.
| Variable | Description | Default |
|---|---|---|
PORT |
The port on which the backend service runs. | 8080 |
GRAB_SECRET |
Secret token for authentication. If set, requests must include X-Grab-Token header. |
(Empty/Public) |
GRAB_MAX_SIZE |
Maximum file size to stream (e.g. 1GB, 500MB). | 1GB |
GRAB_MAX_CONCURRENT |
Maximum concurrent stream requests. | 5 |
GRAB_RATE_LIMIT |
Rate limit per IP (requests-burst). | 1-5 |
For local development (npm run dev), the frontend can be configured:
| Variable | Description | Default |
|---|---|---|
VITE_API_URL |
The URL of the backend API for proxying requests. | http://localhost:8080 |
HEAD request to get metadata about a remote resource.
- Endpoint:
/api/v1/probe - Method:
HEAD - Query Params:
url(The target URL) - Headers:
X-Grab-Token(IfGRAB_SECRETis set) - Response:
200 OK: Returns JSON withsizeandtype.
GET request to stream the content of a remote resource.
- Endpoint:
/api/v1/stream - Method:
GET - Query Params:
url(The target URL) - Headers:
X-Grab-Token(IfGRAB_SECRETis set) - Response: stream of the file content.
- Navigate to the backend directory:
cd grabid-backend - Install dependencies:
go mod download
- Run the server:
go run main.go
- Run tests:
go test ./...
- Navigate to the frontend directory:
cd grabid-frontend - Install dependencies:
npm install
- Start the development server:
npm run dev
- Lint the code:
npm run lint
- Build for production:
npm run build