SmartLearn is an online learning platform designed to make digital education accessible, interactive, and engaging for everyone.
This repository contains the front-end application built with React + Vite. Below are concise, corrected instructions to run and build the project locally.
- View app at : http://localhost:3002/
charzlwebz256@gmail to get login credentials
- Node.js 18+ (recommended)
- npm (bundled with Node) or preferred package manager
-
Install dependencies
npm install
-
Create a
.env.localfile in the project root and add your Gemini API key. The project expects an environment variable namedGEMINI_API_KEY(the Vite config maps this into the app):# .env.local (example) GEMINI_API_KEY=your_gemini_api_key_hereAfter changing environment variables, restart the dev server so Vite picks up the new values.
-
Start the development server
npm run dev
-
Build for production
npm run build
-
Preview the production build locally
npm run preview
- The Vite config (
vite.config.ts) loads environment variables usingloadEnvand exposesGEMINI_API_KEYto the client asprocess.env.API_KEYandprocess.env.GEMINI_API_KEY. - Several components (for example, the AI assistant) read
process.env.API_KEYin the browser bundle; ensureGEMINI_API_KEYis set prior to starting the dev server.
- If the AI assistant fails to connect or returns errors, confirm:
- You added
GEMINI_API_KEYto.env.local(not.envonly) and restarted the dev server. - The key is valid and has network access.
- You added
- If you see stale env values, stop the dev server and restart it after editing
.env.local. - If you run into TypeScript or build issues, ensure your Node.js version matches the project's requirements and that you have the required devDependencies installed.
npm.cmd run dev— start Vite dev serverc npm run build— build production assetsnpm run preview— locally preview the production build
- Feel free to open issues or PRs. Keep changes focused and include a short description of what was changed and why.
If you'd like, I can also add a small example .env.example file to the repo, or update any other docs/pages that currently show the wrong env variable.
