Skip to main content
Dashboard Backus uses environment variables to configure the Supabase connection and database resource names. All variables must be prefixed with VITE_ to be accessible in the Vite build process.

Setup

Copy the .env.example file to .env in your project root:
cp .env.example .env
Never commit your .env file to version control. The .env.example file serves as a template only.

Required Variables

Supabase Connection

VITE_SUPABASE_URL
string
required
Your Supabase project URL. Format: https://<your-project>.supabase.coThis is used in src/supabaseClient.ts:3 to initialize the Supabase client.
VITE_SUPABASE_ANON_KEY
string
required
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.
VITE_TABLE_VIAJES
string
default:"viajes_camiones"
The table that stores truck trip records, including arrival times, bay assignments, and departure times.Referenced in src/services/supabaseService.ts:23.
VITE_TABLE_INCIDENCIAS
string
default:"incidencias"
The table that stores incident records with start times, end times, and calculated durations.Referenced in src/services/supabaseService.ts:24.
VITE_TABLE_ROLES
string
default:"configuracion_roles"
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.
VITE_VIEW_PRIORIDAD
string
default:"vista_unidad_prioridad"
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.
VITE_VIEW_TURNOS
string
default:"vista_dashboard_turnos"
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.
VITE_VIEW_PROMEDIO
string
default:"vista_promedio_patio_neto"
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
# Supabase Connection
VITE_SUPABASE_URL=https://xyzcompany.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# Tables (optional - defaults shown)
VITE_TABLE_VIAJES=viajes_camiones
VITE_TABLE_INCIDENCIAS=incidencias
VITE_TABLE_ROLES=configuracion_roles

# Views (optional - defaults shown)
VITE_VIEW_PRIORIDAD=vista_unidad_prioridad
VITE_VIEW_TURNOS=vista_dashboard_turnos
VITE_VIEW_PROMEDIO=vista_promedio_patio_neto

Finding Your Supabase Credentials

  1. Go to your Supabase Dashboard
  2. Select your project
  3. Navigate to SettingsAPI
  4. Copy the Project URL for VITE_SUPABASE_URL
  5. 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

Build docs developers (and LLMs) love