/personal-puppeteer

A personal web page screenshotting service. Basically, it exposes an API that I can use to generate screenshot of any URL.

Primary LanguageTypeScript

personal-puppeteer

This is a personal web page screenshotting service. Basically, it exposes an API that I can use to generate screenshot of any URL. By personal I mean that only I can use it. It is secured with JWT. But it is open source, and you can run your own instance.

It is deployed to Vercel and is inspired by Vercel’s Open Graph Image as a Service. The main difference is that this service is designed to be reusable across many use cases. It can capture arbitrary URLs and run arbitrary code. It is multi-tenant. I can reuse this service without having to share secrets.

→ Read the project introduction post for more info.

Usage

See the website for usage information.

Adding a new tenant

Note: Do not send pull requests to this repository to add a new tenant. Instead, please deploy personal-puppeteer to your own account.

  1. Generate an RS256 keypair for JWT signing.

  2. Edit api/auth.ts and add a new entry to the allowList.

  3. Within less than a minute Vercel will deploy the changes allowing the new tenant to use the API right away.

Development

yarn
yarn vercel dev

Docker-based development

This setup uses the recently-released AWS Lambda Base Images to get a development environment as closest to the actual serverless function when run in Vercel as possible. This allows you to locally test, e.g. how fonts are rendered.

docker-compose build
docker-compose run server yarn vercel login
docker-compose up

Deployment

yarn
yarn vercel