mirror of
https://github.com/0xMassi/webclaw.git
synced 2026-07-21 07:01:01 +02:00
docs: add webclaw-api documentation and DOKPLOY.md
This commit is contained in:
parent
f76df1fdba
commit
7e2f65b939
3 changed files with 71 additions and 0 deletions
64
DOKPLOY.md
Normal file
64
DOKPLOY.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# Deploying webclaw-api on Dokploy
|
||||
|
||||
`webclaw-api` is a lightweight, high-performance REST API wrapper for the webclaw extraction engine. Built with Rust and Axum, it's designed for low-resource environments and seamless integration with external systems.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- A [Dokploy](https://dokploy.com/) instance running on your server.
|
||||
- The webclaw repository connected to your Dokploy (via GitHub or local upload).
|
||||
|
||||
## Deployment Steps
|
||||
|
||||
1. **Create a New Application**:
|
||||
- In Dokploy, create a new application pointing to your webclaw repository.
|
||||
- Select **Docker** as the deployment method.
|
||||
|
||||
2. **Environment Configuration**:
|
||||
Navigate to **Environment Settings** and add the following variables:
|
||||
- `PORT`: `3000` (The port the API will listen on).
|
||||
- `API_KEY`: `your_secure_random_token` (Used for Bearer authentication).
|
||||
|
||||
*Optional (for LLM features):*
|
||||
- `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`.
|
||||
|
||||
3. **Command Configuration**:
|
||||
In the deployment settings, ensure the **Command** (Entrypoint) is set explicitly to:
|
||||
```bash
|
||||
webclaw-api
|
||||
```
|
||||
This ensures that Dokploy runs the REST API server instead of the CLI or MCP server.
|
||||
|
||||
4. **Network Setup**:
|
||||
- Mapping: Map container port `3000` to your desired host port or use a domain with SSL.
|
||||
|
||||
## Usage
|
||||
|
||||
Once deployed, you can interact with the API using any HTTP client.
|
||||
|
||||
### Authentication
|
||||
All requests must include the `Authorization` header if `API_KEY` is set:
|
||||
`Authorization: Bearer <your_secure_random_token>`
|
||||
|
||||
### Endpoint: `POST /api/scrape`
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"url": "https://example.com"
|
||||
}
|
||||
```
|
||||
|
||||
**Example via `curl`:**
|
||||
```bash
|
||||
curl -X POST https://your-webclaw-api.com/api/scrape \
|
||||
-H "Authorization: Bearer your_secure_random_token" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"url": "https://cnpja.com/office/07526557011659"}'
|
||||
```
|
||||
|
||||
### Response Format
|
||||
The API returns a full `ExtractionResult` JSON object, including `metadata`, `content`, and the improved `structured_data` (Data Islands).
|
||||
|
||||
## Performance & Resources
|
||||
- **Idle Memory**: ~20MB - 30MB RAM.
|
||||
- **CPU**: Near zero when idle; efficient single-threaded or multi-threaded processing on request.
|
||||
|
|
@ -95,6 +95,11 @@ cp env.example .env
|
|||
docker compose up -d
|
||||
```
|
||||
|
||||
### Self-Hosted REST API (Dokploy)
|
||||
|
||||
Ready to serve structured JSON for your external apps. Low memory footprint (~30MB), high performance.
|
||||
See [DOKPLOY.md](DOKPLOY.md) for deployment instructions.
|
||||
|
||||
---
|
||||
|
||||
## Why webclaw?
|
||||
|
|
@ -319,6 +324,7 @@ webclaw/
|
|||
webclaw-llm LLM provider chain (Ollama -> OpenAI -> Anthropic)
|
||||
webclaw-pdf PDF text extraction
|
||||
webclaw-mcp MCP server (10 tools for AI agents)
|
||||
webclaw-api REST API server (lightweight, Axum-based)
|
||||
webclaw-cli CLI binary
|
||||
```
|
||||
|
||||
|
|
|
|||
1
response.json
Normal file
1
response.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue