VITE_ to be accessible in the Vite build process.
Setup
Copy the.env.example file to .env in your project root:
Required Variables
Supabase Connection
Your Supabase project URL. Format:
https://<your-project>.supabase.coThis is used in src/supabaseClient.ts:3 to initialize the Supabase client.Your Supabase anonymous (public) API key. This key is safe to use in the browser as it respects Row Level Security policies.This is used in
src/supabaseClient.ts:4 to authenticate API requests.If either
VITE_SUPABASE_URL or VITE_SUPABASE_ANON_KEY is missing, the application will throw an error on startup (see src/supabaseClient.ts:6-11).Optional Variables
Database Tables
These variables allow you to customize table names if your database schema differs from the defaults.The table that stores truck trip records, including arrival times, bay assignments, and departure times.Referenced in
src/services/supabaseService.ts:23.The table that stores incident records with start times, end times, and calculated durations.Referenced in
src/services/supabaseService.ts:24.The table that stores role configuration settings, including semaphore time thresholds for admin and client roles.Referenced in
.env.example:13.Database Views
These variables configure the names of database views used for dashboard metrics.View that returns the truck with the highest priority (longest wait time) where status ≠ ‘Finalizado’, ordered by arrival time.Returns:
tracto, hora_llegada, bahia_actual, tiempo_transcurridoReferenced in src/services/supabaseService.ts:26.View that returns the count of trucks served per shift, grouped by date.Returns:
fecha, turno_1 (07:00-15:00), turno_2 (15:01-23:00), turno_3 (23:01-06:59)Referenced in src/services/supabaseService.ts:27.View that calculates the average net time in the yard (gross time minus incident durations) for finalized trucks.Returns:
promedio_neto_patio (PostgreSQL interval as “HH:MM:SS”)Referenced in src/services/supabaseService.ts:28.Example Configuration
.env
Finding Your Supabase Credentials
- Go to your Supabase Dashboard
- Select your project
- Navigate to Settings → API
- Copy the Project URL for
VITE_SUPABASE_URL - Copy the anon public key for
VITE_SUPABASE_ANON_KEY
Next Steps
Database Setup
Configure your Supabase database schema
Bay Configuration
Customize bay positions and truck assignments
