Create a .env file in your project root with:
RESEND_API_KEY=re_your_api_key_here
MAIL_FROM=BYO Cake Club <noreply@bringyourowncake.com>
STAFF_PASSWORD=your_secure_staff_password_here
STRIPE_CHECKOUT_URL=https://buy.stripe.com/your_checkout_url
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
STRIPE_WEBHOOK_SECRET_DEV=whsec_your_dev_webhook_secret
CONTACT_EMAIL=contact@bringyourowncake.com
- Go to resend.com
- Sign up for an account
- Go to API Keys section
- Create a new API key
- Copy the key (starts with
re_) - Add it to your
.envfile asRESEND_API_KEY
- In Resend dashboard, go to Domains
- Add your domain:
bringyourowncake.com - Verify the domain with DNS records
- Once verified, you can send emails from
noreply@bringyourowncake.com
- Create a Stripe account at stripe.com
- Get your API keys from the Stripe dashboard
- Set up a product and price for tickets
- Create a checkout session URL
- Configure webhook endpoints
- Go to Stripe Dashboard → Webhooks
- Add endpoint:
https://your-site.netlify.app/.netlify/functions/stripe-webhook - Select events:
checkout.session.completed - Copy the webhook secret and add to
STRIPE_WEBHOOK_SECRET
- Create a Supabase project at supabase.com
- Get your project URL and service role key
- Run the SQL migration from
database-migration.sql - Add credentials to your
.envfile
Create the tickets table with the following schema:
CREATE TABLE public.tickets (
id uuid NOT NULL DEFAULT gen_random_uuid(),
stripe_payment_intent text NOT NULL,
stripe_checkout_session text NOT NULL,
email text NOT NULL,
first_name text NULL,
last_name text NULL,
quantity integer NOT NULL DEFAULT 1,
issued_at timestamp with time zone NOT NULL DEFAULT now(),
code text NOT NULL,
redeemed_at timestamp with time zone NULL,
CONSTRAINT tickets_pkey PRIMARY KEY (id),
CONSTRAINT tickets_code_key UNIQUE (code),
CONSTRAINT tickets_stripe_payment_intent_key UNIQUE (stripe_payment_intent)
) TABLESPACE pg_default;Required Indexes:
CREATE INDEX idx_tickets_code ON tickets(code);
CREATE INDEX idx_tickets_email ON tickets(email);
CREATE INDEX idx_tickets_redeemed_at ON tickets(redeemed_at);When deploying to Netlify:
- Go to Site Settings → Environment Variables
- Add all environment variables from your
.envfile - Redeploy your site
- Choose a strong password: Use a combination of letters, numbers, and symbols
- Keep it secret: Don't share the password in code repositories
- Change regularly: Update the password periodically for security
- Different environments: Use different passwords for development and production
- Never commit API keys to version control
- Use environment variables for all sensitive data
- Rotate keys regularly
- Use different keys for development and production
- Use Stripe test keys (
sk_test_...) - Use development webhook secrets
- Mock email sending if needed
- Use test Supabase project
- Use Stripe live keys (
sk_live_...) - Use production webhook secrets
- Real email sending enabled
- Use production Supabase project
-
"RESEND_API_KEY not found"
- Check that your
.envfile is in the project root - Verify the API key format (starts with
re_)
- Check that your
-
"Stripe webhook signature verification failed"
- Ensure webhook secret is correct
- Check that webhook URL is accessible
- Verify webhook events are configured correctly
-
"Supabase connection failed"
- Verify SUPABASE_URL format
- Check service role key permissions
- Ensure database tables exist
-
"Staff authentication failed"
- Verify STAFF_PASSWORD is set
- Check password complexity requirements
- Ensure session cookies are enabled