Help Center/ Relational Database Service_RDS for PostgreSQL/ Best Practices/ AI Application Development Platform/ Source Code Configuration Guide for RDS Supabase Email Authentication Demo
Updated on 2026-10-30 GMT+08:00

Source Code Configuration Guide for RDS Supabase Email Authentication Demo

Scenarios

This section describes how to create a demo project and all source code files. Create a project and related directories on the local machine strictly according to the directory and file structure. Create the corresponding files in sequence and copy all source code.

Directory and File Structure

Figure 1 Directory and file structure of the demo project

The directory and file structure of the demo project is as follows:

supabase_auth_email  // Project root directory
├── .env                    // Supabase environment variable configuration (URL/Anon Key)
├── .env.example            // Example template of environment variables
├── index.html              // Homepage entry interface
├── package.json            // Build dependency configuration (React 18 + Vite 5 + Supabase)
├── vite.config.js          // Vite build configuration
└── src                     // Core functional source code directory
    ├── App.jsx             // Root component: dispatches pages based on login state, with Chinese-English switching support
    ├── main.jsx            // React application entry mounting
    ├── index.css           // Global styles
    ├── components          // UI component directory
    │   ├── AuthForm.jsx        // Login/Registration form
    │   ├── ChangeEmail.jsx     // Email change component
    │   ├── Dashboard.jsx       // User panel after login
    │   ├── Message.jsx         // General message prompt
    │   ├── ResetPassword.jsx   // Password reset (request/recovery mode)
    │   └── ResetPasswordInline.jsx // Inline password reset
    ├── context             // React state management directory
    │   ├── AuthContext.jsx     // Authentication status (Supabase session)
    │   └── LanguageContext.jsx // Language switching between Chinese and English
    ├── i18n                // Internationalization text directory
    │   ├── en.js               // English text
    │   └── zh.js               // Chinese text
    └── lib                 // Utility library directory
        ├── errors.js           // Error code to user message mapping
        └── supabase.js         // Supabase client initialization

File Content