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
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ jobs:
tools: bun@v1.3.10
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install ImageMagick
- name: Install system dependencies
run: |
sudo apt-get update && sudo apt-get install -y imagemagick
sudo apt-get update && sudo apt-get install -y imagemagick poppler-utils libnss3-tools
sudo ln -sf /usr/bin/convert /usr/local/bin/magick
sudo sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml 2>/dev/null || true
magick -version || convert -version
pdfinfo -v 2>&1 || true
certutil --version 2>&1 || true

- name: Install dependencies
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,7 @@ src/examples/*/dist/
cli/cli
cmd/facet/facet-cli.tar.gz
facet
hack/
*.png
.claude/
*.html
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,57 @@ Options:
facet pdf MyDatasheet.tsx -d data.json -o out.pdf
```

### `facet serve <template>`
### `facet serve`

Start a preview server with live editing.
Start an API server with a built-in playground for interactive template development.

```
facet serve [options]

Options:
-p, --port <number> Server port (default: 3010)
--templates-dir <dir> Directory containing templates (default: ".")
--workers <count> Number of browser workers (default: 2)
--timeout <ms> Render timeout in milliseconds (default: 60000)
--api-key <key> API key for authentication
--max-upload <bytes> Max upload size in bytes (default: 52428800)
--cache-max-size <bytes> Max render cache size in bytes (default: 104857600)
--s3-endpoint <url> S3 endpoint URL
--s3-bucket <name> S3 bucket name
--s3-region <region> S3 region (default: us-east-1)
--s3-prefix <prefix> S3 key prefix
-v, --verbose Enable verbose logging
```

**Example:**
```bash
facet serve --templates-dir ./templates --port 3010

# With authentication
facet serve --api-key my-secret-key

# With S3 upload
facet serve --s3-endpoint https://s3.amazonaws.com --s3-bucket my-bucket
```

The playground is available at `http://localhost:3010/` with a Monaco editor, live preview, and render logs.

See [openapi.yaml](openapi.yaml) for the full API specification.

### Docker

```bash
facet serve MyDatasheet.tsx -d data.json
docker run -p 3000:3000 -v ./templates:/templates ghcr.io/flanksource/facet
```

### Helm

```bash
helm install facet ./chart
```

See [chart/values.yaml](chart/values.yaml) for configuration options.

## How It Works

### Build Process
Expand Down
2 changes: 2 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ tasks:
sources:
- src/**/*.{tsx,ts,jsx,js,css,mdx}
- cli/src/**/*.{tsx,ts,jsx,js,css,mdx}
generates:
- dist/facet
cmds:
- npm run build

Expand Down
Loading
Loading