This project uses Nuxt 3, Pinia, Supabase, and Google OAuth authentication for the admin area.
- Node.js 18+
- Supabase account
- Google account for authentication
- Create a new project in Supabase.
- Get your
SUPABASE_URLandSUPABASE_ANON_KEYfrom the project settings. - In the Supabase SQL editor, create the required tables:
-- Event table
CREATE TABLE public.event (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
name character varying,
event_date timestamp with time zone,
invite_text text,
message text,
adress_1 text,
adress_2 text,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone DEFAULT now(),
CONSTRAINT event_pkey PRIMARY KEY (id)
);
-- Gift table
CREATE TABLE public.gift (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
external_reference character varying,
name character varying,
is_available boolean NOT NULL DEFAULT true,
image_url character varying,
price character varying,
payment_url character varying,
quantity numeric DEFAULT '1'::numeric,
quantity_gifted numeric DEFAULT '0'::numeric,
CONSTRAINT gift_pkey PRIMARY KEY (id)
);
-- RSVP table
CREATE TABLE public.rsvp (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone DEFAULT now(),
name character varying,
has_guest boolean NOT NULL DEFAULT false,
guest_name character varying,
whatsapp character varying NOT NULL,
document character varying NOT NULL,
guest_document character varying,
CONSTRAINT rsvp_pkey PRIMARY KEY (id)
);
-- Test table
CREATE TABLE public.test (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
created_at timestamp with time zone NOT NULL DEFAULT now(),
name character varying DEFAULT 'teste'::character varying,
CONSTRAINT test_pkey PRIMARY KEY (id)
);
-- Users table
CREATE TABLE public.users (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone DEFAULT now(),
user character varying NOT NULL UNIQUE,
password character varying,
CONSTRAINT users_pkey PRIMARY KEY (id)
);- Enable Google OAuth in Supabase Authentication > Providers > Google.
- Add authorized redirect URLs in Authentication > Site URLs:
http://<your-local-ip>:3000/auth/callbackor your production url
- Install dependencies:
npm install- Create a
.envfile in the project root:
# Supabase Configuration
SUPABASE_URL=your_supabase_url_here
SUPABASE_ANON_KEY=your_supabase_anon_key_here
# Authorized Emails (comma-separated, no spaces)
AUTHORIZED_EMAILS=paulogabrielneves96@gmail.com,isabelemendes34@gmail.comnpm run devAccess at http://localhost:3000 or your configured IP.
- Go to
/loginand click "Sign in with Google". - Only emails listed in
AUTHORIZED_EMAILSwill have access to the admin area. - If the email is not authorized, the user will be automatically logged out and see an error message.
- Access to
/adminand/testis protected by authentication and authorization.
- Authorized emails are only in
.env(not versioned in GitHub). - The authentication token is saved in localStorage and validated on every access.
- Logout is available via the button in the admin panel.
To build and preview for production:
npm run build
npm run previewFor deployment, follow the official Nuxt documentation.