Running Context Engineering locally
Use this page to run the summarization challenge you extracted from the Context Engineering module. The project installs as downloaded, but two files read their OpenRouter settings in a way that only works on Scrimba, so you change those reads for Vite and add your own key before the app can answer.
What you need first
Install Node.js 24, the recommended LTS version, which includes npm. Node 22.12 or newer also works. The project runs on Vite 7, which does not support older Node versions.
Check that both commands print a version number:
$ node --version
v24.18.0
$ npm --version
11.18.0If either command says "command not found", finish installing Node before you continue. If node --version prints anything below v22.12.0, install Node 24 first, because the project's Vite version does not support it.
You also need an OpenRouter API key and a model ID that your account can use. Create a temporary key with a low spending limit: this learning project sends its provider requests from the browser, so the key travels with every request.
node --version and npm --version both print numbers. Anything from v22.12.0 up works. Then create a temporary OpenRouter key with a low spending limit, and note a model ID your account can use.
Open and install the project
Open a terminal in the extracted folder, the one that contains package.json, then install the packages exactly as the lockfile records them:
$ cd path-to-your-downloaded-project
$ npm ciWhen it finishes, a node_modules folder appears beside package.json. Keep the included package-lock.json as it is. If npm reports audit findings, do not run npm audit fix --force without checking what it changes; that command can move course dependencies across major versions.
npm ci in the extracted folder, the one with package.json in it. A node_modules folder should appear. Leave the lockfile alone: it lists the exact package versions the course was recorded against.
Repair the environment variables
On Scrimba, the project reads its key and model through process.env. In a browser project running under Vite's development server, process does not exist, so those reads have to change.
Search main.js and utils.js for these values:
process.env.OPENROUTER_KEY
process.env.MODEL_IDReplace every occurrence with:
import.meta.env.VITE_OPENROUTER_KEY
import.meta.env.VITE_MODEL_IDIf you miss one, the app later fails in the browser with process is not defined, so search both files until neither contains process.env.
Create .env beside package.json:
VITE_OPENROUTER_KEY=your-openrouter-key
VITE_MODEL_ID=a-current-model-id-from-openrouterUse a model that is currently available to your OpenRouter account and supports the calls made in the course; provider catalogs change. Vite reads .env when it starts, so restart the development server after editing the file.
Create .gitignore beside it so the key never reaches Git:
.env
node_modules/
dist/The Git handbook covers this habit in ignoring files and good habits.
The OpenRouter key is browser-visible
Every VITE_ value is included in client code. Use a temporary learning key, set a low spending limit, and do not publish this project. A deployed version must call the provider from a backend.
main.js and utils.js, replace both process.env reads with the matching import.meta.env.VITE_ names. Then create .env with your key and model ID, and add .gitignore. Use a temporary OpenRouter key here: this browser project shows the key to anyone who looks.
Run and check the project
Start the development server:
$ npm startOpen the Local URL that Vite prints, then continue the conversation until the project summarizes its earlier messages. A new summary in the running app is the visible sign that your key and model work. The page can open before any OpenRouter request succeeds, so an open page alone does not prove the setup.
Stop the server with Ctrl+C. After you change .env, start it again with npm start so Vite reads the new values.
npm start, open the Local URL Vite prints, and chat until the app summarizes its earlier messages. That summary is your proof the OpenRouter setup works. Ctrl+C stops the server when you are done.
Troubleshooting
process is not defined: At least one environment read remains in main.js or utils.js. Search both files, not only the Vite configuration.
The key remains undefined: Confirm the VITE_ spelling in .env and in the code, place .env beside package.json, and restart Vite.
The model returns 404 or an access error: Read the OpenRouter error in the browser's developer tools: a 401 points to the key, a 404 to the model ID, and a 429 to a rate limit. Copy a current model ID from OpenRouter and confirm that your account can use it.
The conversation works until it becomes long: That is the behavior this course explores. Before you look at the provider, confirm that your edits did not change the token thresholds, the summary prompts, or the sample conversation data the course ships.
process.env reads, then check the two VITE_ spellings in .env and restart. A long conversation triggering a summary is the course working, not breaking.

