How to build a Pixieset alternative
How to build a Pixieset alternative with private galleries, PIN access, and controlled downloads. Check every image route before sharing a client delivery link.
How to build a Pixieset alternative begins with delivering one private gallery to one client. We will build Albumgate with uploads, an unlock screen, a photo grid, and individual downloads. The Pixieset catalog page has the scoped product prompt and related alternatives.
A client should open a link, enter a PIN, and find the photos. The photographer should know whether uploads finished and be able to revoke access. We will leave print sales, contracts, portfolio pages, and a studio CRM outside this build. The DocSend post explains a related private-link boundary.
How to build a Pixieset alternative with private originals
Use Astro server endpoints and D1 for metadata. Keep image objects in a private R2 bucket. HTMX can refresh upload status and Alpine can manage the selected photo preview. Let the server decide whether a client may read a photo before issuing a short-lived file response or signed delivery URL.
Use authenticated owner sessions for administration. Client access uses a separate gallery-scoped session after the PIN check. A client session must never acquire owner privileges. A gallery id helps locate the record; knowing that id is not permission to read the original image.
Step 1 Model the gallery and its access version
Create Gallery, Photo, and ClientAccess records. A gallery belongs to an owner and has a title, status, PIN hash, access version, and optional expiry. A photo belongs to a gallery and stores random object keys, file metadata, an upload state, and an ordering value. Keep original filenames as display metadata only.
A client session records the gallery id and access version it unlocked. Changing the PIN increments the version. Every subsequent image request checks the current version, making earlier sessions unusable. Expiry and revocation should be checked server-side even if an already-open page still shows thumbnails.
Create Albumgate with Gallery, Photo, and ClientAccess migrations. Store
PINs using a maintained password-hashing implementation. Use random ids
and object keys. Client sessions are gallery-scoped and contain an access
version. Every gallery, thumbnail, and original read checks gallery status,
expiry, and access version. Owner routes require owner authentication.
Create two galleries and unlock only one. Try swapping gallery ids in a photo request. Test a wrong PIN and a missing gallery. Use a generic failure message where appropriate and rate-limit guesses across meaningful server-side keys. A short PIN needs online guessing controls even when its hash is stored correctly.
Step 2 Upload into a pending state
An upload begins as pending metadata with a server-selected object key. Bound the file size and accepted formats. Validate the actual bytes with an image decoder; the extension and browser MIME type are hints supplied by the uploader. Reject unsupported data before marking the record ready.
Generate a display derivative and thumbnail after decoding. Keep processing separate from the gallery list request. For v1, use a worker or service suited to your selected image library and platform limits. Large originals can exceed request memory or execution limits, so decide a realistic supported size and reject larger inputs clearly.
Add owner-only image upload with configured byte and pixel limits. Create
pending metadata, store the object privately, decode and validate it, then
produce bounded derivatives. Mark ready only after required objects exist.
Keep failed records retryable or removable. Never render unvalidated bytes
as a ready photo. Do not use the original filename as an object path.
Interrupt an upload midway and reload the owner screen. It should show Pending or Failed, rather than a broken ready image. Retry the same upload token and ensure one photo record survives. Test a renamed text file, an oversized image, and two originals with identical filenames.
Step 3 Build the gallery unlock and grid
The public gallery landing page can show the title and a PIN form. Decide whether even the title is sensitive. Keep photo counts and preview images behind access unless you intentionally want to disclose them. After successful unlock, rotate the session identifier and use a secure cookie with a suitable expiry.
Render photos only from ready records. A gallery with pending uploads can show a neutral processing message to its owner while clients see only available photos. When no photo is ready, show a useful empty message rather than rendering twenty broken image placeholders.
Build the gallery unlock form and client grid. Validate the PIN on the
server, rotate the session, and use a secure HttpOnly cookie. Load only
ready photos after the gallery access check. Use bounded thumbnails in the
grid and a larger derivative in the preview. Include keyboard navigation,
meaningful image labels, and a clear expired-access screen.
Open the gallery in a new private session. Copy a thumbnail URL into another session and check its behavior. If using signed URLs, remember that a valid URL may remain usable until its short expiry. Make that interval part of the access policy. Proxying every request allows a fresh authorization decision but has different bandwidth and caching costs.
Step 4 Separate preview from original download
A preview may have a different resolution and metadata policy from an original. Generate it from decoded pixels and remove unnecessary embedded metadata. Decide explicitly whether clients should receive untouched originals, which may contain location or camera metadata. Show the download format clearly.
Use a download endpoint that checks the photo belongs to the unlocked gallery. Set an appropriate content type and attachment filename. Sanitize the display filename and supply a safe fallback. Guessing an object key should never bypass the gallery access check.
| Request | Required permission | Returned data |
|---|---|---|
| Owner upload | Owner session | Pending photo id |
| Client grid | Gallery session | Ready photo metadata |
| Thumbnail | Gallery access or valid short URL | Small derivative |
| Download | Gallery session | Authorized original |
Add original download behind a fresh gallery access check. Resolve the
object key from an authorized photo row rather than a browser-supplied
storage path. Return a safe attachment filename. Document metadata policy
for previews and originals. Keep client-visible responses private in caches
and prevent shared caching from crossing gallery sessions.
Download a photo after unlocking, then revoke the gallery and repeat the request. Also test a request for a photo in another gallery. Confirm that object-storage error pages do not disclose credentials or internal bucket configuration. Preserve a useful client message when a referenced file is unexpectedly missing.
Step 5 Add favorites after delivery works
Favorites are a later layer on the same gallery session. Use a unique pair of client-access id and photo id. A toggle should be idempotent, or expose explicit favorite and unfavorite operations. Repeated taps over a slow connection should not create duplicate rows.
The photographer’s view can show a count and a filtered set. Do not imply that a favorite means final approval. If you need approval, model it as a separate action with a confirmation. Couples or teams sharing one PIN also share whatever identity policy you choose; explain that before treating favorites as individual decisions.
Add explicit favorite and unfavorite endpoints scoped to the current
client gallery session. Enforce uniqueness in the database. Show the
photographer a filtered favorites view. Keep favorite state separate from
approval and download state. Handle a photo removed between page load
and the favorite request without crashing or recreating its row.
Open the same gallery in two tabs and favorite the same photo. Reload both and confirm one relationship exists. Then remove the photo as the owner and retry the stale client action. Return a clear unavailable result. A stale browser should not resurrect deleted delivery material.
Step 6 Handle removal and storage cleanup
Hide a removed photo immediately through metadata. Queue object deletion separately and make the cleanup retryable. Keep a short record of the cleanup job until required keys have been removed. Otherwise an object-store timeout can leave private originals orphaned forever.
A gallery deletion should name the gallery and explain whether originals will be removed. For the first release, an archive action can revoke client access while preserving the owner’s files. Actual deletion needs a recovery policy you understand before it becomes a routine button.
Leave ZIP generation until individual downloads work reliably. A large ZIP needs a bounded background job, an immutable selection of photo ids, progress reporting, and an expiry for the generated archive. The file transfer guide covers a neighboring delivery flow. Use the Cloudinary guide when image transformation itself is the feature you want to build.
Before sharing the first gallery, test unlock, preview, download, expiry, and revocation with disposable images. Keep real client material out until those boundaries behave as described.
Deploy the private application
Keep production credentials in the deployment platform’s secret store. Use separate databases for local development, preview, and production. An agent should never point destructive seed commands at the production binding. Ask it to print the selected environment name before a migration, without printing secret values.
Commit versioned migrations alongside the application. Rehearse applying them to a copy of the database before release. After building, check that the production schema has the required columns. Document the migration and deployment order in the README so a later update follows the same path.
For a Cloudflare deployment, use the official Astro adapter and current platform documentation for the installed versions. Deploy the server application to Workers, bind D1 explicitly, and keep public static assets separate from private data. Check the generated deployment configuration rather than copying an old command from a different Astro project.
Open the deployed application in a fresh browser session. Sign in, create one record, reload, and confirm it survived. Sign out and try its private URL. Repeat the core edit from another tab and verify the conflict behavior. Also open an unavailable route and confirm that it produces an understandable missing-page response.
Make a backup you can restore
Export the database before changing its schema. Keep the export outside the live application’s storage. Restore it into an isolated database and check record counts, ownership, and a few meaningful relationships. A file named backup is useful only after you have read the restored records through the application.
Write down the restore command, required bindings, and the release revision that matches the schema. If the application stores private files, include their object keys and a separate recovery plan. Database recovery cannot recreate a deleted original file.
Keep logs small and useful. Record request ids, route names, error categories, and revision ids. Leave passwords, access tokens, private bodies, and complete exports out. When a request fails, show the user a retry path and a request id they can match to the server log.