https://github.com/dtinth/personal-puppeteer
A personal web page screenshotting service. Basically, it exposes an API that I can use to generate screenshot of any URL.
https://github.com/dtinth/personal-puppeteer
jwt puppeteer typescript vercel
Last synced: 5 months ago
JSON representation
A personal web page screenshotting service. Basically, it exposes an API that I can use to generate screenshot of any URL.
- Host: GitHub
- URL: https://github.com/dtinth/personal-puppeteer
- Owner: dtinth
- Created: 2020-10-13T13:06:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-19T18:07:11.000Z (over 2 years ago)
- Last Synced: 2024-05-02T06:07:24.439Z (12 months ago)
- Topics: jwt, puppeteer, typescript, vercel
- Language: TypeScript
- Homepage: https://capture.the.spacet.me/
- Size: 216 KB
- Stars: 26
- Watchers: 2
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://vercel.com/)** and is inspired by
[Vercel’s Open Graph Image as a Service](https://github.com/vercel/og-image).
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](#adding-a-new-tenant) without
having to share secrets.→ Read the [project introduction post][intro] for more info.
[][intro]
[intro]: https://dev.to/dtinth/building-a-personal-but-multi-tenant-web-page-screenshotting-service-with-puppeteer-and-vercel-15b
## Usage
See [the website](https://capture.the.spacet.me/) for usage information.
[](https://snapit.now.sh/)
## 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](./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
```sh
yarn
yarn vercel dev
```### Docker-based development
This setup uses the recently-released [AWS Lambda Base Images](https://github.com/aws/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.
```sh
docker-compose build
docker-compose run server yarn vercel login
docker-compose up
```## Deployment
```sh
yarn
yarn vercel
```