The frontend is a Vite + React application. You can run it on your laptop in under a minute, or deploy it to Vercel with zero extra configuration because aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AngelAmoSanchez/TFG-RaspberryPi-BLE/llms.txt
Use this file to discover all available pages before exploring further.
vercel.json is already included in the repository.
Prerequisites
- Node.js 18+ — check with
node -v - npm — bundled with Node.js; check with
npm -v - A running instance of the BLE backend (local or deployed) so
VITE_API_URLhas somewhere to point
Local development
Clone the repository
If you haven’t already, clone the project and change into the frontend directory:
Install dependencies
package.json.Configure environment variables
Copy the example file and edit it:Open The WebSocket URL is derived automatically from
.env and set the URL of your running backend:VITE_WS_URL (or falls back to ws://localhost:8000 if the variable is absent). For local use you typically only need VITE_API_URL.All variables must start with
VITE_ to be exposed to the browser by Vite. Never store secrets in these files — they are bundled into the client-side build.Start the dev server
Production build
Set production environment variables
Update your
.env (or set the variables in your CI/CD environment) to point at the deployed backend:Build the static bundle
dist/ directory. The vercel-build script in package.json runs the same command — Vercel calls it automatically during deployment.Deploy to Vercel
The repository ships with avercel.json that handles SPA routing and backend proxying:
Import the project in Vercel
Go to vercel.com/new, import your GitHub repository, and set the Root Directory to
frontend-web.Set environment variables
In the Vercel project settings under Environment Variables, add:
These override the values in
| Variable | Example value |
|---|---|
VITE_API_URL | https://your-backend.fly.dev |
VITE_WS_URL | wss://your-backend.fly.dev |
vercel.json for each deployment environment (Production, Preview, Development).CORS configuration
For local development, the backend typically allowshttp://localhost:5173 by default. Check your backend’s CORS settings if you change the Vite port or deploy to a custom domain.
Available scripts
| Script | Command | Description |
|---|---|---|
| Dev server | npm run dev | Starts Vite at localhost:5173 with HMR |
| Production build | npm run build | Outputs static files to dist/ |
| Preview build | npm run preview | Serves dist/ at localhost:4173 |
| Run tests | npm test | Runs Vitest test suite once |
| Lint | npm run lint | ESLint across all .js and .jsx files |