This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
SkyShot is a screenshot-as-a-service microservice built with Skykit. It captures full-page screenshots of websites using headless Chrome and serves them via REST API.
# Run with Docker (recommended)
docker build -t skyshot .
docker run -p 5000:5000 skyshot
# Run locally (requires Chromium)
go run .
# Build
go build -o skyshot .
# Test screenshot
curl http://localhost:5000/myapp -o test.png
skyshot/
├── main.go # Entry point with embedded default image
├── controllers/
│ └── screenshots.go # Screenshot capture and serving
├── models/
│ ├── database.go # Database connection
│ └── screenshot.go # Screenshot model and chromedp logic
├── views/
│ └── home.html # Homepage
└── resources/
└── default.png # Embedded fallback image
| Route | Handler | Purpose |
|---|---|---|
GET / |
Homepage | Usage documentation |
GET /{app} |
handleScreenshot | Serve cached screenshot or default |
POST /capture |
handleCapture | Trigger background capture |
type Screenshot struct {
skykit.Model
ImageData []byte // PNG bytes stored in database
}
ID is the app name (not auto-generated UUID).
/{app}type ScreenshotsController struct {
skykit.Controller
defaultImg []byte // Embedded fallback
mutex *sync.Mutex // Protects capturing map
capturing map[string]bool // Prevents duplicate captures
}
Located in models/screenshot.go. Uses:
chromedp.Navigate(url) - Load the pagechromedp.WaitReady("body") - Wait for DOMchromedp.FullScreenshot(&buf, quality) - Capture PNG| Variable | Required | Description |
|---|---|---|
PORT |
No | Server port (default: 5000) |
HOST_PREFIX |
No | Host prefix for routing |
CHROME_BIN |
Docker | Path to Chromium (set in Dockerfile) |
The Dockerfile installs Chromium:
RUN apt-get update && apt-get install -y chromium chromium-sandbox
ENV CHROME_BIN=/usr/bin/chromium
theskyscape.com/repo/skykit - Web framework (local via replace)github.com/chromedp/chromedp - Headless Chrome automationupdating claude file
Screenshotting service for The Skyscape