Xây dựng website đặt lịch bằng Claude Code

Tạo một website đặt lịch hiện đại bằng Claude Code và làm cho nó hoạt động đầy đủ để nhận lịch đặt thật từ người dùng.

Lộ trình & tài nguyên

Chọn lĩnh vực đặt lịch của bạn

Chọn loại dự án

Chọn một loại website đặt lịch

Website đặt lịch phòng khám nha khoa

Website đặt lịch salon tóc

Website đặt lịch tiệm cắt tóc nam

Website đặt lịch spa

Website đặt lịch huấn luyện viên cá nhân

Website đặt lịch coaching

Website đặt bàn nhà hàng

Website đặt lịch thẩm mỹ viện

Website đặt lịch trị liệu massage

Website đặt lịch tiệm nail

Website đặt lịch chụp ảnh

Website đặt lịch chăm sóc thú cưng

Website đặt lịch studio yoga

Website đặt lịch studio xăm hình

Website đặt lịch lớp khiêu vũ

Website đặt lịch lớp thể dục

Website đặt lịch trị liệu tâm lý & tham vấn

Website đặt lịch trị liệu thần kinh cột sống

Website đặt lịch vật lý trị liệu

Website đặt lịch chăm sóc xe hơi

Website đặt lịch sửa chữa ô tô

Website đặt lịch dịch vụ dọn dẹp

Website đặt lịch sửa chữa nhà cửa

Website đặt lịch chăm sóc sân vườn

Website đặt lịch tổ chức sự kiện

Website đặt lịch tổ chức tiệc cưới

Website đặt lịch chuyên viên trang điểm

Website đặt lịch chuyên viên chăm sóc da

Website đặt lịch gia sư riêng

Website đặt lịch trường dạy lái xe

Website đặt lịch xem nhà

Website đặt lịch môi giới bất động sản

Xem trước luồng đặt lịch

- Chọn dịch vụ

- Chọn ngày

- Chọn giờ

- Xác nhận đặt lịch

Thông tin khách hàng đã thu thập

- Họ và tên

- Email

- Số điện thoại

- Ghi chú tùy chọn

Thiết lập backend

Tạo một dự án Supabase

Tạo một dự án Supabase mới cho backend của hệ thống đặt lịch của bạn.

Mở Supabase

https://supabase.com/?utm_source=partner&utm_medium=social&utm_campaign=supasquad&dub_id=dfcthVHW4UOcyzr2

Tạo tài khoản quản trị

Tạo một tài khoản quản trị trong Supabase Authentication, sau đó sao chép ID người dùng.

Chạy toàn bộ SQL thiết lập

Dán ID người dùng quản trị của bạn, sau đó chạy đoạn mã SQL này trong Supabase SQL Editor. Nó sẽ thiết lập mọi thứ cùng lúc: bảng, policy bảo mật và quyền truy cập quản trị.

SQL thiết lập đầy đủ

create table services ( id uuid primary key default gen_random_uuid(), name text not null, description text, duration_minutes integer not null check (duration_minutes > 0), price numeric(10,2), is_active boolean not null default true, created_at timestamp with time zone default now() ); create table appointments ( id uuid primary key default gen_random_uuid(), full_name text not null, email text not null, phone text not null, service_id uuid not null references services(id) on delete restrict, appointment_date date not null, start_time time not null, end_time time not null, status text not null default 'pending' check (status in ('pending', 'confirmed', 'cancelled', 'completed')), notes text, created_at timestamp with time zone default now() ); create table business_hours ( id uuid primary key default gen_random_uuid(), weekday integer not null check (weekday between 0 and 6), is_open boolean not null default true, start_time time, end_time time ); create table blocked_dates ( id uuid primary key default gen_random_uuid(), blocked_date date not null unique, reason text, created_at timestamp with time zone default now() ); create table clinic_settings ( id uuid primary key default gen_random_uuid(), clinic_name text not null default 'Bright Smile Dental Clinic', clinic_email text, clinic_phone text, clinic_address text, slot_interval_minutes integer not null default 30, booking_notice_hours integer not null default 2, created_at timestamp with time zone default now() ); create table admin_users ( id uuid primary key default gen_random_uuid(), user_id uuid not null unique references auth.users(id) on delete cascade, created_at timestamp with time zone default now() ); insert into services (name, description, duration_minutes, price) values ('Dental Checkup', 'General dental examination and consultation.', 30, 40), ('Teeth Cleaning', 'Professional cleaning session.', 45, 60), ('Teeth Whitening', 'Cosmetic whitening session.', 60, 120), ('Tooth Filling', 'Basic tooth filling procedure.', 60, 90); insert into business_hours (weekday, is_open, start_time, end_time) values (0, false, null, null), (1, true, '09:00', '17:00'), (2, true, '09:00', '17:00'), (3, true, '09:00', '17:00'), (4, true, '09:00', '17:00'), (5, true, '09:00', '17:00'), (6, true, '09:00', '13:00'); insert into clinic_settings (clinic_name, clinic_email, clinic_phone, clinic_address, slot_interval_minutes, booking_notice_hours) values ('Bright Smile Dental Clinic', 'hello@brightsmile.com', '+1 555 123 4567', '123 Main Street, New York, NY', 30, 2); alter table admin_users enable row level security; alter table services enable row level security; alter table appointments enable row level security; alter table business_hours enable row level security; alter table blocked_dates enable row level security; alter table clinic_settings enable row level security; create policy "Anyone can read active services" on services for select to anon, authenticated using (is_active = true); create policy "Admins can manage services" on services for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can create appointments" on appointments for insert to anon, authenticated with check (true); create policy "Admins can read appointments" on appointments for select to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Admins can update appointments" on appointments for update to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can read business hours" on business_hours for select to anon, authenticated using (true); create policy "Admins can manage business hours" on business_hours for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can read blocked dates" on blocked_dates for select to anon, authenticated using (true); create policy "Admins can manage blocked dates" on blocked_dates for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can read clinic settings" on clinic_settings for select to anon, authenticated using (true); create policy "Admins can manage clinic settings" on clinic_settings for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Users can read their own admin row" on admin_users for select to authenticated using (auth.uid() = user_id); insert into admin_users (user_id) values ('PASTE_YOUR_AUTH_USER_ID_HERE');

ID người dùng quản trị

Nhập ID người dùng auth trong Supabase của bạn

Thiết lập SQL từng bước (tùy chọn)

Tạo các bảng cơ sở dữ liệu

Chạy các câu truy vấn SQL này bên trong Supabase SQL Editor.

Bảng dịch vụ

create table services ( id uuid primary key default gen_random_uuid(), name text not null, description text, duration_minutes integer not null check (duration_minutes > 0), price numeric(10,2), is_active boolean not null default true, created_at timestamp with time zone default now() );

Bảng lịch hẹn

create table appointments ( id uuid primary key default gen_random_uuid(), full_name text not null, email text not null, phone text not null, service_id uuid not null references services(id) on delete restrict, appointment_date date not null, start_time time not null, end_time time not null, status text not null default 'pending' check (status in ('pending', 'confirmed', 'cancelled', 'completed')), notes text, created_at timestamp with time zone default now() );

Bảng giờ làm việc

create table business_hours ( id uuid primary key default gen_random_uuid(), weekday integer not null check (weekday between 0 and 6), is_open boolean not null default true, start_time time, end_time time );

Bảng ngày bị khóa

create table blocked_dates ( id uuid primary key default gen_random_uuid(), blocked_date date not null unique, reason text, created_at timestamp with time zone default now() );

Bảng thiết lập phòng khám

create table clinic_settings ( id uuid primary key default gen_random_uuid(), clinic_name text not null default 'Bright Smile Dental Clinic', clinic_email text, clinic_phone text, clinic_address text, slot_interval_minutes integer not null default 30, booking_notice_hours integer not null default 2, created_at timestamp with time zone default now() );

Thêm dữ liệu khởi tạo

Chạy các câu truy vấn khởi đầu này.

Chèn các dịch vụ khởi đầu

insert into services (name, description, duration_minutes, price) values ('Dental Checkup', 'General dental examination and consultation.', 30, 40), ('Teeth Cleaning', 'Professional cleaning session.', 45, 60), ('Teeth Whitening', 'Cosmetic whitening session.', 60, 120), ('Tooth Filling', 'Basic tooth filling procedure.', 60, 90);

Chèn giờ làm việc

insert into business_hours (weekday, is_open, start_time, end_time) values (0, false, null, null), (1, true, '09:00', '17:00'), (2, true, '09:00', '17:00'), (3, true, '09:00', '17:00'), (4, true, '09:00', '17:00'), (5, true, '09:00', '17:00'), (6, true, '09:00', '13:00');

Chèn thiết lập phòng khám

insert into clinic_settings (clinic_name, clinic_email, clinic_phone, clinic_address, slot_interval_minutes, booking_notice_hours) values ('Bright Smile Dental Clinic', 'hello@brightsmile.com', '+1 555 123 4567', '123 Main Street, New York, NY', 30, 2);

Bảo vệ bảng điều khiển quản trị

1. Tạo bảng phân quyền quản trị Tạo một bảng xác định những người dùng đã đăng nhập nào được phép truy cập và quản lý bảng điều khiển quản trị.

Bảng người dùng quản trị

create table admin_users ( id uuid primary key default gen_random_uuid(), user_id uuid not null unique references auth.users(id) on delete cascade, created_at timestamp with time zone default now() );

2. Bật Row Level Security Bật RLS trên các bảng cần được bảo vệ khỏi người dùng thông thường.

Bật RLS

alter table admin_users enable row level security; alter table services enable row level security; alter table appointments enable row level security; alter table business_hours enable row level security; alter table blocked_dates enable row level security; alter table clinic_settings enable row level security;

3. Thêm các policy cho quản trị viên Cho phép người dùng công khai chỉ đọc những dữ liệu mà website đặt lịch cần, và chỉ cho phép quản trị viên quản lý dữ liệu được bảo vệ.

Policy cho quản trị viên

create policy "Anyone can read active services" on services for select to anon, authenticated using (is_active = true); create policy "Admins can manage services" on services for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can create appointments" on appointments for insert to anon, authenticated with check (true); create policy "Admins can read appointments" on appointments for select to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Admins can update appointments" on appointments for update to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can read business hours" on business_hours for select to anon, authenticated using (true); create policy "Admins can manage business hours" on business_hours for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can read blocked dates" on blocked_dates for select to anon, authenticated using (true); create policy "Admins can manage blocked dates" on blocked_dates for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Anyone can read clinic settings" on clinic_settings for select to anon, authenticated using (true); create policy "Admins can manage clinic settings" on clinic_settings for all to authenticated using ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ) with check ( exists ( select 1 from admin_users where admin_users.user_id = auth.uid() ) ); create policy "Users can read their own admin row" on admin_users for select to authenticated using (auth.uid() = user_id);

4. Thêm tài khoản quản trị của bạn Tạo tài khoản quản trị của bạn từ màn hình đăng nhập của ứng dụng trước, sau đó chèn ID người dùng đã xác thực của bạn vào bảng admin_users.

Chèn tài khoản quản trị của bạn

insert into admin_users (user_id) values ('PASTE_YOUR_AUTH_USER_ID_HERE');

Tạo website bằng Claude Code

Dùng Prompt 1 để xây dựng dự án

Prompt 1 : Xây dựng toàn bộ dự án nha khoa

Xây dựng website phòng khám nha khoa hiện đại, cao cấp với hệ thống đặt lịch thật...

Build a premium modern dental clinic website with a real booking system and a secure admin dashboard. Tech stack: - React - TypeScript - Vite - Supabase (database + backend + auth) ================================================ SUPABASE CONNECTION (REQUIRED) ================================================ Create a .env.local file in your project root with your Supabase credentials: VITE_SUPABASE_URL=PASTE_YOUR_SUPABASE_URL_HERE VITE_SUPABASE_ANON_KEY=PASTE_YOUR_PUBLISHABLE_KEY_HERE Important rules: - Use these values as environment variables - Do NOT hardcode them directly inside components - Create a Supabase client in: src/lib/supabase.ts - Use: import.meta.env.VITE_SUPABASE_URL import.meta.env.VITE_SUPABASE_ANON_KEY ================================================ DATABASE SCHEMA (STRICT CONTRACT) ================================================ Use this EXACT schema. Do NOT rename or invent fields. Table: services - id - name - description - duration_minutes - price - is_active - created_at Table: appointments - id - full_name - email - phone - service_id - appointment_date - start_time - end_time - status - notes - created_at Table: business_hours - id - weekday - is_open - start_time - end_time Table: blocked_dates - id - blocked_date - reason - created_at Table: clinic_settings - id - clinic_name - clinic_email - clinic_phone - clinic_address - slot_interval_minutes - booking_notice_hours - created_at ================================================ CRITICAL RULES (DO NOT BREAK) ================================================ Do NOT use: - day_of_week - open_time / close_time - date (for blocked_dates) - customer_name / customer_email / customer_phone Only use the exact schema above. ================================================ PROJECT GOAL ================================================ Create a real dental clinic website where users can: - select a service - select a date - select an available time - submit an appointment request And an admin can: - manage appointments - manage services - manage business hours - manage blocked dates - manage clinic settings ================================================ MAIN DESIGN GOAL ================================================ The website should feel like: - a premium dental clinic - a modern healthcare brand - trustworthy - clean - calm - refined - high-end but still medical and believable The dashboard should feel like: - a premium internal healthcare admin system - modern - structured - minimal - product-like - polished IMPORTANT: Do NOT make this look like: - a fashion website - a boutique luxury brand - an editorial magazine - a perfume or jewelry brand - a spa or lifestyle site Avoid: - overly dramatic serif-heavy design - overly artistic editorial layouts - styling that does not feel medical - generic AI landing page patterns - weak spacing and flat template-looking sections ================================================ PREMIUM VISUAL DIRECTION ================================================ Use a premium healthcare design system with: - soft off-white / warm neutral backgrounds - deep teal / muted medical green / refined blue-green accents - dark charcoal text - soft gray supporting tones - subtle premium shadows - refined borders - spacious layouts - elegant but restrained typography - polished card design - strong visual hierarchy Typography: - use a clean modern sans-serif as the main font across the project - you may use a subtle refined serif only in very limited hero or section headings if it still feels premium medical, not editorial - dashboard should use sans-serif only - prioritize readability, clarity, and trust ================================================ PUBLIC WEBSITE ================================================ Create: - Homepage - Services section - About section - Booking flow - Success confirmation screen - Footer The public site should feel like a real premium clinic website, not a generic template. ================================================ PUBLIC WEBSITE — SECTION EXPECTATIONS ================================================ 1. NAVBAR - clean premium layout - strong brand presence - simple refined navigation - premium CTA button 2. HERO - strong premium first impression - high-quality layout balance between text and image - trustworthy dental clinic feeling - elegant but clear hierarchy - modern medical brand tone - no exaggerated artistic styling 3. SERVICES SECTION This section must be visually stronger than simple text-only cards. Requirements: - each service card should include a meaningful visual element - use a clean image area, premium medical visual treatment, or service-related imagery - keep visuals consistent, elegant, and medically appropriate - do not use random messy stock photos - make service cards feel premium, informative, and visually engaging Service cards should clearly present: - service name - short description - duration - price - CTA / booking affordance 4. ABOUT SECTION - should feel intentional and trustworthy - use better image composition - avoid awkward empty layouts - reinforce clinic credibility, calmness, and quality 5. BOOKING SECTION / FLOW The booking experience is a very important part of this project and should feel premium from the start. It should feel: - organized - polished - easy to understand - trustworthy - calm - productized 6. FOOTER - clean layout - strong hierarchy - premium final impression - consistent with the rest of the brand ================================================ BOOKING FLOW (IMPORTANT) ================================================ Step 1: - Select a service Step 2: - Select date - Show available times (based on real logic) Step 3: - Enter: - full name - email - phone - optional notes Step 4: - Success screen with summary ================================================ BOOKING UX REQUIREMENTS ================================================ From the first version, make the booking UI feel polished and premium. Improve: - step indicator - date selection layout - time slot layout - selected states - CTA hierarchy - details form grouping - appointment summary block - success state The booking flow should feel like a real premium reservation product, not just a simple form inside a page. ================================================ AVAILABILITY LOGIC (VERY IMPORTANT) ================================================ Available slots must be generated using: - business_hours - services.duration_minutes - clinic_settings.slot_interval_minutes - clinic_settings.booking_notice_hours - blocked_dates - existing appointments Rules: - Only generate slots inside working hours - Skip blocked dates - Skip overlapping appointments - Ignore cancelled appointments - Respect booking notice time Overlap rule: new_start < existing_end AND new_end > existing_start Slot structure (IMPORTANT): All available slots must be normalized as: { start: Date, end: Date, label: string } ================================================ TIME SAFETY RULES (PREVENT CRASHES) ================================================ - Only format REAL Date objects - NEVER pass invalid strings to format() - NEVER use strings like "yyyy-MM-ddT10:30:00" - Always combine real selected date + time correctly ================================================ ADMIN AUTH + DASHBOARD SECURITY ================================================ Build a real admin authentication flow using Supabase Auth. Requirements: - create a dedicated admin login screen - protect all admin dashboard routes - unauthenticated users must never access admin pages - non-admin users must never access admin features - redirect unauthenticated users to the admin login page - keep the public website fully accessible without login Admin access rules: - only authenticated admin users can access the dashboard - admin users should have full control over: - appointments - services - business hours - blocked dates - clinic settings Security expectations: - use Supabase Auth for sign in - connect the dashboard to the authenticated admin session - do not rely on hiding buttons only - implement real route protection for admin pages - structure the code so admin access is clear and maintainable ================================================ ADMIN DASHBOARD ================================================ Create a full premium dashboard with: 1. Overview 2. Appointments (list + filter + status update) 3. Services (CRUD) 4. Business Hours editor 5. Blocked Dates manager 6. Clinic Settings form Dashboard design requirements: - modern healthcare admin aesthetic - clean sans-serif typography - structured layout - readable tables - refined filters and controls - polished status badges - no generic admin template feeling Important: - New services must appear in booking page automatically ================================================ OUTPUT ================================================ - Full working app - Clean structure - Supabase fully connected - Booking flow working - Admin login working - Protected dashboard working - Dashboard working - No placeholder fake data - Production-style code - Premium dental / medical visual direction from the start

Thêm các biến môi trường Supabase

Thêm Project URL và Publishable Key của Supabase vào tệp .env.local để kiểm thử trên máy.

Cải thiện hoặc sửa lỗi dự án (tùy chọn)

Các prompt bổ sung để sửa lỗi và cải thiện

Prompt 2 : Tinh chỉnh logic đặt lịch

Triển khai logic đặt lịch công khai thật cẩn thận, sử dụng chính xác schema Supabase hiện có...

Implement the public booking logic very carefully using the existing Supabase schema exactly. ================================================ IMPORTANT ================================================ Do NOT invent, rename, or guess any field names. Use the real Supabase schema exactly as provided. Only use these fields: business_hours: - weekday - is_open - start_time - end_time blocked_dates: - blocked_date appointments: - appointment_date - start_time - end_time - status - service_id - full_name - email - phone - notes services: - id - duration_minutes - is_active the settings table from your schema: - slot_interval_minutes - booking_notice_hours Do NOT use any alternative field names. ================================================ GOAL ================================================ Make the public booking logic fully stable, accurate, and production-style. When a user: - selects a service - selects a date the app must calculate real available time slots for that exact date. When a user submits the booking form: - the appointment must be inserted correctly into Supabase - the new appointment must use the exact schema - the selected slot must stop appearing as available ================================================ BOOKING LOGIC RULES ================================================ 1. The user selects a service 2. The user selects a date 3. The app calculates available slots for that exact date 4. Slots must be generated only inside business hours 5. Slots must respect the selected service duration 6. Slots must respect the slot_interval_minutes field from your settings table 7. Slots must be excluded if the selected date exists in blocked_dates 8. Slots must be excluded if they overlap with existing appointments 9. Appointments with status = "cancelled" must NOT block slots 10. Slots that violate the booking_notice_hours field from your settings table must be excluded 11. Only active services should be bookable 12. New appointments must be inserted with status = "pending" ================================================ OVERLAP RULE ================================================ A new slot conflicts if: new_start < existing_end AND new_end > existing_start Use this exact overlap rule consistently everywhere. ================================================ SLOT STRUCTURE (VERY IMPORTANT) ================================================ Normalize all generated available slots into this exact frontend shape: { start: Date, end: Date, label: string } Requirements: - start must be a real Date object - end must be a real Date object - label is for display only - use label directly in the UI - avoid rebuilding labels repeatedly during render ================================================ TIME SAFETY RULES (PREVENT CRASHES) ================================================ - Only call format(...) on real Date objects - Never pass invalid strings into parseISO or format - Never use literal strings like "yyyy-MM-ddT10:30:00" - Always combine the real selected date with the time correctly - Do not rely on unsafe manual string formatting for dates ================================================ STATE RULES ================================================ - selectedService must exist before calculating slots - selectedDate must exist before calculating slots - recalculate available slots whenever selectedService changes - recalculate available slots whenever selectedDate changes - reset availableSlots when selectedService changes - reset selectedTime when service changes - reset selectedTime when date changes - do not calculate slots if required inputs are missing ================================================ BOOKING INSERT RULES ================================================ When creating a new appointment, insert using the exact schema: - full_name - email - phone - service_id - appointment_date - start_time - end_time - status - notes Requirements: - service_id must come from the selected service - appointment_date must match the selected date - start_time and end_time must come from the selected normalized slot - status must be "pending" - notes can be null or the provided optional notes ================================================ ERROR SAFETY ================================================ Add robust error protection: - if slot generation fails, log the real reason clearly - do not crash the whole component - return a safe empty state if calculation fails - render a fallback "No availability" message if no slots exist - if booking insert fails, show a clear user-friendly error message - if booking succeeds, move safely to the success state ================================================ FINAL RESULT ================================================ The final public booking logic should: - use the exact Supabase schema - generate correct real available slots - prevent overlapping bookings - ignore cancelled bookings - respect blocked dates - respect notice period rules - avoid "Invalid time value" errors - avoid UI crashes - insert appointments correctly - remove newly booked slots from availability - behave like a real production booking system

Prompt 3 : Xây dựng bảng điều khiển quản trị

Xây dựng bảng điều khiển quản trị sử dụng chính xác schema Supabase hiện có...

Build the admin dashboard using the existing Supabase schema exactly. ================================================ IMPORTANT ================================================ Do NOT rename any fields. Do NOT invent any alternative field names. Do NOT create fake local-only dashboard data. Use Supabase as the single source of truth. This prompt is for the admin dashboard only. The admin dashboard must work with the existing project structure and existing public booking flow. ================================================ STRICT SCHEMA USAGE ================================================ Use only the real schema fields below. appointments: - id - full_name - email - phone - service_id - appointment_date - start_time - end_time - status - notes - created_at services: - id - name - description - duration_minutes - price - is_active - created_at business_hours: - weekday - is_open - start_time - end_time blocked_dates: - blocked_date - reason the settings table from your schema: - the settings name field from your schema - the settings email field from your schema - the settings phone field from your schema - the settings address field from your schema - slot_interval_minutes - booking_notice_hours Do NOT use any alternative field names. ================================================ GOAL ================================================ Create a real production-style admin dashboard for managing the business. The dashboard must manage: - appointments - services - business hours - blocked dates - settings The dashboard should use Supabase as the source of truth for all reads and writes. ================================================ ACCESS AND SECURITY ================================================ The admin dashboard must be treated as a protected admin area. Requirements: - non-admin users must not be able to access admin dashboard actions - dashboard reads and writes must respect the existing project security setup - do not bypass Supabase security rules - do not use fake client-side admin protection only ================================================ DASHBOARD SECTIONS ================================================ 1. Dashboard Overview 2. Appointments 3. Services 4. Business Hours 5. Blocked Dates 6. Settings ================================================ 1. DASHBOARD OVERVIEW ================================================ Show real data from Supabase for: - today's appointments - pending requests - upcoming confirmed appointments - completed appointments Use live calculated data, not placeholder metrics. ================================================ 2. APPOINTMENTS ================================================ Requirements: - list all appointments - show: - customer full_name - email - phone - service name - appointment date - appointment time - status - notes - allow filtering by: - status - date - allow changing status to: - pending - confirmed - cancelled - completed Important: - status changes must update Supabase immediately - the UI must reflect the updated status clearly - use the real service relationship to display service name - keep the appointments list in sync after status changes - do not show stale records after updates ================================================ 3. SERVICES ================================================ Requirements: - list services - create service - edit service - delete service - toggle active / inactive Use these fields: - name - description - duration_minutes - price - is_active Important: - when a new service is added in the dashboard, it must appear automatically in the public booking page if is_active = true - when is_active = false, it should not appear in the public booking flow - service updates must be reflected in the UI immediately - delete behavior must update the UI safely after success ================================================ 4. BUSINESS HOURS ================================================ Allow editing weekday rows using: - weekday - is_open - start_time - end_time Important: - business hours changes must affect booking availability correctly - do not invent different field names - saving business hours must update Supabase correctly - the UI must refresh safely after updates ================================================ 5. BLOCKED DATES ================================================ Allow: - create blocked date - delete blocked date Use: - blocked_date - reason Important: - blocked dates must affect booking availability correctly - blocked date changes must update Supabase correctly - the UI must stay in sync after create or delete ================================================ 6. SETTINGS ================================================ Allow editing: - the settings name field from your schema - the settings email field from your schema - the settings phone field from your schema - the settings address field from your schema - slot_interval_minutes - booking_notice_hours Important: - settings changes must update Supabase correctly - booking-related settings should affect booking logic correctly - the settings form should load real current values from Supabase ================================================ DATA RULES ================================================ - Supabase is the single source of truth - no fake data - no local-only dashboard records - no schema guessing - use real inserts, updates, deletes, and reads - use safe re-fetching or state synchronization after mutations - avoid stale UI after create / update / delete operations ================================================ UI / BEHAVIOR REQUIREMENTS ================================================ - dashboard must feel structured, clean, and production-style - tables must be readable - forms must be clear - status controls must be understandable - destructive actions must be handled carefully - updates must be reflected in the UI after mutation - avoid stale data after create / update / delete operations - include loading states where needed - include empty states where needed - include simple error states where needed ================================================ FINAL RESULT ================================================ The final admin dashboard should: - use the exact Supabase schema - manage all core clinic data - update Supabase correctly - reflect updates in the UI - show real appointments and services - affect the public booking flow correctly - respect the existing admin security setup - behave like a real production admin dashboard

Prompt 4 : Chạy QA & ổn định hệ thống

Thực hiện một lượt rà soát toàn diện về tính nhất quán, QA, ổn định và bảo mật trên toàn bộ dự án...

Do a full consistency, QA, stabilization, and security-aware validation pass across the entire project. ================================================ GOAL ================================================ Verify that the whole app is stable, clean, consistent with the real Supabase schema, aware of the existing security setup, and ready for real use. The result should be: - stable - production-style - schema-consistent - security-aware - free from obvious logic and formatting bugs ================================================ IMPORTANT ================================================ Check everything against the real Supabase schema only. Do NOT invent or rename fields. Do NOT leave mismatched schema references. Do NOT leave obvious placeholder bugs. Do NOT bypass the existing Supabase security setup. ================================================ STRICT SCHEMA VALIDATION ================================================ Verify all code uses the real schema exactly. services: - id - name - description - duration_minutes - price - is_active - created_at appointments: - id - full_name - email - phone - service_id - appointment_date - start_time - end_time - status - notes - created_at business_hours: - weekday - is_open - start_time - end_time blocked_dates: - blocked_date - reason the settings table from your schema: - the settings name field from your schema - the settings email field from your schema - the settings phone field from your schema - the settings address field from your schema - slot_interval_minutes - booking_notice_hours ================================================ REMOVE INVALID FIELD REFERENCES ================================================ Search the entire codebase and remove any incorrect references to: - day_of_week - open_time - close_time - date (when blocked_date should be used) - customer_name - customer_email - customer_phone Only the real field names should remain. ================================================ BOOKING FLOW QA ================================================ Verify the full booking flow works end-to-end: 1. choose service 2. choose date 3. available times appear correctly 4. choose time 5. submit appointment 6. appointment is inserted into Supabase 7. booked slot disappears from availability 8. overlapping bookings are prevented 9. cancelled bookings do not block availability Also verify: - blocked dates prevent booking correctly - business hours affect availability correctly - the slot_interval_minutes field from your settings table affects slot generation correctly - the booking_notice_hours field from your settings table affects availability correctly ================================================ TIME SAFETY VALIDATION ================================================ Verify all time handling is safe. Requirements: - no invalid parseISO usage - no "Invalid time value" crashes - only real Date objects are passed into format() - available slots use the normalized structure: { start: Date, end: Date, label: string } Also verify: - selected date and time are combined safely - no unsafe literal datetime strings are used - the booking UI does not crash when no availability exists ================================================ DASHBOARD QA ================================================ Verify the admin dashboard works end-to-end: - appointments load correctly - appointment status updates work - services CRUD works - business hours updates work - blocked dates work - settings save correctly Also verify: - new active services appear in the public booking page - inactive services do not appear in the public booking page - dashboard updates remain in sync with Supabase - create / update / delete operations refresh the UI correctly - no stale records remain after mutations ================================================ SECURITY / ACCESS VALIDATION ================================================ Verify the project respects the existing admin security setup. Requirements: - admin dashboard routes are protected - non-admin users cannot access admin dashboard views or admin actions - client code does not bypass Supabase security - writes to admin-managed data respect the existing access rules - the dashboard behaves correctly when access is denied This is a validation pass only: - do not invent a new security architecture - do not rename security-related fields - do not replace the existing security setup unless necessary to make the current setup work correctly ================================================ UI / STATE CONSISTENCY ================================================ Verify: - service selection is not duplicated - data is not rendered twice unnecessarily - there are no obvious stale state issues - availability updates correctly after booking - UI remains consistent after create / update / delete operations - public booking and admin dashboard stay aligned ================================================ LOADING / EMPTY STATES ================================================ Add simple, clean loading and empty states where needed. Examples: - loading services - loading appointments - loading settings - no availability - no appointments - no services - no blocked dates These states should be clear and production-style. ================================================ CODE QUALITY ================================================ Keep the code: - clean - production-style - readable - consistent - safe against obvious runtime issues Do not leave obvious placeholder bugs or weak fallback behavior. ================================================ FINAL RESULT ================================================ After this QA pass, the project should: - match the Supabase schema exactly - have a stable booking flow - have a stable admin dashboard - respect the existing admin security setup - avoid known time formatting bugs - avoid schema mismatch bugs - avoid duplicate selection bugs - include basic loading and empty states - be ready for real demo / production-style use

Đưa website lên mạng

Cài đặt Git

Hãy đảm bảo Git đã được cài trên máy tính của bạn trước khi đẩy dự án lên GitHub.

Tải Git

https://git-scm.com/

Kết nối VS Code với GitHub

Đăng nhập vào tài khoản GitHub của bạn ngay trong VS Code.

Tạo một kho GitHub

Tạo một kho GitHub riêng tư mới và sao chép URL của kho.

Đẩy dự án lên GitHub

Mở Claude Code bên trong VS Code, dán Prompt đẩy lên GitHub an toàn, và thêm URL kho GitHub của bạn. Sau khi Claude chuẩn bị xong dự án, hãy mở Source Control trong VS Code, rồi commit và đồng bộ các thay đổi.

Prompt đẩy lên GitHub an toàn

Thêm URL kho GitHub của bạn bên dưới, rồi dùng prompt đã tùy chỉnh trong Claude Code.

I already created an empty GitHub repository. GitHub repository URL: {{GITHUB_REPOSITORY_URL}} Please prepare and push this local project to that GitHub repository. Rules: - Do not change the app code, UI, design, routes, database logic, backend logic, Supabase logic, or functionality. - Only handle Git and GitHub publishing. - Check Git status, branch, remotes, .gitignore, and tracked files first. - Make sure .env and .env.local are not committed. - Make sure generated files like node_modules, dist, dist-ssr, *.tsbuildinfo, .DS_Store, and log files are ignored. - If unnecessary files are already tracked, remove them from Git tracking only. Do not delete real project files. - Use main for a new repository, unless an existing branch should be preserved. - Connect this project to the GitHub repository URL. - Create a clean commit if needed. - Push the project to GitHub. If the push fails, diagnose and fix only the Git/GitHub setup. Do not change app functionality. Before any destructive action, explain what you found and what you plan to do.

URL kho GitHub

https://github.com/username/repository-name.git

Tạo một Hostinger Node.js Web App

Mở Hostinger, tạo một Node.js web app mới và chọn tên miền của bạn.

Mở Hostinger

Xuất bản dự án này với đúng thiết lập được trình bày trong video.

RECOMMENDED

https://www.hostg.xyz/SHJe0

Import kho lưu trữ và deploy

Import kho GitHub của bạn, thêm các biến môi trường bắt buộc, rồi nhấn Deploy.

VITE_SUPABASE_URL VITE_SUPABASE_ANON_KEY

VITE_SUPABASE_URL

URL dự án

VITE_SUPABASE_ANON_KEY

Khóa anon (công khai)

Lấy các giá trị này từ Supabase

Mở cài đặt API

https://supabase.com/dashboard/project/_/settings/api

Nâng cấp — Thông báo email

Tự động gửi email lịch hẹn

Làm cho hệ thống đặt lịch chuyên nghiệp hơn với email lịch hẹn tự động.

- Gửi email báo lịch đặt mới cho chủ doanh nghiệp

- Gửi email xác nhận cho khách hàng

Làm cho website AI của bạn tự động gửi email (hướng dẫn Supabase)

Xem hướng dẫn

https://youtu.be/KLnBJDJM_p8

Nâng cấp — Thông báo SMS

Tự động gửi SMS lịch hẹn

Làm cho hệ thống đặt lịch của bạn chuyên nghiệp hơn với tin nhắn SMS xác nhận tự động sau mỗi lượt đặt.

- Gửi SMS xác nhận cho khách hàng

- Tùy chọn thông báo cho chủ doanh nghiệp qua SMS

Thêm thông báo SMS cho website đặt lịch AI của bạn

Xem hướng dẫn

https://youtu.be/AoR1FDcUuK4?si=O1Bi5azhJW7jJezF