Best practises for supabase edge functions?
Hi, I have following file tree in my supabase edge functions project:
And I wonder if it's the preferred way to manage edge functions? What are some protips I could use?
In the dashboard I can't see my util files what would be very handy because it's pain to work with edge functions from VSC (at least for me) so I guess I'm doing something wrong
supabase/functions/
├── aggregation/
│ └── index.ts # Fetches and aggregates project/survey data with responses
├── new-response-notification/
│ └── index.ts # Webhook handler that sends email notifications for new responses
├── invite-user-to-org/
│ └── index.ts # Adds/invites users to organisations with permission checks
├── invite-user-to-project/
│ └── index.ts # Adds/invites users to specific projects with role validation
├── _utils/
│ ├── .env # Environment variables for edge functions
│ ├── supabase_types.ts # Database type definitions (duplicate, see types/ folder)
│ ├── _shared/
│ │ └── cors.ts # CORS headers configuration for API responses
│ ├── email/
│ │ ├── elasticEmail.ts # SMTP client setup and email sending via ElasticMail
│ │ ├── emailTemplate.tsx # React Email component for styled notification emails
│ │ ├── emailTemplateRaw.ts # Raw HTML/text email template generator functions
│ │ ├── getProjectData.ts # Fetches response/project data from DB via RPC
│ │ └── mail.tsx # Email template generator wrapper using React Email
│ ├── supabase/
│ │ └── index.ts # Supabase client factories (service, anon, user-scoped)
│ └── types/
│ ├── types.ts # Custom TypeScript types (EmailProps, User)
│ └── supabase_types.ts # Database schema types from Supabase CLI
└── import_map.json # Deno import mappings for dependencies and path aliases supabase/functions/
├── aggregation/
│ └── index.ts # Fetches and aggregates project/survey data with responses
├── new-response-notification/
│ └── index.ts # Webhook handler that sends email notifications for new responses
├── invite-user-to-org/
│ └── index.ts # Adds/invites users to organisations with permission checks
├── invite-user-to-project/
│ └── index.ts # Adds/invites users to specific projects with role validation
├── _utils/
│ ├── .env # Environment variables for edge functions
│ ├── supabase_types.ts # Database type definitions (duplicate, see types/ folder)
│ ├── _shared/
│ │ └── cors.ts # CORS headers configuration for API responses
│ ├── email/
│ │ ├── elasticEmail.ts # SMTP client setup and email sending via ElasticMail
│ │ ├── emailTemplate.tsx # React Email component for styled notification emails
│ │ ├── emailTemplateRaw.ts # Raw HTML/text email template generator functions
│ │ ├── getProjectData.ts # Fetches response/project data from DB via RPC
│ │ └── mail.tsx # Email template generator wrapper using React Email
│ ├── supabase/
│ │ └── index.ts # Supabase client factories (service, anon, user-scoped)
│ └── types/
│ ├── types.ts # Custom TypeScript types (EmailProps, User)
│ └── supabase_types.ts # Database schema types from Supabase CLI
└── import_map.json # Deno import mappings for dependencies and path aliasesAnd I wonder if it's the preferred way to manage edge functions? What are some protips I could use?
In the dashboard I can't see my util files what would be very handy because it's pain to work with edge functions from VSC (at least for me) so I guess I'm doing something wrong