Skip to content

Conversation

@Cyber-Mitch
Copy link

Description

  • What: Auto-populate referral env vars when echo-start scaffolds from an external template by reading metadata files and writing referral codes into .env.local.
  • Why: Ensures template creators receive referral credit automatically per issue Template referral system #612.
  • How: Added helpers in packages/sdk/echo-start/src/index.ts to read .echo/template.json, echo-template.json, or
    package.json and upsert a framework-appropriate referral env var alongside the app ID.

Testing

  • pnpm test:all ✅ (passes)
  • pnpm --filter echo-start lint ✅ (package-specific lint passes; repo-wide lint still fails in packages/app/control, pre-existing)
  • pnpm --filter echo-start type-check ✅ (package-specific type check passes; repo-wide type-check fails in packages/tests/provider-smoke, missing @types/node)
  • Manual ✅ echo-start run with an external template confirms referral env var is added to .env.local

This closes #611

@vercel
Copy link
Contributor

vercel bot commented Oct 29, 2025

@Cyber-Mitch is attempting to deploy a commit to the Merit Systems Team on Vercel.

A member of the Team first needs to authorize it.

@Cyber-Mitch
Copy link
Author

@rsproule I'm done now

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
@Cyber-Mitch
Copy link
Author

suggestion applied

Copy link
Contributor

@rsproule rsproule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this .echo/template.json file is a cool strategy. But we do not currently have a mechanism to hit the echo control plane authenticated from inside echo-start.

Have you explored other designs / strategies here ? Like perhaps doing this registration directly in the echo control console instead of in echo start?

If we go forward with this .echo/template.json strategy, we need to think further around how this referrer actually registers.

@Cyber-Mitch Cyber-Mitch requested a review from rsproule October 29, 2025 18:17
@Cyber-Mitch
Copy link
Author

@rsproule please review

@Cyber-Mitch
Copy link
Author

Hello @rsproule you haven't reviewed yet

@rsproule
Copy link
Contributor

rsproule commented Nov 3, 2025

Did you make any changes? I don't see answers to my questions in comments and this approach still does not actually do anything (doesn't register the referrer in echo)

@Cyber-Mitch
Copy link
Author

Did you make any changes? I don't see answers to my questions in comments and this approach still does not actually do anything (doesn't register the referrer in echo)

I'll make the changes now

@Cyber-Mitch
Copy link
Author

Cyber-Mitch commented Nov 4, 2025

@rsproule Thanks for the feedback! I've updated the approach in this PR to address the issue of actually registering the referrer without needing authentication in echo-start. Instead of extracting a referral code and writing it to .env.local (which, as you noted, doesn't integrate with Echo's control plane), I've shifted to a link-based strategy:

  • When an external template is used, we extract the GitHub repo owner (assuming it matches the Echo username/referrer).

  • I then customize the app creation link in the app ID prompt to include a ?ref= query param (e.g., https://echo.merit.systems/new?ref=someuser). This guides the user to create the app via a referral link, which should register the referrer implicitly on Echo's side during signup/app creation.

  • If the app ID is provided via CLI (for existing apps), we log a warning that referral can't be applied retroactively.

  • Removed the old .env referral logic entirely, as it wasn't functional.

@Cyber-Mitch
Copy link
Author

@rsproule Kindly review

@Cyber-Mitch
Copy link
Author

@rsproule you haven't reviewed yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

External Template support in echo-start

2 participants