Fork it, deploy it, own it
By the end of this lesson you will have your tool at a URL you own with the key only in the host's settings, a network tab that shows no request to eodhd.com, and proof that your CI stops a leak before it reaches main.
A tool that only runs on your laptop is a script. This lesson puts yours at a URL, with the key safe, in about fifteen minutes.
Your repository, not a copy of someone else's
Fork the starter so the result is yours: your history, your commits, your ability to change anything without asking. You have been committing all along, and this is where that becomes a portfolio artefact rather than a folder.
You need a GitHub account for this (free; see Start From Zero, lesson 20, for the steps). But you have not been working in a fork: you cloned the original, so your commits sit in a copy whose origin is the public starter, which you cannot push to. Move them into your fork without losing anything:
- On the starter's GitHub page choose Fork, and create the fork under your account. Copy its address,
https://github.com/YOUR-NAME/academy-dashboard-starter.git. - In your clone, rename the old remote and add the fork as the new one:
git remote rename origin upstream, thengit remote add origin <your fork address>. - Push your work:
git push -u origin main. The first push opens a browser sign-in if you have not pushed to GitHub before.
git remote -v now shows origin as your fork and upstream as the starter, and your whole history is in the fork. (If a new fork would be empty of your commits because you started a fresh copy instead, the same three commands apply to that copy.)
The key moves, it does not travel
This is the moment people leak keys, so be deliberate.
Your .env.local is gitignored and stays on your machine. It is not uploaded, and it must not be committed as a convenience "just for deploy". On the host, the same variable is entered separately in the project's environment settings, where it is stored by the platform and injected at runtime.
Two variables, one name, two places, never in git. If you ever find yourself pasting a key into a file to make a deploy work, stop: the deploy has an environment settings page, and that is what it is for.
Deploy
With Vercel, importing the forked repository is a wizard: it detects Next.js, asks for environment variables, builds, and gives you a URL. Add EODHD_API_KEY when asked. That is the entire deployment. Before the wizard you need a Vercel account (free for personal projects; sign up at vercel.com with your GitHub account), and the wizard asks for permission to read your GitHub repositories: grant it for the fork only, not for everything. Any other host that runs Next.js and lets you set environment variables does the same job.
Then verify, in this order:
- The page loads and shows your instruments. Data flowing means the key reached the server.
- Open developer tools, network tab, and look at every request the browser made. No request should go to
eodhd.com. Everything market-related goes to your own/api/proxy/.... If you see a direct call, something in your code is fetching client-side, and your key is in that request. - Search the page source for your key. Nothing.
Step 2 is the one people skip and the only one that checks the actual promise of this whole course.
The check that is already automatic
You will change this code again, probably with an agent, probably in a hurry. So the starter does not leave this promise to your memory: .github/workflows/key-scan.yml runs on every pull request. One job scans the whole history for anything key-shaped; the other runs lint, the type check, npm test and npm run check:leak on exactly the code that would merge.
Read it rather than trusting this paragraph — and notice what it does not do. It runs on pull requests, so a commit pushed straight to main is checked only by your own hooks. That is one more reason Build a Screener makes every change a pull request.
Your hooks catch what you commit and push from your own machine. CI catches what arrives from anywhere, including a commit an agent made in the cloud, and it keeps working on the day someone skips a hook.
The network-tab check in step 2 is the one manual step left. Once the tool is deployed, ask your agent to turn it into a script, without adding a browser to the project's dependencies. Paste, with your address in place of the brackets:
Write scripts/check-deployed.mjs, a Node script with no dependencies.
Given my deployed address [your URL] as an argument, it fetches that
page and every script file the page loads from the same site, and exits
with an error naming the file if any of them contains the text
"eodhd.com/api" or "api_token". Run it against my address and show me
the output. Do not read any env file.
The script fetches the live page and every script that page loads from your own site, and fails if any of them contains an eodhd.com/api address or an api_token parameter. A request from the browser to EODHD needs that address in code the browser runs, so finding none is the same promise. Run that instead of remembering to look. It cannot see an address assembled at runtime from pieces, or a request made only after a click; if you ever write either, open the network tab once more.
Who is allowed to look at it
Your deployment has a public URL. That has two consequences worth thinking about for a minute.
Anyone with the link can spend your quota. Every visit is calls against your allowance. Turn on your host's access control (on Vercel, the project's Deployment Protection settings put a login in front of the URL), keep the URL private, or accept it deliberately.
Showing market data to other people is a different licence. EODHD's plans are, in their own words, "intended for personal use only as commercial use requires a more thorough approach to licensing and data use". A tool you use is personal use. A public page where other people read the numbers is not, and the licence page in this lesson's sources is where that conversation starts.
Try it now
The prompt
Before the wizard, let the agent check that the repository is ready. Paste:
I am about to deploy this repository to Vercel. Do not deploy anything
and do not read any env file. Run npm test, npm run typecheck,
npm run lint and npm run check:leak and, for each, tell me whether it
passed and quote its summary line.
Then list every environment variable the code reads, and say which one
the host needs, which one must never be set there, and confirm that
none is prefixed NEXT_PUBLIC_. Finally, search src/ for any request
that does not go through eodhdFetch or the proxy route, and show me
what you found.
A good answer is four passes; EODHD_API_KEY for the host, EODHD_MOCK never set there, EODHD_API_BASE_URL optional; nothing prefixed NEXT_PUBLIC_; and no direct request to eodhd.com anywhere under src/. No file changes. If a rule you wrote in Pair With Your Agent makes it stop and ask before the leak check's build, say yes: this prompt asked for the build.
Check it yourself
- Deploy, adding
EODHD_API_KEYwhen the wizard asks. The page at your URL shows your instruments and no mock-mode notice. - Open developer tools, network tab, on your phone as well as your laptop: no request goes to
eodhd.com. - Search the page source for your key: nothing.
- If you wrote the script from the prompt above, run it against your address: it exits cleanly, and when you point it at a page you know contains an
api_tokenit fails and names the file. Then open your repository's Actions tab. On a fork, GitHub keeps the workflows switched off until you enable them once; do that now, or the check below never runs.
Break it on purpose
Then do the destructive test on a branch: deliberately read the key in a "use client" file, push the branch, open a pull request, and confirm CI goes red on the leak check before anything reaches main. Your pre-push hook gets there first — it runs the same leak check and refuses the push — and that is the first net working. To test the second, make the same edit in GitHub's web editor on a new branch: a commit made in the browser never passes through your hooks, exactly like one an agent made in the cloud. Open the pull request from it, and the Checks workflow fails on npm run check:leak. Close the pull request and delete the branch. You have now tested the safety net rather than assumed it.
Compare with ours
What goes where
| Variable | On the host | Why |
|---|---|---|
EODHD_API_KEY |
set, in the project's environment settings | read on the server by eodhdKey(), never sent to the browser |
EODHD_MOCK |
never set | on the host it would serve invented numbers as if they were live |
anything NEXT_PUBLIC_ |
never | inlined into every visitor's bundle |
The full state at the end of this unit is on the starter's branch ref/build-your-first-tool/u4.
Checkpoint
Record the result next to your definition of done in PLAN.md, leaving the URL out if you keep it private. git status then lists PLAN.md, and scripts/check-deployed.mjs if you had the script written:
git status # only the files you expect, and no .env*
git add -A
git commit -m "Deployed, and the network tab shows no request to eodhd.com"
Then answer this lesson's questions.