Aibar SRL App is split into two independent deployable units: the FastAPI backend (targeting Render) and the Angular 22 frontend (targeting Vercel). The backend is the authoritative source for all data and authentication; it is deployed first so that the frontend has a realDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lucavallini/aibar-frontend/llms.txt
Use this file to discover all available pages before exploring further.
apiUrl to point at. Once both services are live, the backend’s CORS configuration must be updated to allow requests from the Vercel domain, and an end-to-end smoke test confirms the full flow is working correctly.
Backend to Render
Deploy the FastAPI backend on Render
Deploy the FastAPI backend on Render
Create a new Web Service
- Log in to render.com and click New → Web Service.
- Connect your GitHub account and select the
aibar-backendrepository. - Choose the Free or Starter plan (Free is sufficient for initial testing, but note it will spin down after 15 minutes of inactivity).
- Set the Runtime to Python 3.
Set the build and start commands
In the service settings, configure:
Render injects the
| Setting | Value |
|---|---|
| Build Command | pip install -r requirements.txt |
| Start Command | uvicorn app.main:app --host 0.0.0.0 --port $PORT |
$PORT environment variable automatically — do not hard-code a port number.Configure environment variables
Under Environment → Environment Variables, add the following key/value pairs:
| Variable | Description |
|---|---|
SUPABASE_URL | Your Supabase project URL (e.g. https://xxxx.supabase.co) |
SUPABASE_SERVICE_KEY | The service role key from Supabase → Settings → API. Keep this secret — it bypasses Row Level Security. |
JWT_SECRET | A strong random string used to sign and verify JWT tokens. Generate one with openssl rand -hex 32. |
Do not use the Supabase
anon key here. The backend needs the service_role key to perform administrative database operations.Deploy and note the service URL
Click Create Web Service. Render will build the Docker-like environment, install dependencies, and start the server. Once the deploy is green, the service URL will be:Verify the backend is running by visiting
https://aibar-api.onrender.com/docs — the FastAPI auto-generated Swagger UI should load.Frontend to Vercel
Deploy the Angular frontend on Vercel
Deploy the Angular frontend on Vercel
Verify the production environment file
Before connecting to Vercel, confirm that The development file uses the local server:The
src/environments/environments.prod.ts points to the Render backend URL:angular.json for this project does not include a fileReplacements entry, so the environment file is not swapped automatically at build time. Before deploying, you must either manually copy environments.prod.ts contents into environment.ts, or add the fileReplacements block to the production configuration in angular.json as described in the Environment Configuration page.Connect the repository to Vercel
- Log in to vercel.com and click Add New → Project.
- Import the
aibar-frontendGitHub repository. - Vercel will auto-detect the framework. Override the settings as follows:
| Setting | Value |
|---|---|
| Framework Preset | Other (or Angular) |
| Build Command | ng build --configuration=production |
| Output Directory | dist/aibar-frontend/browser |
| Install Command | npm install |
Update CORS on the Backend
After the frontend is deployed to Vercel, you must add the Vercel domain to the backend’s list of allowed origins. Without this, the browser will block all API requests from the frontend with a CORS error. Openapp/main.py in the aibar-backend repository and update the allow_origins list:
If Vercel generates a different domain (e.g. a preview deployment URL), add that domain to
allow_origins as well. You can also use a wildcard like https://*.vercel.app during testing, but lock it down to the specific production domain before launch.End-to-End Verification
Once both services are live and CORS is configured, run through the full application flow on the production URLs to confirm everything is working correctly.Log in with admin credentials
Navigate to
https://aibar-frontend.vercel.app/login and log in with an administrator account. Confirm that:- The login request returns a
200 OKfromhttps://aibar-api.onrender.com/auth/login. - You are redirected to the
/viajesdashboard. - The sidebar shows all menu items, including Auditoría and Usuarios (admin-only items).
Create a driver (chofer)
Navigate to
/choferes and create a new driver using the Nuevo chofer form. Confirm that:- The POST to
/choferes/returns201 Createdwith the new driver data. - The driver appears in the list with status
disponible.
Assign a trip (viaje)
Navigate to
/viajes and create a new trip, assigning the driver and a truck. Confirm that:- The POST to
/viajes/returns201 Created. - The new trip appears in the list with status
pendiente.
Start and finalise the trip
From the trips list, start the trip and confirm the status changes to
en_curso. Then finalise it by providing an end date and kilometres travelled. Confirm that:- The status changes to
finalizado. - The driver’s status returns to
disponible.
Backend on Render
Production URL
https://aibar-api.onrender.comFastAPI + Supabase. Hosts all REST endpoints, JWT authentication, and audit logging.Frontend on Vercel
Production URL
https://aibar-frontend.vercel.appAngular 22 SPA. Served from Vercel’s CDN with automatic HTTPS and global edge distribution.