This example runs entirely in the browser and is for illustration only. In production, never expose FRAMALAB_TOKEN client-side — fetch data server-side (SSR, SSG, or a server route) so the token stays on the server.
index.html
<!DOCTYPE html><html><body> <div id="gallery"></div> <script type="module"> import { createFramalabClient } from "@dcmx-studio/framalab-sdk" const client = createFramalabClient({ baseUrl: "https://panel.yourdomain.com", token: "your-gallery-token", // illustration only — use server-side in production }) const photos = await client.getPhotos() const gallery = document.getElementById("gallery") for (const photo of photos) { const version = photo.versions.find(v => v.versionType === "webp_medium") if (!version) continue const img = document.createElement("img") img.src = version.url img.width = version.width ?? 1200 img.height = version.height ?? 800 gallery.appendChild(img) } </script></body></html>
You should see all approved photos from your project rendered in the page.