A simple service that calculates and generates a small SVG badge that displays the size of any webpage in kilobytes, aiming to bring transparency to web development and encourage mindful data usage.
The goal of this project is to encourage transparency in web development and promote conscious data usage. By reducing the digital footprint, we not only offer a smoother user experience but also take care of our planet 🌎.
Some lightweight things that are awesome:
- 🪶 Feathers
- 💭 Bubbles
- ☁️ Fluffy clouds
- ❄️ Crisp snowflakes
- 🚀 Super-fast websites
- Input a URL
- Click 'Generate'
- Embed the badge using HTML or Markdown code
- Badges auto-update every 30 days
- Manually recheck anytime
- Page sizes are cached to minimise requests and conserve data
- This project is a work in progress. Some sites may present issues.
An version which calculates page sizes and generates badges but consumes more resources.
A simpler, lightweight version that exposes a single endpoint for generating SVG badges based on user input.
- Language: TypeScript
- Server: bun.sh with express
- Client: Preact.js
- Database: Postgres with Supabase
- Deployment: Fly.io for server and Netlify for client
-
Clone the repository.
-
cd client
&&yarn install
orbun upgrade
-
cd server
&&bun upgrade
-
Create
.env
inside/server
and set up your environment variables:PORT=8080 HOST=0.0.0.0 SUPABASE_URL=www.example.com SUPABASE_ANON_KEY=123456 SUPABASE_KEY=123456
-
For the server, run:
bun run dev
-
For the client, run:
yarn run dev
orbun run dev
create table
public.urls (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
url character varying not null default ''::character varying,
size bigint null,
"updated_At" timestamp with time zone not null default now(),
constraint urls_pkey primary key (id),
constraint urls_url_key unique (url)
) tablespace pg_default;