© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4mo ago•
4 replies
Floppy Disk

Best practises for supabase edge functions?

Hi, I have following file tree in my supabase edge functions project:
 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 aliases

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 banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Best TypeScript DX for Supabase Edge Functions
SupabaseSSupabase / help-and-questions
13mo ago
Supabase Edge Functions authentication
SupabaseSSupabase / help-and-questions
2w ago
Edge functions supabase error
SupabaseSSupabase / help-and-questions
5mo ago
Does Supabase Cache responses for Edge Functions?
SupabaseSSupabase / help-and-questions
4mo ago