Home >Web Front-end >JS Tutorial >I built a full-stack web archive tool running on Cloudflare
Project address: https://github.com/ray-d-song/web-archive
I have been a loyal user of ArchiveBox for a long time. ArchiveBox is a very good web archiving tool, but it requires self-hosting and has high server requirements (requires headless browser). I used a Raspberry Pi before, and the performance was not good.
And for websites like x and Medium, which require login, ArchiveBox needs to manually configure tokens or cookies, which is troublesome.
So I thought, can there be a web archiving tool that doesn't require self-hosting, doesn't require headless browser, has no requirements for server, and can be cross-platform? Then I can access my archived pages anywhere, anytime, on any device.
Cloudflare's Workers service is very powerful and free, with plenty of D1 databases and R2 storage buckets, which is very suitable for building this tool.
More importantly, Cloudflare's ecosystem is complete, supports one-click deployment and data migration. Cloudflare's global CDN service can also be used.
web-archive is composed of the following parts:
I used SingleFile's open-source code to save the page as a single html file (even including images and videos).
The server is completely based on Cloudflare's Workers service, with D1 database for storing metadata and R2 storage bucket for storing snapshots.
Although the number of interfaces is not small, I did not use ORM, actually I tried prisma and drizzle, because they caused a lot of trouble for deployment, so they were not used in the end.
The web client is built with React, Vite, TailwindCSS, and shadcn/ui, and the packaged size is astonishingly small, only 1.5MB. The packaged product will be embedded in the assets folder of the server, so it does not need to be deployed separately when deploying the server.
I really like Cloudflare's free services, but there are some limitations.
These limitations have affected the construction of the website to some extent, such as ssr or dom parsing during crawling.
However, no matter how it is said, thank you, Cloudflare!
The above is the detailed content of I built a full-stack web archive tool running on Cloudflare. For more information, please follow other related articles on the PHP Chinese website!