A small React + Vite coffee shop website (Bean Scene) for practicing deployment to Vercel.
- Home — hero section and features
- Menu — espresso, cold drinks, and pastries
- About — store info, hours, contact, and a live weather widget powered by WeatherAPI.com
The About page calls /api/weather, a Vercel serverless function that uses a WeatherAPI.com key. Without the key the widget will error.
- Sign up at weatherapi.com/signup.aspx — instant, no credit card. Find your key at weatherapi.com/my.
- For local dev: copy
.env.exampleto.envand paste your key:A small Vite dev middleware incp .env.example .env npm run dev
vite.config.jsmirrors the serverless function so/api/weatherworks locally too. - For Vercel: in your project dashboard → Settings → Environment Variables, add:
- Name:
API_WEATHER_KEY - Value: your key
- Apply to: Production, Preview, Development Then redeploy.
- Name:
The key lives only on the server — it's never sent to the browser.
npm install
npm run devnpm run buildOutput goes to dist/.
- Push this repo to GitHub.
- Go to vercel.com and sign in with GitHub.
- Click Add New → Project and import this repo.
- Vercel auto-detects Vite. Keep the defaults:
- Framework Preset: Vite
- Build Command:
npm run build - Output Directory:
dist
- Click Deploy.
Every git push to main will trigger a new deployment.
npm install -g vercel
vercelFollow the prompts. Use vercel --prod for a production deployment.
vercel.jsonincludes a rewrite so React Router routes (like/menu) work on refresh.- This is a static site — no backend, no env vars needed.
- React 18 + TypeScript
- React Router 6
- Vite 5