Our great sponsors
-
LocalStack
đź’» A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
Playwright
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
-
easylist
EasyList filter subscription (EasyList, EasyPrivacy, EasyList Cookie, Fanboy's Social/Annoyances/Notifications Blocking List)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Later you can use any S3 compatible storage because the code I write will still work, but for testing purposes on my local machine, I will use LocalStack:
The main upside is cost-effectiveness, but managing VPS is still painful which can be solved with PaaS like Heroku, Render, or similar.
Playwright seems to be a superior library for working with headless browsers than Puppeteer, but I will go with Puppeteer.
Playwright seems to be a superior library for working with headless browsers than Puppeteer, but I will go with Puppeteer.
Or you can use [https://kamal-deploy.org/] and GitHub actions for automating at least deploys, but there are still will be issues that you will need to solve.
Hono—a simple and fast framework for processing HTTP requests.
import { ScreenshotOptions } from "./schema"; import puppeteer, { Page } from "puppeteer"; import { PuppeteerBlocker } from "@cliqz/adblocker-puppeteer"; import fetch from "cross-fetch"; let blocker: PuppeteerBlocker | null = null; async function blockCookieBanners(page: Page) { if (!blocker) { blocker = await PuppeteerBlocker.fromLists(fetch, [ // the list of the cookie banners to block from the https://easylist.to/ website "https://secure.fanboy.co.nz/fanboy-cookiemonster.txt", ]); } await blocker.enableBlockingInPage(page); } export async function render( options: ScreenshotOptions ): Promise<{ url: string }> { const browser = await puppeteer.launch(); const page = await browser.newPage(); if (options.block_cookie_canners) { await blockCookieBanners(page); } await page.setViewport({ width: options.viewport_width, height: options.viewport_height, deviceScaleFactor: options.device_scale_factor, }); await page.goto(options.url); const encodedScreenshot = await page.screenshot({ type: "jpeg", encoding: "base64", fullPage: options.full_page, }); await browser.close(); return { url: `data:image/jpeg;base64,${encodedScreenshot}` }; }
Heroku and similar providers can simplify the server management issues, but you can use something much better that can combine both cost efficiency and ease of deployment—Coolify: