Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# GPTKit

GPTKit is a unified backend designed to provide tools via HTTP Actions for Custom GPTs.

## Tools

### WHOIS (`/domain/whois`)

Allows checking domain name availability and retrieving WHOIS information.

- **Endpoint**: `GET /domain/whois`
- **Parameters**:
- `domain` (required): The domain name to check (e.g., `google.com`).
- `force` (optional): `1` to force a fresh WHOIS lookup (ignores cache).
- **Features**:
- Persistent cache (SQLite).
- Rate limiting (global and per domain).
- Automatic availability parsing for major TLDs.

## Deployment

### Docker Compose

Here is an example `docker-compose.yml` configuration to deploy GPTKit.

> **Note**: The image is available on GHCR. Make sure to replace `your-username` with your GitHub username.

```yaml
services:
gptkit:
image: ghcr.io/your-username/gptkit:latest
restart: unless-stopped
ports:
- "8000:8000"
environment:
# Database path inside the container
- DB_PATH=/app/data/whois_cache.db
volumes:
# Data persistence (WHOIS cache)
- ./gptkit_data:/app/data
```

### Environment Variables

| Variable | Description | Default |
|----------|-------------|--------|
| `DB_PATH` | Path to the SQLite database file | `whois_cache.db` |

## Development

1. **Installation**:
```bash
pip install -r requirements.txt
```

2. **Run**:
```bash
uvicorn app.main:app --reload
```

3. **Tests**:
```bash
curl "http://localhost:8000/domain/whois?domain=example.com"
```
6 changes: 4 additions & 2 deletions app/services/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
from datetime import datetime, timezone
from typing import Optional, Dict, Any

import os

class WhoisCache:
def __init__(self, db_path: str = "whois_cache.db"):
self.db_path = db_path
def __init__(self, db_path: str = None):
self.db_path = db_path or os.getenv("DB_PATH", "whois_cache.db")
self._init_db()

def _init_db(self):
Expand Down