Skip to content

divyeshb13/react-supabase-realtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° React + Supabase Real-time Financial Tracker

A fully-featured financial management application built with React, Supabase, and Tailwind CSS v4. Features real-time data synchronization across multiple browser tabs/devices, authentication, and a modern UI.

Project Status React Supabase Tailwind CSS

🌐 Live Demo

πŸš€ View Live Demo

Try out the application with full real-time synchronization!

Demo Credentials:

  • Email: supabaseuser@yopmail.com
  • Password: User@123

πŸ’‘ Note: Demo credentials are intentionally public for testing purposes. Data may be reset periodically.


πŸŽ₯ Video Preview

β–Ά Watch Demo Video:
https://github.com/user-attachments/assets/e823ac9a-a98c-4974-b5ee-fa9b168ed508

Features Demonstrated:

  • βœ… Real-time transaction updates
  • βœ… Multi-tab synchronization
  • βœ… CRUD operations (Create, Read, Update, Delete)
  • βœ… Toast notifications

✨ Features

πŸ” Authentication

  • Email/Password Registration & Login
  • Email Verification Required
  • Protected Routes with automatic redirect
  • Session Management with proper cleanup

πŸ’Έ Transaction Management

  • βž• Add/Edit/Delete transactions
  • πŸ“Š Real-time income/expense tracking
  • πŸ“ˆ Automatic balance calculation
  • πŸ”„ Live sync across all browser tabs

🏷️ Category Management

  • 🎨 Custom color picker (8 preset colors)
  • πŸ˜€ Emoji icon support
  • πŸ”€ Income/Expense/Both types
  • πŸ”„ Real-time updates

πŸ’° Budget Management

  • πŸ“… Period-based budgets (Daily/Weekly/Monthly/Yearly)
  • πŸ“Š Active/Ended budget tracking
  • πŸ“ˆ Total budget amount calculation
  • πŸ”„ Real-time synchronization

🎨 UI/UX

  • πŸ“± Fully Responsive (Mobile, Tablet, Desktop)
  • 🎯 Modern gradient design
  • πŸ”” Toast notifications for all actions
  • ⚑ Smooth transitions and animations

πŸ”’ Security

  • πŸ›‘οΈ Row Level Security (RLS) on all tables
  • πŸ‘€ User-specific data isolation
  • πŸ” Protected API routes
  • βœ… Email verification enforcement

πŸš€ Quick Start

See QUICKSTART.md for detailed setup instructions and deployment guide.

Prerequisites

Installation

# Clone the repository
git clone <your-repo-url>
cd react-supabase-realtime-interaction

# Install dependencies
pnpm install

# Configure environment variables
cp .env.example .env
# Edit .env with your Supabase credentials

# Run database migrations
# (See QUICKSTART.md for SQL setup)

# Start development server
pnpm run dev

πŸ—οΈ Project Structure

react-supabase-realtime-interaction/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ budgets/              # Budget components
β”‚   β”‚   β”‚   β”œβ”€β”€ BudgetStatsCards.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ BudgetList.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ BudgetListItem.jsx
β”‚   β”‚   β”‚   └── BudgetCreateEdit.jsx
β”‚   β”‚   β”œβ”€β”€ categories/           # Category components
β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryStatsCards.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryGrid.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryCard.jsx
β”‚   β”‚   β”‚   └── CategoryCreateEdit.jsx
β”‚   β”‚   β”œβ”€β”€ transactions/         # Transaction components
β”‚   β”‚   β”‚   β”œβ”€β”€ TransactionStatsCards.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ TransactionList.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ TransactionListItem.jsx
β”‚   β”‚   β”‚   └── TransactionCreateEdit.jsx
β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   └── Layout.jsx
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Budgets.jsx
β”‚   β”‚   β”œβ”€β”€ Categories.jsx
β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”œβ”€β”€ Register.jsx
β”‚   β”‚   └── Transactions.jsx
β”‚   β”œβ”€β”€ App.jsx                   # Main app with routing
β”‚   β”œβ”€β”€ AuthContext.jsx           # Authentication context
β”‚   β”œβ”€β”€ ProtectedRoute.jsx        # Route protection
β”‚   β”œβ”€β”€ supabaseClient.js         # Supabase configuration
β”‚   β”œβ”€β”€ main.jsx                  # App entry point
β”‚   └── index.css                 # Tailwind imports
β”œβ”€β”€ supabase-schema.sql           # Database schema & RLS
β”œβ”€β”€ supabase-realtime-fix.sql     # Realtime configuration
β”œβ”€β”€ .env.example                  # Environment template
└── package.json

πŸ”§ Technology Stack

Technology Purpose
React 18.3 UI Framework
Vite 6.2 Build tool & dev server
Supabase Backend (Auth, Database, Realtime)
Tailwind CSS v4 Styling framework
React Router v7 Client-side routing
React Toastify Toast notifications
pnpm Package manager

πŸ—„οΈ Database Schema

Tables

transactions

  • Stores all financial transactions (income/expense)
  • Fields: id, user_id, amount, description, category, type, date

categories

  • Stores user-defined categories
  • Fields: id, user_id, name, color, icon, type

budgets

  • Stores budget plans
  • Fields: id, user_id, category, amount, period, start_date, end_date

Security Features

  • βœ… Row Level Security (RLS) enabled on all tables
  • βœ… User-specific policies (SELECT, INSERT, UPDATE, DELETE)
  • βœ… REPLICA IDENTITY FULL for real-time DELETE events

πŸ”„ Real-time Implementation

How It Works

  1. Subscription Setup: Each page subscribes to real-time changes on mount
  2. Event Handling: Listens for INSERT, UPDATE, DELETE events
  3. State Updates: Automatically updates React state when changes occur
  4. Cleanup: Properly removes channels on component unmount

Key Features

  • βœ… Multi-tab synchronization
  • βœ… User-specific filtering (user_id=eq.${userId})
  • βœ… Automatic reconnection handling
  • βœ… Console logging for debugging

🎯 Component Architecture

All CRUD pages follow the same modular structure:

Page Component (Main)
β”œβ”€β”€ StatsCards Component (Stats display)
β”œβ”€β”€ CreateEdit Component (Form with submit/reset)
└── List/Grid Component (Display)
    └── ListItem/Card Component (Individual items)

Benefits:

  • πŸ“¦ Reusable components
  • πŸ”§ Easy maintenance
  • πŸ§ͺ Testable code
  • πŸ“– Clear separation of concerns

🌐 Deployment

Build for Production

# Build optimized production bundle
pnpm run build

# Preview production build locally
pnpm run preview

Deploy to Vercel (Recommended)

  1. Push code to GitHub
  2. Import project to Vercel
  3. Add environment variables:
    • VITE_SUPABASE_URL
    • VITE_SUPABASE_ANON_KEY
  4. Deploy!

See QUICKSTART.md for detailed deployment guides (Vercel, Netlify, Railway).


πŸ“ Environment Variables

Create a .env file in the root:

VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here

πŸ§ͺ Testing Checklist

  • βœ… User registration with email verification
  • βœ… Login/Logout flow
  • βœ… CRUD operations on all three pages
  • βœ… Real-time sync across multiple tabs
  • βœ… RLS policies preventing unauthorized access
  • βœ… Toast notifications on all actions
  • βœ… Responsive design on mobile/tablet

πŸ› οΈ Development Commands

# Start dev server (default: http://localhost:5173)
pnpm run dev

# Build for production
pnpm run build

# Preview production build
pnpm run preview

# Lint code (if configured)
pnpm run lint

πŸ“š Additional Documentation


🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is open source and available under the MIT License.


πŸ™ Acknowledgments

  • Supabase - Open source Firebase alternative
  • Tailwind CSS - Utility-first CSS framework
  • React - JavaScript library for building UIs
  • Vite - Next generation frontend tooling

πŸ’¬ Support

If you have questions or need help:

  1. Check the QUICKSTART.md guide
  2. Review Supabase Documentation
  3. Open an issue on GitHub

Built with ❀️ using React, Supabase, and Tailwind CSS

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors