Before FemeSalud can serve its first request, several pieces of infrastructure must be in place: a Supabase project with the correct tables and Row Level Security policies, a storage bucket for clinical file attachments, and environment variables wired up on both the client and server. This page covers every configuration step in order — complete them once for local development and repeat the environment variable step for each deployment environment (staging, production) in Vercel.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KevxxAlva/femesalud-zen-flow/llms.txt
Use this file to discover all available pages before exploring further.
Required Environment Variables
FemeSalud uses two separate groups of environment variables:VITE_-prefixed variables that Vite injects at build time and makes available in the browser, and non-prefixed variables that are only available to server-side code at runtime.
.env
| Variable | Side | Description |
|---|---|---|
VITE_SUPABASE_URL | Client + Server | Your Supabase project URL. Found in Project Settings → API → Project URL. |
VITE_SUPABASE_PUBLISHABLE_KEY | Client + Server | Supabase anon / public key. Found in Project Settings → API → Project API Keys. |
SUPABASE_URL | Server only | Same project URL as above, read by auth-middleware.ts at request time. |
SUPABASE_PUBLISHABLE_KEY | Server only | Same anon key as above, read by auth-middleware.ts at request time. |
VITE_SUPABASE_URL and SUPABASE_URL point to the same Supabase project — they are duplicated because Vite’s build-time injection (import.meta.env) is not available inside server functions, which instead read from process.env at runtime.Setting Variables in Vercel
For production and preview deployments, add these variables in the Vercel dashboard:- Open your project in vercel.com.
- Go to Settings → Environment Variables.
- Add all four variables listed above, selecting the appropriate environments (Production, Preview, Development).
Supabase Project Setup
1. Create a New Supabase Project
- Sign in at app.supabase.com.
- Click New project, choose your organization, enter a project name, set a strong database password, and select a region close to your users.
- Wait for the project to provision (approximately 1–2 minutes).
2. Enable Email Authentication
- In your Supabase project, go to Authentication → Providers.
- Ensure Email is enabled. For production clinics, consider disabling the “Confirm email” option only if you are managing user invitations manually.
- Under Authentication → URL Configuration, set your Site URL to your production domain (e.g.,
https://your-clinic.vercel.app).
3. Apply the Database Schema
FemeSalud requires the following tables to exist in thepublic schema. Apply the schema SQL from the project repository via the Supabase SQL Editor or the Supabase CLI:
| Table | Purpose |
|---|---|
patients | Core patient demographic and contact records |
appointments | Scheduled appointments linking patients and doctors |
consultations | Full consultation records including vitals, exam findings, diagnosis, and treatment plan |
clinical_notes | Free-form clinical notes with optional file attachments |
consultation_consumables | Consumable items used during a consultation (linked to a consultation) |
profiles | Extended user profile data linked to Supabase Auth users |
user_roles | Maps authenticated users to their admin or doctor role |
prescription_templates | Saved prescription templates for fast reuse during consultations |
lab_results | Laboratory result records linked to patients |
Supabase Storage
FemeSalud uses Supabase Storage for clinical file uploads — such as lab result PDFs and imaging attachments linked toclinical_notes records.
You must create the storage bucket manually before uploads will work:
- In your Supabase project, go to Storage → Buckets.
- Click New bucket.
- Set the bucket name to exactly:
clinical-attachments - Leave Public bucket disabled. Files should only be accessible through signed URLs generated server-side.
- Click Save.
First Admin User
After launching the app for the first time, the sign-up flow will create a Supabase Auth user — but that user will have no role and will not be able to access any protected routes until a role is assigned. To grant yourself theadmin role:
Sign Up
Navigate to your running FemeSalud instance and complete the sign-up form. Note the email address you used.
Find Your User ID
In the Supabase dashboard, go to Authentication → Users. Locate your user and copy the UUID shown in the
id column.Insert the Admin Role
Open the SQL Editor in your Supabase dashboard and run:Replace
your-user-uuid-here with the UUID you copied in the previous step.Once you have an admin account, you can invite and assign roles to additional users (doctors, assistants) directly from the FemeSalud Configuration module — no further SQL queries are needed for subsequent users.