Skip to content

πŸ“Έ Groupify – A collaborative photo-sharing app for group trips, with face recognition and smart filtering. Built with React, Vite & Firebase.

Notifications You must be signed in to change notification settings

groupify-team/Groupify

Repository files navigation

πŸ“Έ Groupify

A modern social photo sharing and event management application with AI-powered face recognition, built with React and Firebase.

✨ Features

πŸŽ‰ Event Management

  • Create & Organize Events: Plan gatherings with date, location, and description
  • Member Management: Invite friends and manage event participants
  • Event Statistics: Track photo uploads, member activity, and event engagement
  • Real-time Updates: See live changes as members interact with events

πŸ“· Smart Photo Sharing

  • Bulk Photo Upload: Upload multiple photos simultaneously with drag-and-drop
  • AI-Powered Face Recognition: Automatically identify and tag people in photos using face-api.js
  • Face Profile Management: Train the system to recognize you and your friends
  • Photo Gallery: Beautiful grid and masonry layouts for browsing event photos
  • Download Options: Download individual photos or entire event albums as ZIP files
  • Photo Filtering: Find your photos instantly with AI face matching

πŸ‘₯ Social Features

  • Friend System: Connect with friends and manage relationships
  • User Presence: See who's online in real-time
  • Event Invitations: Send and receive event invites
  • User Profiles: Customizable profiles with bio, location, and profile pictures

🎨 User Experience

  • Dark/Light Mode: Seamless theme switching with system preference detection
  • Responsive Design: Optimized for desktop, tablet, and mobile devices
  • Accessibility: WCAG-compliant with keyboard navigation and screen reader support
  • Smooth Animations: Page transitions and interactive UI elements
  • Performance Optimized: Lazy loading, code splitting, and efficient rendering

πŸ”’ Security & Privacy

  • Email Verification: Secure account verification system
  • Password Reset: Safe password recovery flow
  • Protected Routes: Authentication-required pages and resources
  • Firestore Security Rules: Server-side data access control
  • Turnstile CAPTCHA: Bot protection for authentication

πŸ’³ Subscription Plans

  • Free Tier: Basic features for casual users
  • Pro Plan: Enhanced limits via Stripe integration
  • Usage Tracking: Monitor photo uploads and storage consumption
  • Plan Enforcement: Automatic limit enforcement based on subscription tier

πŸ—οΈ Architecture

Frontend Stack

  • Framework: React 19 with Hooks
  • Build Tool: Vite 6
  • Routing: React Router DOM 7
  • Styling: Tailwind CSS 3 with custom theme
  • UI Components:
    • Radix UI primitives
    • Material-UI components
    • Custom component library
    • Lucide & Phosphor icons

Backend & Services

  • Backend: Firebase (Firestore, Storage, Functions, Hosting)
  • Authentication: Firebase Auth with custom email verification
  • Database: Cloud Firestore with real-time sync
  • Storage: Firebase Cloud Storage for photos
  • Functions: Node.js 20 serverless functions
  • Email: Nodemailer with custom HTML templates
  • Payments: Stripe integration for subscriptions

AI & Computer Vision

  • Face Detection: face-api.js (SSD MobileNetV1)
  • Face Recognition: 128D face descriptors with Euclidean distance matching
  • Face Landmarks: 68-point facial landmark detection
  • Age/Gender: Optional demographic analysis
  • Expression Detection: Emotion recognition capabilities

Development Tools

  • Testing: Jest with React Testing Library
  • Linting: ESLint with React plugins
  • Version Control: Git with conventional commits
  • Package Manager: npm with workspaces
  • CI/CD: Firebase Hosting with GitHub integration

πŸ“ Project Structure

Groupify/
β”œβ”€β”€ client/                          # Frontend React application
β”‚   β”œβ”€β”€ public/                      # Static assets
β”‚   β”‚   β”œβ”€β”€ models/                  # Face recognition ML models
β”‚   β”‚   └── groupifyLogo.png         # App logo
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ auth-area/               # Authentication module
β”‚   β”‚   β”‚   β”œβ”€β”€ components/          # Auth UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ contexts/            # AuthContext provider
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/               # useAuth, useAuthValidation
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/               # SignIn, SignUp, ForgotPassword, etc.
β”‚   β”‚   β”‚   └── services/            # authService API
β”‚   β”‚   β”œβ”€β”€ dashboard-area/          # Main application area
β”‚   β”‚   β”‚   β”œβ”€β”€ components/          # Dashboard UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ features/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ events/          # Event management
β”‚   β”‚   β”‚   β”‚   β”‚   └── ViewEvent/   # Event detail page
β”‚   β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ features/
β”‚   β”‚   β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ faceRecognition/  # Face detection & matching
β”‚   β”‚   β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ gallery/          # Photo grid/masonry
β”‚   β”‚   β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ header/           # Event header
β”‚   β”‚   β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ members/          # Member management
β”‚   β”‚   β”‚   β”‚   β”‚       β”‚   └── statistics/       # Event stats
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ friends/         # Friend system
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ photos/          # Personal photo library
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ profile/         # User profile
β”‚   β”‚   β”‚   β”‚   └── settings/        # App settings
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/               # Dashboard-specific hooks
β”‚   β”‚   β”‚   └── pages/               # Dashboard page components
β”‚   β”‚   β”œβ”€β”€ public-area/             # Landing and public pages
β”‚   β”‚   β”‚   β”œβ”€β”€ components/          # Public UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/               # Landing, About, Contact, etc.
β”‚   β”‚   β”‚   └── services/            # Public API services
β”‚   β”‚   β”œβ”€β”€ shared/                  # Shared resources
β”‚   β”‚   β”‚   β”œβ”€β”€ components/          # Reusable UI components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ accessibility/   # A11y providers
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ routing/         # Route controllers
β”‚   β”‚   β”‚   β”‚   └── ui/              # UI primitives
β”‚   β”‚   β”‚   β”œβ”€β”€ constants/           # App constants
β”‚   β”‚   β”‚   β”œβ”€β”€ contexts/            # Global contexts (Theme, Friends, Events)
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/               # Shared hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ services/            # Firebase services
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ firebase/        # Firebase SDK wrappers
β”‚   β”‚   β”‚   β”‚   └── presence/        # User presence system
β”‚   β”‚   β”‚   └── utils/               # Utility functions
β”‚   β”‚   β”œβ”€β”€ styles/                  # Global styles
β”‚   β”‚   β”‚   β”œβ”€β”€ base/                # Reset & base styles
β”‚   β”‚   β”‚   β”œβ”€β”€ components/          # Component styles
β”‚   β”‚   β”‚   β”œβ”€β”€ themes/              # Theme definitions
β”‚   β”‚   β”‚   └── utilities/           # CSS utilities
β”‚   β”‚   β”œβ”€β”€ tests/                   # Test suites
β”‚   β”‚   β”‚   β”œβ”€β”€ __mocks__/           # Test mocks
β”‚   β”‚   β”‚   β”œβ”€β”€ api/                 # API tests
β”‚   β”‚   β”‚   β”œβ”€β”€ components/          # Component tests
β”‚   β”‚   β”‚   └── database/            # Firestore query tests
β”‚   β”‚   β”œβ”€β”€ App.jsx                  # Root component
β”‚   β”‚   └── main.jsx                 # App entry point
β”‚   β”œβ”€β”€ index.html                   # HTML template
β”‚   β”œβ”€β”€ vite.config.js               # Vite configuration
β”‚   β”œβ”€β”€ tailwind.config.js           # Tailwind configuration
β”‚   β”œβ”€β”€ jest.config.js               # Jest configuration
β”‚   └── package.json                 # Frontend dependencies
β”œβ”€β”€ functions/                       # Firebase Cloud Functions
β”‚   β”œβ”€β”€ email-templates/             # HTML email templates
β”‚   β”‚   β”œβ”€β”€ contactus.html           # Contact form template
β”‚   β”‚   β”œβ”€β”€ resetpassword.html       # Password reset template
β”‚   β”‚   β”œβ”€β”€ verification.html        # Email verification template
β”‚   β”‚   └── welcome.html             # Welcome email template
β”‚   β”œβ”€β”€ index.js                     # Functions entry point
β”‚   β”œβ”€β”€ openweather-proxy.js         # Weather API proxy
β”‚   └── package.json                 # Functions dependencies
β”œβ”€β”€ docs/                            # Documentation
β”‚   β”œβ”€β”€ firebaseCollection.txt       # Firestore schema
β”‚   β”œβ”€β”€ gitCommands.txt              # Git workflow guide
β”‚   └── projectStructure.txt         # Project structure
β”œβ”€β”€ firebase.json                    # Firebase configuration
β”œβ”€β”€ firestore.rules                  # Firestore security rules
β”œβ”€β”€ firestore.indexes.json           # Firestore indexes
β”œβ”€β”€ storage.rules                    # Storage security rules
└── package.json                     # Root workspace config

πŸš€ Getting Started

Prerequisites

  • Node.js: v18.x or v20.x (LTS recommended)
  • npm: v9.x or higher
  • Firebase CLI: Latest version
  • Git: For version control

Installation

  1. Clone the repository

    git clone https://github.com/groupify-team/Groupify.git
    cd Groupify
  2. Install all dependencies

    npm run install-all
    # Or install individually:
    # npm install              # Root dependencies
    # cd client && npm install # Frontend dependencies
    # cd functions && npm install # Functions dependencies
  3. Firebase Setup

    Create a Firebase project at console.firebase.google.com

    Enable the following services:

    • Authentication (Email/Password)
    • Cloud Firestore
    • Cloud Storage
    • Cloud Functions
    • Hosting
  4. Environment Configuration

    Create client/src/shared/services/firebase/config.js:

    import { initializeApp } from 'firebase/app';
    import { getAuth } from 'firebase/auth';
    import { getFirestore } from 'firebase/firestore';
    import { getStorage } from 'firebase/storage';
    import { getFunctions } from 'firebase/functions';
    
    const firebaseConfig = {
      apiKey: "your-api-key",
      authDomain: "your-project.firebaseapp.com",
      projectId: "your-project-id",
      storageBucket: "your-project.appspot.com",
      messagingSenderId: "your-sender-id",
      appId: "your-app-id"
    };
    
    const app = initializeApp(firebaseConfig);
    export const auth = getAuth(app);
    export const db = getFirestore(app);
    export const storage = getStorage(app);
    export const functions = getFunctions(app);
  5. Configure Function Secrets

    Set up required secrets for Cloud Functions:

    firebase functions:secrets:set EMAIL_USER
    firebase functions:secrets:set EMAIL_PASSWORD
    firebase functions:secrets:set STRIPE_SECRET_KEY
    firebase functions:secrets:set STRIPE_WEBHOOK_SECRET
    firebase functions:secrets:set OPENWEATHER_API_KEY

Development

  1. Start the development server

    npm run dev
    # Runs: Vite dev server + OpenWeather proxy
    # Frontend: http://localhost:5173
    # Weather Proxy: http://localhost:3001
  2. Run Firebase emulators (optional)

    firebase emulators:start
  3. Run tests

    cd client
    npm test              # Run all tests
    npm run test:watch    # Watch mode
    npm run test:coverage # With coverage report

Production Build

  1. Build the client

    npm run build
    # Output: client/dist/
  2. Deploy to Firebase

    # Deploy everything
    npm run deploy
    
    # Or deploy individually:
    npm run deploy:hosting    # Frontend only
    npm run deploy:functions  # Functions only
    npm run deploy:firestore  # Rules only
    npm run deploy:storage    # Storage rules only

πŸ“Š Database Schema

Collections

users

{
  uid: string,              // Firebase Auth UID
  email: string,
  displayName: string,
  photoURL: string,
  profilePicture: string,
  bio: string,
  location: string,
  birthdate: timestamp,
  gender: string,
  friends: array,           // Array of friend UIDs
  events: array,            // Array of event IDs
  photoCount: number,
  emailVerified: boolean,
  createdAt: timestamp,
  updatedAt: timestamp,
  joinedAt: timestamp
}

events

{
  id: string,
  name: string,
  description: string,
  location: string,
  startDate: timestamp,
  endDate: timestamp,
  createdBy: string,        // User UID
  admins: array,            // Admin UIDs
  members: array,           // Member UIDs
  photoCount: number,
  planAtCreation: string,   // 'free' | 'pro'
  planLimits: object,
  createdAt: timestamp,
  updatedAt: timestamp
}

eventPhotos

{
  eventId: string,
  uploadedBy: string,       // User UID
  fileName: string,
  originalName: string,
  filePath: string,
  downloadURL: string,
  type: string,             // MIME type
  size: number,             // Bytes
  planAtUpload: string,
  facesDetected: number,
  facesProcessed: boolean,
  faceMatches: array,       // Array of matched user UIDs
  uploadedAt: timestamp,
  lastModified: timestamp
}

faceProfiles

{
  userId: string,
  images: array,            // Training image URLs
  method: string,           // 'face-api' | 'mediapipe'
  engine: string,
  metadata: object,
  createdAt: timestamp,
  updatedAt: timestamp
}

friendRequests

{
  from: string,             // Sender UID
  to: string,               // Recipient UID
  status: string,           // 'pending' | 'accepted' | 'rejected'
  createdAt: timestamp
}

eventInvites

{
  eventId: string,
  inviterUid: string,
  inviteeUid: string,
  status: string,           // 'pending' | 'accepted' | 'declined'
  createdAt: timestamp
}

πŸ”§ Configuration

Vite Configuration

Key features in client/vite.config.js:

  • Path aliases (@/, @auth/, @shared/, etc.)
  • React plugin with Fast Refresh
  • Optimized chunking strategy
  • Development server on port 5173

Tailwind Configuration

Custom theme extends in client/tailwind.config.js:

  • Custom color palette
  • Extended spacing scale
  • Custom animations
  • Dark mode support via class strategy

Firebase Configuration

Services configured in firebase.json:

  • Hosting: SPA rewrites, custom headers
  • Functions: Node.js 20 runtime
  • Firestore: Security rules and indexes
  • Storage: Access control rules
  • Emulators: Storage on port 9199

πŸ§ͺ Testing

Test Structure

client/src/tests/
β”œβ”€β”€ setup.js                    # Test environment setup
β”œβ”€β”€ __mocks__/                  # Mock implementations
β”‚   └── firebase.js
β”œβ”€β”€ api/                        # API integration tests
β”‚   └── userServices.test.js
β”œβ”€β”€ components/                 # Component unit tests
β”‚   └── EventCard.test.js
└── database/                   # Firestore query tests
    └── firestoreQueries.test.js

Running Tests

cd client

# All tests
npm test

# Specific test file
npm test EventCard

# Watch mode
npm run test:watch

# Coverage report
npm run test:coverage

# Pricing enforcement tests
npm run test:pricing

🎨 Theming

Theme System

  • Provider: ThemeContext with system preference detection
  • Storage: LocalStorage persistence
  • Toggle: Smooth transitions between light/dark modes
  • Variables: CSS custom properties for dynamic theming

Customization

Edit client/tailwind.config.js to customize:

  • Colors and gradients
  • Typography scale
  • Spacing and sizing
  • Border radius
  • Shadow depths
  • Animation timings

πŸ” Security

Authentication Flow

  1. User signs up with email/password
  2. Verification code sent via email
  3. User verifies code to activate account
  4. Password reset with secure token flow
  5. Turnstile CAPTCHA for bot protection

Firestore Security Rules

  • User data readable only by owner or friends
  • Events readable by members only
  • Photos accessible only to event members
  • Admin-only operations protected
  • Rate limiting on sensitive operations

Storage Security Rules

  • Users can upload to their own folders
  • Event photos restricted to event members
  • File size and type validation
  • Authenticated access required

πŸ“± Responsive Design

Breakpoints

  • Mobile: < 640px
  • Tablet: 640px - 1024px
  • Desktop: > 1024px

Mobile-First Approach

  • Touch-optimized interactions
  • Swipe gestures on photo galleries
  • Responsive navigation patterns
  • Optimized image loading

⚑ Performance Optimizations

Frontend

  • Code Splitting: Route-based lazy loading
  • Image Optimization: Lazy loading with react-lazy-load-image-component
  • Memoization: React.memo and useMemo for expensive computations
  • Virtual Scrolling: Efficient rendering of large photo lists
  • Bundle Analysis: Optimized chunk sizes

Backend

  • Firestore Indexes: Optimized query performance
  • Pagination: Cursor-based pagination for large collections
  • Caching: Strategic use of Firebase cache
  • Batch Operations: Grouped writes for efficiency

Face Recognition

  • Model Loading: Progressive model loading
  • Worker Threads: Face detection in Web Workers
  • Descriptor Caching: Store computed face descriptors
  • Threshold Tuning: Optimized matching thresholds

πŸ› οΈ Scripts Reference

Root Scripts

npm run dev              # Start client dev server
npm run build            # Build client for production
npm run start            # Preview production build
npm run install-all      # Install all workspace dependencies
npm run deploy           # Deploy everything to Firebase
npm run deploy:hosting   # Deploy only hosting
npm run deploy:functions # Deploy only functions
npm run deploy:firestore # Deploy only Firestore rules
npm run deploy:storage   # Deploy only Storage rules
npm run serve            # Serve with Firebase locally

Client Scripts

npm run dev              # Vite dev server + weather proxy
npm run build            # Production build
npm run preview          # Preview production build
npm run lint             # Run ESLint
npm test                 # Run Jest tests
npm run test:watch       # Jest watch mode
npm run test:coverage    # Generate coverage report
npm run test:pricing     # Test pricing enforcement

Functions Scripts

npm run serve            # Serve functions locally
npm run deploy           # Deploy functions to Firebase
npm run logs             # View function logs
npm run shell            # Functions shell for testing

🀝 Contributing

Development Workflow

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

Code Style

  • Follow ESLint configuration
  • Use Prettier for formatting
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation

Commit Convention

feat: Add new feature
fix: Bug fix
docs: Documentation changes
style: Code style changes
refactor: Code refactoring
test: Add or update tests
chore: Maintenance tasks

πŸ“„ License

This project is proprietary and confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.

πŸ™ Acknowledgments

Technologies

  • React Team: For the amazing React framework
  • Firebase: For the comprehensive backend platform
  • Tailwind Labs: For Tailwind CSS
  • Vite Team: For the blazing-fast build tool
  • face-api.js: For face recognition capabilities
  • Radix UI: For accessible component primitives

Libraries & Tools

  • React Router: Client-side routing
  • React Hot Toast: Elegant notifications
  • Lucide Icons: Beautiful icon set
  • date-fns: Date manipulation
  • JSZip: ZIP file generation
  • Stripe: Payment processing

πŸ“ž Support

For support, email support@groupify.com or visit our Help Center.

πŸ”— Links


Made with ❀️ by the Groupify Team

About

πŸ“Έ Groupify – A collaborative photo-sharing app for group trips, with face recognition and smart filtering. Built with React, Vite & Firebase.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •