- Go to https://supabase.com
- Sign up/Login and create a new project
- Wait for the project to be provisioned
- Go to your Supabase dashboard
- Navigate to SQL Editor
- Run the database setup in this order:
- Copy and paste the contents of
db/schema.sqlto create tables and functions - Copy and paste the contents of
db/system-categories-seed.sqlto populate default categories - Copy and paste the contents of
db/rpc.sqlto create RPC functions
- Copy and paste the contents of
- Verify tables are created:
system_categories,categories, andexpenses
- Copy
.env.exampleto.env - Go to Settings > API in your Supabase dashboard
- Copy the Project URL and anon/public key
- Update the values in
.env
VITE_SUPABASE_URL=https://your-project-id.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here
The app is configured to use email/password authentication. Users will need to:
- Sign up with email and password
- Confirm their email (check Supabase email settings if needed)
- Sign in to access the expense tracking features
The database is configured with Row Level Security (RLS) to ensure:
- Users can only see their own expenses
- Users can only modify their own data
- Data is properly isolated between users
The application uses a dynamic hierarchical category system. See the following files for complete schema details:
- Schema Definition:
db/schema.sql- Complete table structures, triggers, and RLS policies - Category Seed Data:
db/system-categories-seed.sql- Default categories with Chinese localization - RPC Functions:
db/rpc.sql- Data processing and aggregation functions
If you need to reset the database during development:
- Clean Database: Run
db/cleanup.sqlto drop all tables and functions - Recreate Schema: Run
db/schema.sqlto recreate tables and triggers - Seed Categories: Run
db/system-categories-seed.sqlto populate default categories - Add RPC Functions: Run
db/rpc.sqlto create data processing functions
Warning: The cleanup script will delete all data. Only use during development.