logo
Parslinks
Back to blog
Product6 min read

A preview for every branch: reviewing work without queueing for shared staging

Shared staging works for a team of two. From the third person on, it becomes a queue everyone waits in.

Alireza Tadi

Co-founder, Parslinks · Team, marketing & infrastructure

It's Saturday morning, the start of the working week in Iran, and three people on a small team have each finished something. Ali rewrote the cart page, Sara fixed SMS-code login, and Negar built the banner for the Yalda campaign. All three want their work on staging so the product manager can look.

Ali gets there first and takes staging. Sara has to wait. When both changes are finally merged onto staging, the product manager finds a bug in the cart and the debate starts: Ali's change or Sara's? Negar still hasn't had her turn. By noon, none of the three pieces of work is approved.

This isn't anybody's fault; it's the structure. One staging means one queue.

The difference at a glance

Shared staging compared with a separate preview per branch

A preview per branch means every time someone pushes a branch, the platform builds it separately and gives it its own URL. Every change has its own world. The product manager gets three links instead of one crowded staging.

The benefit isn't only speed:

  • Bugs have an owner. What you see on the fix/sms-otp preview belongs to that change.
  • Non-engineers can review. A designer doesn't need to know what a branch is; they open the link on their own phone.
  • Approval means something. If the same artifact goes to production, what was approved on the preview is exactly what ships.

Four things to set up from the start

1. The preview database

The first question is always: which database do previews connect to? Our firm answer: anything but production. A preview wired to the main database will, sooner or later, change customer data through an experimental migration or a cleanup script in a branch.

For most teams, one shared staging database with sample data is enough. If branches carry conflicting migrations, you can create a separate database or schema per preview, but start that when you actually need it.

2. Separate environment variables

The live payment key, the real SMS provider and customer email shouldn't reach previews. Define sandbox values for the preview environment. More on this in environment variables and secrets.

lib/sms.ts
// Previews don't send real SMS; they only log
export async function sendOtp(phone: string, code: string) {
  if (process.env.APP_ENV !== "production") {
    console.info(`[otp:preview] ${phone} → ${code}`);
    return { ok: true };
  }
  return smsProvider.send(phone, `Your login code: ${code}`);
}
ts8 lines

3. Access

Previews are unfinished versions of your product. They shouldn't be indexed by Google or end up with competitors. Two simple steps: an X-Robots-Tag: noindex header on every preview, and, if needed, restricting access to team members.

4. Cleanup

A preview whose branch has been merged or deleted should be removed automatically; otherwise, after a few months you have dozens of old versions and nobody knows which are still needed.

A suggested workflow

On Parslinks, each branch's preview is built automatically, and the rest of the routine looks like this:

  1. A developer pushes a branch; the build and preview are created automatically.
  2. Put the preview link in the pull request so everyone finds it in one place.
  3. Design and product review on that link; feedback goes in the same PR.
  4. After approval and merge, that same artifact is promoted to production.
RoleWith shared stagingWith a preview per branch
DeveloperWaits for staging to free upHas a link right after pushing
DesignerSees a mix of several changesSees only the change for their design
Product managerOne group review a dayWhenever each is ready, separately
TesterCan't tie a bug to a specific changeEvery bug belongs to one branch

What about cost?

Previews use resources, but most of them sit idle most of the time: a few visits a day, then nothing. A platform that puts idle previews to sleep and wakes them on the first request keeps their cost close to zero. Meanwhile, the hours a team spends waiting in the staging queue never show up anywhere, but they are paid for.

Frequently asked questions

Join the discussion

No comments yet. Be the first to share your thoughts.