Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/moradoadrian/carneroDev/llms.txt

Use this file to discover all available pages before exploring further.

Carnero.Dev uses three environment variables to connect to Supabase and Resend. RESEND_API_KEY is read at runtime on every request; SUPABASE_URL and SUPABASE_ANON_KEY are referenced in src/lib/supabase.ts, which currently hardcodes those values directly in source — see the note in each field below. Missing values degrade gracefully with warnings logged to the server console. Because the application uses Astro SSR (output: 'server'), runtime variables are resolved via import.meta.env and process.env — they must be present in the runtime process, not just during the build step.

Variable Reference

SUPABASE_URL
string
required
The full URL of your Supabase project, e.g. https://xxxx.supabase.co. This value is passed to createClient(supabaseUrl, supabaseKey) in src/lib/supabase.ts.Important: the current source hardcodes this value directly in src/lib/supabase.ts rather than reading it from an environment variable. To use this env var, update supabase.ts to read process.env.SUPABASE_URL instead. You can find the URL in your Supabase project dashboard under Project Settings → API → Project URL.
SUPABASE_ANON_KEY
string
required
The anonymous (publishable) key for your Supabase project. It is passed as the second argument to createClient in src/lib/supabase.ts and enforces Row Level Security policies defined on your database tables.Important: the current source hardcodes this value directly in src/lib/supabase.ts rather than reading it from an environment variable. To use this env var, update supabase.ts to read process.env.SUPABASE_ANON_KEY instead. Find the key in your Supabase project dashboard under Project Settings → API → Project API Keys.
RESEND_API_KEY
string
required
Your Resend API key, prefixed re_. Used to authenticate the resend.emails.send() call in src/pages/api/register.ts. If this variable is missing entirely or retains the placeholder value re_your_resend_api_key_placeholder, email sending is skipped and a [RESEND_WARNING] is logged to the server console. The team registration record is still written to Supabase. Obtain your key from the Resend dashboard.

Migrating Supabase to Environment Variables

The current src/lib/supabase.ts hardcodes the Supabase credentials:
const supabaseUrl = 'https://sdobjolxazkvbsakzwcl.supabase.co'
const supabaseKey = 'sb_publishable_O51sgtbrGi48EakI2_z-5w_3QI7bef8'

export const supabase = createClient(supabaseUrl, supabaseKey)
To move those credentials to environment variables, replace the hardcoded values with process.env lookups:
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = process.env.SUPABASE_URL!
const supabaseKey = process.env.SUPABASE_ANON_KEY!

export const supabase = createClient(supabaseUrl, supabaseKey)
After making this change, set SUPABASE_URL and SUPABASE_ANON_KEY in your deployment environment and they will be picked up at server startup.

.env File Template

Create a .env file in the project root with the following structure before running npm run dev or npm run build. The Supabase entries only take effect after updating src/lib/supabase.ts as described above.
# Supabase connection (requires supabase.ts update to read from process.env)
SUPABASE_URL=https://your-project-ref.supabase.co
SUPABASE_ANON_KEY=sb_publishable_your_anon_key_here

# Resend email API
RESEND_API_KEY=re_your_resend_api_key_here

Where Variables Are Used

VariableFilePurpose
SUPABASE_URLsrc/lib/supabase.tsSupabase client init URL (currently hardcoded)
SUPABASE_ANON_KEYsrc/lib/supabase.tsSupabase auth key (currently hardcoded)
RESEND_API_KEYsrc/pages/api/register.tsEmail dispatch authentication

Behavior When Missing

Understanding the failure modes for each variable helps you diagnose issues in production without guesswork. SUPABASE_URL or SUPABASE_ANON_KEY missing: Because the current source hardcodes these values, removing them from the environment has no effect on Supabase connectivity. If you have migrated supabase.ts to read from process.env and the variables are absent, the Supabase client initializes with undefined values. The application starts without errors, but the first database operation — the .insert() call inside POST /api/register — throws a runtime error, resulting in a 500 response with { "error": "[ERROR_DE_SISTEMA]: No se pudo guardar la información en base de datos: ..." } and a [SUPABASE_DB_INSERT_ERROR] entry in the server console. RESEND_API_KEY missing: The registration API detects the absent or placeholder key before instantiating the Resend client:
const resendApiKey = import.meta.env.RESEND_API_KEY || process.env.RESEND_API_KEY;
if (!resendApiKey || resendApiKey === 're_your_resend_api_key_placeholder') {
  console.warn('[RESEND_WARNING]: RESEND_API_KEY no configurado o mantiene valor por defecto. Saltando envío de correo.');
  emailErrorMsg = 'Servicio de correo temporalmente desconectado.';
}
Email sending is skipped entirely. The team is still registered in Supabase and the API returns a 200 response with:
{
  "success": true,
  "message": "¡Registro exitoso!",
  "email_sent": false,
  "email_error": "Servicio de correo temporalmente desconectado."
}
Never commit your .env file to source control. The project’s .gitignore excludes .env by default — verify this before your first commit. Set production secrets through your cloud platform’s secret management UI (Railway Variables, Render Environment, Fly.io Secrets) so they are never stored in plain text in your repository.

Accessing Variables in Code

Astro exposes environment variables through two mechanisms that behave identically in the SSR context:
  • import.meta.env — Astro’s environment variable interface, available in both build-time and SSR request-time contexts.
  • process.env — The standard Node.js environment object, available in any server-side code.
The registration API route reads the Resend key from both to handle every possible Node.js runtime context:
const resendApiKey = import.meta.env.RESEND_API_KEY || process.env.RESEND_API_KEY;
If you update src/lib/supabase.ts to read Supabase credentials from process.env, those values are resolved at module initialization time when the server process starts. A full server restart is required for updated environment variable values to take effect.

Build docs developers (and LLMs) love