Skip to content
Mostakim52Public

Repository files navigation

RepuGate - AI-Powered Facebook Review Management

RepuGate Logo

Transform your business reviews with intelligent, multi-language AI replies. Respond to Facebook reviews faster than ever with RepuGate.

Live Demo: https://repugate.vercel.app


🏗️ Built With

Vercel
Vercel
Supabase
Supabase
Clerk
Clerk
Groq
Groq

Also powered by:
React 18 • Node.js • Express • Tailwind CSS • PostgreSQL • Facebook Graph API


Table of Contents


Overview

RepuGate is a SaaS application that helps business owners manage and respond to Facebook reviews efficiently. Using AI-powered reply generation, it creates thoughtful, multi-language responses in seconds—helping you maintain a positive online reputation while saving hours of manual work.

Who is it for?

  • 🏪 Retail stores and e-commerce businesses
  • 🍽️ Restaurants, cafes, and food services
  • 💇 Salons, spas, and beauty services
  • 🏥 Healthcare and medical clinics
  • 🏨 Hotels, accommodations, and travel
  • 💼 Any business management Facebook reviews

Why RepuGate?

✅ Fast - Generate 3 AI reply options in ~10 seconds
✅ Multi-language - English and Bangla support
✅ Easy - One-click Facebook login, no setup required
✅ Secure - OAuth authentication, Supabase database, Row-Level Security
✅ Smart - AI review prioritization and compliance checking


Tech Stack

Frontend

  • React 18 - UI framework with hooks
  • React Router v7 - Client-side routing
  • Tailwind CSS - Utility-first styling
  • Lucide React - Beautiful SVG icons
  • Framer Motion - Smooth animations
  • Axios - HTTP client
  • Clerk - User authentication & management

Backend

  • Node.js + Express - REST API framework
  • Supabase - PostgreSQL database & auth
  • Groq - AI model for reply generation (fast inference)
  • Facebook Graph API - Review data integration
  • JWT - Secure token authentication
  • Helmet - Security headers
  • CORS - Cross-origin resource sharing

Infrastructure & Deployment

  • Vercel - Frontend and backend hosting
  • Supabase - Database and real-time features
  • PostgreSQL - Primary data store
  • Clerk - Third-party auth provider
  • Facebook Graph API v25.0 - Review integration

Development Tools

  • npm - Package management
  • Nodemon - Auto-reload during development
  • Jest - Testing framework
  • ESLint - Code linting

Architecture

System Design

┌─────────────────────────────────────────────────────┐
│                    Browser / Client                  │
│                    (React 18)                         │
└────────────────┬────────────────────────────────────┘
                 │
                 ├─ Frontend App (Vercel)
                 │  https://repugate.vercel.app
                 │
        ┌────────▼────────┐
        │   Clerk OAuth   │────────────────┐
        │   (Auth)        │                │
        └─────────────────┘                │
             │                            │
             │ x-facebook-token           │
             │ x-auth-token               │
             │                            │
   ┌─────────▼──────────────────────┐    │
   │  Backend API (Vercel)          │    │
   │  repugatebackend.vercel.app    │    │
   │                                │    │
   │  ├─ /api/auth/*               │    │
   │  ├─ /api/providers/*          │    │
   │  ├─ /api/reviews/*            │    │
   │  ├─ /api/replies/*            │    │
   │  └─ /api/activity/*           │    │
   └─────────┬──────────────────────┘    │
             │                           │
    ┌────────▼───────┐        ┌──────────▼──────┐
    │ Facebook Graph │        │ Groq AI API     │
    │ API v25.0      │        │ (Reply Gen)     │
    │ (Reviews)      │        └─────────────────┘
    └────────┬───────┘
             │
    ┌────────▼─────────────────────────┐
    │   Supabase PostgreSQL             │
    │   ├─ users                        │
    │   ├─ facebook_pages               │
    │   ├─ reviews                      │
    │   ├─ generated_replies            │
    │   └─ activity_logs                │
    │                                   │
    │   Row-Level Security (RLS) enabled│
    └───────────────────────────────────┘

Data Flow

  1. Authentication: User logs in via Clerk OAuth → Token stored in localStorage
  2. Facebook Integration: User grants app access to their Facebook business page
  3. Review Fetching: App fetches reviews from Facebook Graph API using user's access token
  4. Review Storage: Reviews saved to Supabase with RLS restrictions (only user can access their own)
  5. AI Generation: Selected review sent to Groq API for 3 reply options
  6. Reply Management: Generated replies stored and user can copy to Facebook or save locally

Project Structure

repugate/
├── frontend/                    # React frontend application
│   ├── public/
│   │   └── index.html
│   ├── src/
│   │   ├── assets/
│   │   │   └── images/         # Logo files (vercel, supabase, clerk, groq)
│   │   ├── components/
│   │   │   ├── App.js          # Main router component
│   │   │   ├── Dashboard.js    # Main dashboard (reviews + reply generator)
│   │   │   ├── LoginScreen.js  # OAuth login flow
│   │   │   ├── LandingPage.js  # Public landing & feature showcase
│   │   │   ├── ReviewList.js   # Review list component with filtering
│   │   │   ├── ReplyGenerator.js
│   │   │   ├── GuidedTour.js
│   │   │   ├── KeyboardShortcuts.js
│   │   │   └── PrivacyPolicy.js
│   │   ├── utils/
│   │   │   ├── api.js          # Axios API client
│   │   │   ├── supabaseDb.js   # Supabase database functions
│   │   │   ├── clerkInstance.js
│   │   │   └── reviewPrioritization.js
│   │   ├── App.js              # Router setup
│   │   ├── index.js
│   │   └── index.css           # Tailwind imports
│   ├── package.json
│   └── vercel.json             # Vercel routing config
│
├── backend/                     # Express.js backend API
│   ├── src/
│   │   ├── server.js           # Express app setup
│   │   ├── controllers/
│   │   │   ├── reviewController.js
│   │   │   └── replyController.js
│   │   ├── routes/
│   │   │   ├── providers.js    # Facebook/Google API endpoints
│   │   │   ├── replies.js      # AI reply generation endpoints
│   │   │   └── reviews.js      # Review management endpoints
│   │   ├── utils/
│   │   │   ├── server.js       # App configuration
│   │   │   ├── supabaseClient.js
│   │   │   ├── supabaseDb.js   # Database layer
│   │   │   ├── aiService.js    # Groq AI integration
│   │   │   ├── googleService.js
│   │   │   └── database.js     # Legacy SQLite (migration in progress)
│   │   └── providers/
│   │       └── base.js
│   ├── package.json
│   ├── vercel.json             # Vercel backend config
│   └── .env.example
│
├── supabase-schema-mvp.sql     # Database schema & RLS policies
├── package.json                # Root package (monorepo)
├── vercel.json                 # Main Vercel config
├── next.config.js              # Next.js config (legacy)
└── README.md                   # This file

Getting Started

Prerequisites

  • Node.js 16+ and npm
  • Git for version control
  • Accounts required:
    • Clerk (authentication)
    • Supabase (database)
    • Facebook Developer App
    • Groq (free tier available)

Installation

1. Clone the repository

git clone https://github.com/yourusername/repugate.git
cd repugate

2. Install frontend dependencies

cd frontend
npm install
cd ..

3. Install backend dependencies

cd backend
npm install
cd ..

4. Setup environment variables

Frontend (frontend/.env.local):

REACT_APP_API_URL=http://localhost:5000/api
REACT_APP_CLERK_PUBLISHABLE_KEY=your_clerk_key

Backend (backend/.env):

PORT=5000
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_KEY=your_supabase_service_key
GROQ_API_KEY=your_groq_api_key
FACEBOOK_APP_ID=your_facebook_app_id
FACEBOOK_APP_SECRET=your_facebook_app_secret
NODE_ENV=development

5. Database setup

Create tables in Supabase (run the SQL from supabase-schema-mvp.sql):

# Copy contents of supabase-schema-mvp.sql and paste in Supabase SQL Editor

Running Locally

Terminal 1 - Backend:

cd backend
npm run dev
# Runs on http://localhost:5000

Terminal 2 - Frontend:

cd frontend
npm start
# Runs on http://localhost:3000

Visit http://localhost:3000 in your browser.


Deployment

Vercel Setup

This app is deployed as two separate Vercel projects:

  1. Frontend: repugate.vercel.app
  2. Backend: repugatebackend.vercel.app

Frontend Deployment

# Push to GitHub (main branch auto-deploys)
git push origin main

# Or deploy directly
vercel deploy --prod

Environment variables in Vercel:

  • REACT_APP_API_URL=https://repugatebackend.vercel.app/api
  • REACT_APP_CLERK_PUBLISHABLE_KEY=<your_key>

Backend Deployment

cd backend
vercel deploy --prod

Environment variables in Vercel:

  • SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_KEY
  • GROQ_API_KEY
  • FACEBOOK_APP_ID, FACEBOOK_APP_SECRET
  • NODE_ENV=production

Database Deployment

Supabase is cloud-hosted. To apply schema changes:

  1. Open Supabase Dashboard
  2. Go to SQL Editor
  3. Paste and run the contents of supabase-schema-mvp.sql

To enable Row-Level Security (RLS):

ALTER TABLE reviews ENABLE ROW LEVEL SECURITY;
ALTER TABLE generated_replies ENABLE ROW LEVEL SECURITY;
-- (See supabase-schema-mvp.sql for all policies)

Features & How They Work

🤖 AI Reply Generation

How it works:

  1. User selects a review from the list
  2. Dashboard displays review contents
  3. User selects language (English or Bangla)
  4. Backend sends review to Groq API with prompt template
  5. Groq generates 3 reply options in ~5-10 seconds
  6. User picks best reply, can edit, then copy to Facebook

Prompt Engineering:

  • Different prompts for positive (4-5 star) vs negative reviews
  • Tone options: professional, casual, empathetic, humorous
  • Safety checks ensure compliance with Facebook policies
  • Multi-language templates for consistent quality

API Endpoint:

POST /api/replies/generate
Body: {
  review_id: string,
  review_text: string,
  rating: number,
  language: 'english' | 'bangla',
  tone: 'professional' | 'casual' | 'empathetic' | 'humorous'
}
Response: {
  replies: [string, string, string]
}

📊 Review Management

Features:

  • Real-time sync with Facebook Graph API
  • Review filtering: by rating, platform, language
  • Search & sort capabilities
  • Review prioritization (high-impact reviews recommended first)
  • Keyboard shortcuts for power users

Smart Prioritization:

  • Low ratings (1-2 stars) prioritized as reputation risk
  • High ratings (4-5 stars) marked for loyalty building
  • Recent reviews prioritized over old ones
  • Unanswered reviews flagged first

🔐 Security & Authentication

User Authentication:

  • OAuth via Clerk (social login: Google, Facebook, etc.)
  • JWT tokens stored in localStorage
  • Auto-logout after 24 hours inactivity

Data Security:

  • All API calls require valid JWT
  • Facebook access tokens never stored
  • Row-Level Security (RLS) on all tables
  • Users can only see their own reviews/data
  • HTTPS-only communication

Compliance:

  • GDPR ready (data erasure on account deletion)
  • Facebook ToS compliant
  • No data sharing with third parties
  • Privacy policy inline in app

🌍 Multi-Language Support

Supported languages:

  1. English - Professional, international standard
  2. Bangla (Bengali) - Native for South Asian markets

Implementation:

  • User selects language before generating reply
  • Backend uses language-specific prompts
  • Groq API configured for multi-language output
  • Character encoding: UTF-8 for Bangla support

📈 Activity Logging

All user actions logged for analytics:

  • Review imported: X reviews fetched from Facebook
  • Reply generated: 3 options created
  • Reply published: Reply copied to Facebook
  • Feature usage: Guided tour viewed, keyboard shortcuts used

Endpoint:

POST /api/activity/log
Body: {
  action: string,
  details: object,
  status: 'success' | 'error'
}

API Documentation

Base URL

  • Development: http://localhost:5000/api
  • Production: https://repugatebackend.vercel.app/api

Authentication

All endpoints (except /auth/login) require:

Header: x-auth-token: <jwt_token>

Endpoints

Reviews

GET /reviews/fetch

  • Fetch reviews from Facebook for current user's page
  • Query: limit=20&pageId=<page_id>
  • Returns: { success: boolean, reviews: Review[], count: number }

GET /reviews/list

  • Get all reviews for user (from Supabase cache)
  • Returns: Review[]

POST /reviews/save

  • Save reviews to database
  • Body: { pageId: string, reviews: Review[] }

Replies

POST /replies/generate

  • Generate 3 AI reply options
  • Body:
    {
      "review_text": "Great service!",
      "rating": 5,
      "language": "english",
      "tone": "professional"
    }
  • Returns: { replies: [string, string, string] }

GET /replies/list

  • Get all generated replies for user
  • Returns: Reply[]

POST /replies/save

  • Save generated reply to database
  • Body: { review_id: string, text: string }

Providers (Facebook/Google)

GET /providers/facebook/reviews

  • Fetch real reviews from Facebook Graph API
  • Headers: x-facebook-token: <user_facebook_token>
  • Query: pageId=<page_id>&limit=20

POST /providers/register-user

  • Register or sync user with their Facebook page
  • Body: { userId: string, pageId: string, pageName: string }

Activity

POST /activity/log

  • Log user action for analytics
  • Body:
    {
      "action": "review_fetched",
      "details": { "count": 15 },
      "status": "success"
    }

Database Schema

Tables

users

id (UUID, primary key)
clerk_id (text, unique)
email (text)
name (text)
avatar_url (text)
created_at (timestamp)
updated_at (timestamp)

facebook_pages

id (UUID, primary key)
user_id (UUID, foreign key → users)
page_id (text, Facebook page ID)
page_name (text)
page_picture_url (text)
access_token (text encrypted)
created_at (timestamp)
updated_at (timestamp)

reviews

id (UUID, primary key)
user_id (UUID, foreign key → users)
page_id (text)
reviewer_name (text)
reviewer_avatar (text)
rating (integer, 1-5)
text (text)
platform_source (text: 'facebook', 'google', 'local')
facebook_review_id (text)
published_at (timestamp)
created_at (timestamp)
has_reply (boolean)

generated_replies

id (UUID, primary key)
user_id (UUID, foreign key → users)
review_id (UUID, foreign key → reviews)
reply_text (text)
language (text: 'english', 'bangla')
model (text: 'groq', 'openai')
created_at (timestamp)
is_published (boolean)

activity_logs

id (UUID, primary key)
user_id (UUID, foreign key → users)
action (text)
details (jsonb)
status (text: 'success', 'error')
error_message (text, nullable)
created_at (timestamp)

Row-Level Security (RLS)

All tables have RLS enabled with policies:

  • Users can only view/edit their own data
  • Service role can bypass RLS (for admin operations)

Example policy:

CREATE POLICY "Users can view own reviews"
  ON reviews FOR SELECT
  USING (auth.uid() = user_id);

See supabase-schema-mvp.sql for complete RLS configuration.


Security

Best Practices Implemented

✅ Authentication

  • OAuth via Clerk (no password management)
  • JWT tokens for API authentication
  • Auto-logout on inactivity

✅ Data Protection

  • Supabase Row-Level Security (RLS) on all tables
  • Users isolated to only their own data
  • HTTPS/TLS for all communications

✅ API Security

  • Helmet.js for security headers
  • CORS restriction to trusted origins
  • Request validation and sanitization
  • Rate limiting (TODO: implement)

✅ Facebook Integration

  • Access tokens never stored in logs
  • Graph API v25.0 (latest stable)
  • Minimal required permissions

✅ Code Security

  • No hardcoded secrets
  • Environment variables for all sensitive data
  • Regular dependency updates
  • Code reviews before deployment

Environment Variable Security

Never commit .env files! Use .env.example:

# Commit this file (no secrets)
cp backend/.env.example backend/.env

# Edit with real values
nano backend/.env

Contributing

Getting Help

  • Issues: Open a GitHub issue for bugs or feature requests
  • Documentation: Check inline code comments and this README
  • Community: [Join Slack/Discord for discussions]

Development Workflow

  1. Create feature branch: git checkout -b feature/my-feature
  2. Make changes and test locally
  3. Run linter: npm run lint
  4. Commit: git commit -m "feat: add new feature"
  5. Push: git push origin feature/my-feature
  6. Create Pull Request with description

Code Style

  • Frontend: React hooks, functional components, Tailwind CSS
  • Backend: Express.js, async/await, meaningful variable names
  • General: ESLint rules enforced, 2-space indentation

Testing

# Frontend tests
cd frontend && npm test

# Backend tests
cd backend && npm test

Roadmap

Short Term (v1.1)

  • Rate limiting for API endpoints
  • Email notifications for low ratings
  • Reply templates/drafts
  • Bulk reply management
  • Mobile app (React Native)

Medium Term (v1.2-1.3)

  • Google Reviews integration
  • Instagram Business integration
  • Sentiment analysis dashboard
  • Automated reply scheduling
  • Team collaboration features

Long Term (v2.0)

  • Multi-business support
  • Advanced analytics & reporting
  • Custom AI model training
  • API for third-party integrations
  • Self-hosted option

License

MIT License - See LICENSE file for details


Support

Website: https://repugate.vercel.app
Email: support@repugate.com
GitHub Issues: https://github.com/yourusername/repugate/issues


Built with ❤️ by the RepuGate team

Quick Start

  1. Clone the repository

    git clone <repo-url>
    cd passive
  2. Install dependencies

    # Install root dependencies
    npm install
    
    # Install frontend
    cd frontend && npm install
    
    # Install backend
    cd ../backend && npm install
  3. Set up environment variables

    • Copy .env.local to root directory
    • Copy frontend/.env.example to frontend/.env
    • Copy backend/.env.example to backend/.env
    • Add your API keys (Groq for AI, Facebook for OAuth)
  4. Start the app

    # Terminal 1: Backend (http://localhost:5000)
    cd backend && npm start
    
    # Terminal 2: Frontend (http://localhost:3000)
    cd frontend && npm start
  5. Visit http://localhost:3000 and click "Get Started"


📸 Screenshots

Landing Page

[Screenshot of hero section with scroll effects]

Dashboard

[Screenshot of review management interface]

Reply Generation

[Screenshot of AI reply options with language selector]


🛠️ Tech Stack

Frontend:

  • React 18 with Tailwind CSS
  • Framer Motion for smooth animations
  • React Router for navigation
  • Lucide icons for clean UI

Backend:

  • Node.js + Express server
  • SQLite database
  • Groq API for AI generation
  • Facebook Graph API integration
  • Clerk for authentication

DevOps:

  • GitHub Actions for CI/CD
  • Environment-based configuration
  • Session persistence with sessionStorage

📖 How It Works

  1. Connect - Sign in with your Facebook Business Page
  2. Load - Fetch all recent reviews from your page
  3. Generate - Choose a review and select your language
  4. Get Options - AI creates 3 professional reply options
  5. Copy - Copy your favorite reply to clipboard
  6. Post - Paste it directly on Facebook

🎨 User Experience

  • Lightning Fast - Get AI replies in seconds
  • No Friction - Copy-to-clipboard workflow (no API posting complications)
  • Beautiful Design - Dark theme with gradients and smooth transitions
  • Mobile Friendly - Responsive design works on all devices
  • Stay Logged In - Sessions persist across browser refreshes

🔑 API Integrations

Facebook Graph API

  • OAuth 2.0 authentication
  • Review fetching with pagination
  • Multi-page support

Groq AI API

  • Fast, efficient LLM for reply generation
  • Multi-language support
  • Context-aware business replies

Clerk Authentication

  • Secure user management
  • One-click signup/login
  • Session management

⚙️ Configuration

Environment Variables (.env.local)

# Facebook
FACEBOOK_APP_ID=your_app_id
FACEBOOK_APP_SECRET=your_app_secret

# Groq API
GROQ_API_KEY=your_groq_key
GROQ_MODEL=llama-3.1-8b-instant

# Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key
CLERK_SECRET_KEY=your_clerk_secret

📝 License

MIT License - feel free to use and modify


🤝 Support

Have questions? Issues? Suggestions?

  • Open an issue on GitHub
  • Check existing documentation
  • Review the FAQ

🎉 Credits

Built with ❤️ for business owners who care about their reputation.


Made with Framer Motion, Tailwind CSS, and AI. Simplifying business communication, one review at a time.