PolicyEngine / PolicyEngine/policyengine-app-v2

feat: Add preview deployment URL auto-detection using @vercel/related-projects

Open
#565 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
1
Forks
3
Avg merge
1d 50m
Merged PRs (30d)
39

Description

Summary

When viewing preview deployments, cross-app navigation links (from calculator to website and vice versa) incorrectly go to production URLs instead of the corresponding preview deployment.

Current behavior

Environment Cross-app linking
Dev ✅ Works (localhost URLs via env vars)
Preview ❌ Falls back to prod URLs
Production ✅ Works

Proposed solution

Use Vercel's @vercel/related-projects package to automatically sync preview deployment URLs between the website and calculator projects.

Changes required
  1. Install @vercel/related-projects
  2. Add relatedProjects config to both vercel.json files with project IDs
  3. Update constants.ts to use withRelatedProject():
import { withRelatedProject } from '@vercel/related-projects';

export const WEBSITE_URL = withRelatedProject({
  projectName: 'policyengine-website',
  defaultHost: import.meta.env.VITE_WEBSITE_URL || 'https://policyengine.org',
});
Limitations
  • Max 3 related projects can be linked
  • Only works for projects in same repository
  • CLI deployments not supported

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading constants.ts and both vercel.json files, then review how the current environment URLs are selected. Install @vercel/related-projects and configure the two projects as described. Done means preview deployments link to the corresponding preview app while development and production URLs continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cloud, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.