Socle technique & schéma SQL anzi.pro

Consultez l’arborescence des routes, la charte graphique Tailwind et le script SQL Supabase complet (6 tables, triggers auth.users, Row Level Security et Realtime).

Client Supabase : URL configurée (.env.local)
Nuit d’Encre
primary
#1E1B4B
Ambre Corail
accent
#F97316
Émeraude
success
#10B981
Blanc Albâtre
background
#F8FAFC
-- anzi.pro — Schéma complet Supabase PostgreSQL + Row Level Security (RLS)
-- Fichier source disponible dans /supabase/schema.sql

create extension if not exists "pgcrypto";
create extension if not exists "unaccent";

create type public.user_role as enum ('candidat', 'entreprise', 'agence');
create type public.application_status as enum ('new', 'reviewed', 'interview', 'hired', 'archived');

create table public.profiles (
  id uuid primary key references auth.users (id) on delete cascade,
  role public.user_role not null default 'candidat',
  full_name text not null default '',
  slug text unique,
  avatar_url text,
  title text default '',
  availability_status boolean not null default true,
  credits integer not null default 5 check (credits >= 0),
  created_at timestamptz not null default now(),
  updated_at timestamptz not null default now()
);

create table public.cv_data (
  id uuid primary key default gen_random_uuid(),
  profile_id uuid not null references public.profiles (id) on delete cascade,
  title text not null,
  content jsonb not null default '{}'::jsonb,
  is_public boolean not null default false,
  updated_at timestamptz not null default now()
);

create table public.companies (
  id uuid primary key default gen_random_uuid(),
  owner_id uuid not null references public.profiles (id) on delete cascade,
  name text not null,
  slug text not null unique,
  siret text unique,
  naf_code text,
  description text default '',
  logo_url text,
  website text,
  created_at timestamptz not null default now()
);

create table public.job_offers (
  id uuid primary key default gen_random_uuid(),
  company_id uuid not null references public.companies (id) on delete cascade,
  title text not null,
  rome_code text not null,
  description text not null default '',
  is_active boolean not null default true,
  created_at timestamptz not null default now()
);

create table public.applications (
  id uuid primary key default gen_random_uuid(),
  job_offer_id uuid references public.job_offers (id) on delete set null,
  candidate_id uuid not null references public.profiles (id) on delete cascade,
  company_id uuid not null references public.companies (id) on delete cascade,
  status public.application_status not null default 'new',
  match_score integer check (match_score between 0 and 100),
  created_at timestamptz not null default now()
);

create table public.messages (
  id uuid primary key default gen_random_uuid(),
  sender_id uuid not null references public.profiles (id) on delete cascade,
  receiver_id uuid not null references public.profiles (id) on delete cascade,
  content text not null,
  is_read boolean not null default false,
  created_at timestamptz not null default now(),
  check (sender_id <> receiver_id)
);

-- RLS activé sur les 6 tables + trigger handle_new_user() sur auth.users
-- Voir /supabase/schema.sql pour les 16 policies RLS complètes et Realtime.