N Nam Hoai Dat Motech.ksmart.com.es

Artist Portfolio on Cloudflare Pages With R2 Audio Hosting

How to publish an artist site on Cloudflare Pages and stream audio from R2 without running a server, including cache rules and common upload mistakes.

🇻🇳 Đọc bài viết này bằng Tiếng Việt nguyên bản: Đọc bản Tiếng Việt →

A portfolio site should be the boring part of being an artist. Static files, a place to put audio that is not your website's own storage, and a deploy step that pushes when you change something. Cloudflare Pages and R2 fit that shape well, and neither of them asks you to run a process.

This is the setup I use for a release site, described in the order it was built.

Here is how the pieces connect, and where people usually trip.

What Pages and R2 each handle

Pages serves the site: HTML, images, fonts, the script that runs the player. R2 holds the audio, because large media files do not belong in a repository and are awkward to serve from a static host.

Keeping them separate means a text or image change never forces a re-upload of your whole catalogue, and an added track does not trigger a full site rebuild.

Preparing the audio files

Export consistent loudness across every track so a listener never reaches for the volume control between songs. Use one file format throughout and give every file a name that says what it is, including the artist and the track title.

Keep the originals elsewhere. The copy on R2 is a published copy, not your archive.

Decide before the first upload whether the site streams previews or full tracks, because that choice changes your file sizes, your page layout and your rights. Whatever you decide, apply it to every track so the player never behaves differently halfway down the list.

Wiring the build and the upload

Point Pages at the repository, and let it build on every push. Upload audio through a small script or a one-off command rather than a dashboard, so the process is repeatable six months from now when you have forgotten how you did it.

Store the audio path in one place in your code. Hard-coded paths scattered across pages are how a broken player appears after the third redesign.

Serving audio without a server

R2 gives you an endpoint you can hand to an audio element directly. Add caching headers so a returning visitor does not refetch the same file, and let range requests work so people can seek in a long track.

Because the storage sits behind a content network, listeners far from you get the same response time as listeners next door, which matters the moment the site is shared abroad.

Keeping the page fast on mobile

Lazy-load everything below the first screen, including the player's artwork. Do not autoplay: it costs bandwidth and annoys the visitor before they have decided to listen.

Test on a throttled connection. If the page is heavy on a fast laptop, it is unusable on a train.

Costs and the things people miss

Hosting a static site costs very little, and storage is charged for what you keep. The usual surprises are an oversized hero image nobody compressed, and audio kept in two formats with no plan to delete either.

Set a reminder to re-check the site after each release. Links rot quietly, and a listener who lands on a broken player rarely tells you about it.

— Nam Hoai (Nam Hoai Dat Mo)

N
Nam Hoai Dat Mo
AI & DATA ENGINEERING

AI & Data enthusiast who loves explaining complex tech in plain English. Sharing practical tool reviews, prompt guides, and digital creation workflows.