Skip to main content
import { createFramalabClient } from "@dcmx-studio/framalab-sdk"

const client = createFramalabClient(options)

Options

baseUrl
string
required
The base URL of your Framalab panel. Trailing slashes are stripped automatically.
token
string
required
The gallery token for a specific project. Sent as X-Gallery-Token on every request. See Authentication to generate one.

Returns

A FramalabClient object with these methods:
MethodReturnsAsync
getProject()GalleryProjectYes
getPhotos()GalleryPhoto[]Yes
getCollections()GalleryCollection[]Yes
getCollection(id)GalleryCollectionDetailYes
getMediaUrl(photoId, opts?)stringNo

Singleton pattern

The client is a plain object — no connection is opened at creation time. Initialize once and reuse across your app.
lib/framalab.ts
import { createFramalabClient } from "@dcmx-studio/framalab-sdk"

export const framalab = createFramalabClient({
  baseUrl: process.env.FRAMALAB_URL!,
  token: process.env.FRAMALAB_TOKEN!,
})
app.ts
import { framalab } from "@/lib/framalab"

const photos = await framalab.getPhotos()