Skip to content

rajpratham1/SocialAI

Repository files navigation

SocialAI — Web Dashboard Simulation

📢 IMPORTANT NOTICE: This website is a full, final working application. The dashboard, UI, authentication, database, and AI integrations are all completely operational for simulation and management purposes. However, to actually publish posts to the live internet, you need to download the source code and put your own Meta Developer API keys (and API keys for other platforms like Twitter/LinkedIn) to use the real posting service of this website.

SocialAI is a modern social media management dashboard built with a Javascript frontend (connected to Firebase) and a Python Flask backend (connected to Google Gemini AI).


🚀 Quick Start (Local Development)

1 — Configure Firebase & Gemini Keys

You must have a .env.local file in the root directory containing your API keys:

VITE_FIREBASE_API_KEY=your-firebase-key
VITE_FIREBASE_AUTH_DOMAIN=your-firebase-domain
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-storage-bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id
GEMINI_API_KEY=your-gemini-key

2 — Install Python (3.9+)

Make sure Python is installed:

python --version

3 — Create virtual environment & install dependencies

# Windows
python -m venv venv
venv\Scripts\activate

# macOS / Linux
python3 -m venv venv
source venv/bin/activate

# Install packages
pip install -r requirements.txt

4 — Run the server

python app.py

Open http://localhost:5000 in your browser. The backend will serve the frontend UI and act as a secure proxy for the AI features.


🏗️ Architecture

  1. Frontend (static/index.html)

    • Built with Vanilla JS and CSS.
    • Connected directly to Firebase Authentication for user login.
    • Connected directly to Firebase Firestore for persistent data storage (Posts, Accounts, Notifications, Suggestions).
    • "Mock" posts are saved to the database. Real OAuth integration requires Meta Graph APIs.
  2. Backend AI Proxy (app.py & routes/ai.py)

    • Python Flask acts as a secure intermediary for Google Gemini AI.
    • Handles requests for /api/ai/suggest, /api/ai/caption, /api/ai/hashtags, and /api/ai/timing.
    • Protects the GEMINI_API_KEY from being exposed to the client browser.
  3. Legacy REST API

    • The backend contains a fully functioning SQLite REST API (/api/posts, /api/accounts, etc.) which was part of the original template. The frontend now bypasses this in favor of real-time Firebase syncing, but it remains available for local testing independent of Firebase.

🔐 Security & Database Rules

Since the frontend interacts directly with Firebase, all data security is handled via Firestore Rules. The active rules ensure that users can only read, create, update, and delete their own private data (userId == request.auth.uid).

Ensure your firebase.rules are deployed accurately in your Firebase Console.


S O C I A L _ A I

About

Complete REST API backend for the SocialAI Social Media Management App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages