PolicyEngine / PolicyEngine/policyengine-app-v2
feat: Add preview deployment URL auto-detection using @vercel/related-projects
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
- Install
@vercel/related-projects - Add
relatedProjectsconfig to bothvercel.jsonfiles with project IDs - Update
constants.tsto usewithRelatedProject():
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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