URL: https://lovable.dev/projects/REPLACE_WITH_PROJECT_ID
There are several ways of editing your application.
Use Lovable
Simply visit the Lovable Project and start prompting.
Changes made via Lovable will be committed automatically to this repo.
Use your preferred IDE
If you want to work locally using your own IDE, you can clone this repo and push changes. Pushed changes will also be reflected in Lovable.
The only requirement is having Node.js & npm installed - install with nvm
Follow these steps:
# Step 1: Clone the repository using the project's Git URL.
git clone <YOUR_GIT_URL>
# Step 2: Navigate to the project directory.
cd <YOUR_PROJECT_NAME>
# Step 3: Install the necessary dependencies.
npm i
# Step 4: Start the development server with auto-reloading and an instant preview.
npm run devEdit a file directly in GitHub
- Navigate to the desired file(s).
- Click the "Edit" button (pencil icon) at the top right of the file view.
- Make your changes and commit the changes.
Use GitHub Codespaces
- Navigate to the main page of your repository.
- Click on the "Code" button (green button) near the top right.
- Select the "Codespaces" tab.
- Click on "New codespace" to launch a new Codespace environment.
- Edit files directly within the Codespace and commit and push your changes once you're done.
This project is built with:
- Vite
- TypeScript
- React
- shadcn-ui
- Tailwind CSS
Simply open Lovable and click on Share -> Publish.
Yes, you can!
To connect a domain, navigate to Project > Settings > Domains and click Connect Domain.
Read more here: Setting up a custom domain
Supabase sends confirmation and reset emails from your Supabase project, not from this React app. If users see “check your email” but nothing arrives:
- Redirect URLs — In Supabase Dashboard → Authentication → URL Configuration:
- Set Site URL to your app origin (e.g.
http://localhost:5173or your production URL). - Under Redirect URLs, add the same origins plus
/authand/reset-passwordif needed, e.g.
http://localhost:5173/auth,https://yourdomain.com/auth
- Set Site URL to your app origin (e.g.
- Match the app — Set
VITE_AUTH_REDIRECT_URLin.envto that same origin (no trailing slash). The client uses it foremailRedirectToon sign-up and resend. - SMTP (required for reliable delivery) — In Project Settings → Authentication → SMTP Settings, enable Custom SMTP and use a provider (SendGrid, Resend, SES, Mailgun, etc.). The built-in sender is limited and often blocked or rate-limited.
- Auth logs — Authentication → Users (or Logs) to see send errors or bounce reasons.
After SMTP and URLs are correct, new registrations should receive the confirmation email (check spam as well).
More detail: docs/auth-email-setup.md.
- Run
supabase/organizations_table.sqlin the Supabase SQL editor so the Organizations page and the Unit Details → Organization dropdown use the samepublic.organizationstable. - Units load organization options from the database (
fetchOrganizationsListinsrc/lib/organizations.ts). The list refreshes when the page loads, when the browser tab becomes visible again, and after you navigate back from Organizations—so add/delete updates are picked up.
Main specialties in Units → Dimensioning and Staff → Specialties are loaded from Supabase table medical_specialties (Portuguese + English names). Stable slug values are stored in units.rt_specialty_keys, outpatient_units.rt_specialty_keys, and staff_members.specialties.
- In the Supabase SQL editor, run
supabase/medical_specialties_table.sql(creates the table, RLS read policy, and seeds all 57 specialties). - The app shows Portuguese labels when the UI language is pt-BR, and English otherwise.
- Legacy values such as
shifts.specialties.*or old outpatient labels are mapped to the new slugs when rows are loaded.
The schedules screen now supports automatic schedule generation based on staff_members data from Supabase.
Create a local .env file with:
VITE_SUPABASE_URL=YOUR_SUPABASE_URL
VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY=YOUR_SUPABASE_ANON_KEY
VITE_SCHEDULE_AI_ENDPOINT=YOUR_SUPABASE_EDGE_FUNCTION_URLExample function URL:
https://<project-ref>.functions.supabase.co/generate-schedule
This repository includes supabase/functions/generate-schedule/index.ts.
Set your OpenAI key as a Supabase function secret (server-side only):
supabase secrets set OPENAI_API_KEY=YOUR_OPENAI_API_KEY
supabase functions deploy generate-schedule- Maximum 4 consecutive hours per shift
- Uses day/night availability when available in staff data
- Respects each employee
max_weekly_hours - Prioritizes even assignment distribution across staff