From f9710b620e83f586c97eba0ea29f0ac62a499897 Mon Sep 17 00:00:00 2001 From: Saahi30 Date: Sun, 16 Nov 2025 20:45:39 +0530 Subject: [PATCH 1/2] DOCS:updated docs --- README.md | 828 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 700 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index a22858c..427c616 100644 --- a/README.md +++ b/README.md @@ -4,213 +4,624 @@ Inpact is an open-source AI-powered platform designed to connect content creators, brands, and agencies through data-driven insights. By leveraging Generative AI (GenAI), audience analytics, and engagement metrics, Inpact ensures highly relevant sponsorship opportunities for creators while maximizing ROI for brands investing in influencer marketing. -## Features +--- -### AI-Driven Sponsorship Matchmaking +## 📋 Table of Contents + +- [Features](#features) +- [Tech Stack](#tech-stack) +- [Project Structure](#project-structure) +- [Prerequisites](#prerequisites) +- [Installation & Setup](#installation--setup) + - [1. Clone the Repository](#1-clone-the-repository) + - [2. Frontend Setup](#2-frontend-setup) + - [3. Backend Setup](#3-backend-setup) + - [4. Database Setup](#4-database-setup) + - [5. Environment Variables](#5-environment-variables) +- [Running the Application](#running-the-application) +- [API Documentation](#api-documentation) +- [Usage Guide](#usage-guide) +- [Project Workflow](#project-workflow) +- [Troubleshooting](#troubleshooting) +- [Contributing](#contributing) +- [Contact](#contact) -- Automatically connects creators with brands based on audience demographics, engagement rates, and content style. +--- -### AI-Powered Creator Collaboration Hub +## ✨ Features + +### AI-Driven Sponsorship Matchmaking +- Automatically connects creators with brands based on audience demographics, engagement rates, and content style +- Real-time matching algorithm powered by AI +- Personalized recommendations for both creators and brands -- Facilitates partnerships between creators with complementary audiences and content niches. +### AI-Powered Creator Collaboration Hub +- Facilitates partnerships between creators with complementary audiences and content niches +- AI-suggested collaboration ideas based on audience overlap +- Joint campaign planning and execution tools ### AI-Based Pricing & Deal Optimization - -- Provides fair sponsorship pricing recommendations based on engagement, market trends, and historical data. +- Provides fair sponsorship pricing recommendations based on engagement, market trends, and historical data +- Dynamic pricing suggestions for different campaign types +- Budget optimization for brands ### AI-Powered Negotiation & Contract Assistant - -- Assists in structuring deals, generating contracts, and optimizing terms using AI insights. +- Assists in structuring deals, generating contracts, and optimizing terms using AI insights +- Automated contract generation with customizable templates +- Smart negotiation suggestions ### Performance Analytics & ROI Tracking +- Enables brands and creators to track sponsorship performance, audience engagement, and campaign success +- Real-time analytics dashboards +- AI-powered insights and recommendations for future campaigns +- Screenshot extraction and metric tracking using Gemini Vision API -- Enables brands and creators to track sponsorship performance, audience engagement, and campaign success. +### Campaign Management +- Full lifecycle campaign management for brands +- Creator proposal system with status tracking +- Deliverable tracking and metric submission +- Contract management and signing workflow -## Tech Stack +--- -- **Frontend**: ReactJS -- **Backend**: FastAPI -- **Database**: Supabase -- **AI Integration**: GenAI for audience analysis and sponsorship recommendations +## 🛠 Tech Stack + +### Frontend +- **Framework**: Next.js 16.0.1 (React 19.2.0) +- **Language**: TypeScript +- **Styling**: Tailwind CSS 4 +- **State Management**: Zustand +- **Data Fetching**: TanStack React Query, Axios +- **Forms**: React Hook Form with Zod validation +- **Animations**: Framer Motion +- **Charts**: Recharts +- **Authentication**: Supabase Auth +- **Icons**: Lucide React + +### Backend +- **Framework**: FastAPI 0.120.3 +- **Language**: Python 3.13+ +- **Database**: Supabase (PostgreSQL) +- **Authentication**: Supabase Auth with JWT +- **AI Integration**: + - Groq API (for text generation) + - Google Gemini API (for content generation and vision tasks) +- **Server**: Uvicorn +- **Validation**: Pydantic + +### Database & Services +- **Database**: Supabase PostgreSQL +- **Authentication**: Supabase Auth +- **Storage**: Supabase Storage (for images and files) +- **Real-time**: Supabase Realtime (for live updates) --- -## Workflow +## 📁 Project Structure -### 1. User Registration & Profile Setup +``` +InPactAI/ +├── frontend/ # Next.js frontend application +│ ├── app/ # Next.js App Router +│ │ ├── brand/ # Brand-specific pages +│ │ │ ├── analytics/ # Analytics dashboard +│ │ │ ├── campaigns/ # Campaign management +│ │ │ ├── contracts/ # Contract management +│ │ │ ├── home/ # Brand dashboard +│ │ │ ├── onboarding/ # Brand onboarding flow +│ │ │ └── proposals/ # Proposal management +│ │ ├── creator/ # Creator-specific pages +│ │ │ ├── analytics/ # Creator analytics +│ │ │ ├── collaborations/ # Collaboration hub +│ │ │ ├── contracts/ # Contract management +│ │ │ ├── home/ # Creator dashboard +│ │ │ ├── onboarding/ # Creator onboarding flow +│ │ │ └── proposals/ # Proposal applications +│ │ ├── login/ # Login page +│ │ ├── signup/ # Signup page +│ │ └── layout.tsx # Root layout +│ ├── components/ # Reusable React components +│ │ ├── analytics/ # Analytics components +│ │ ├── auth/ # Authentication components +│ │ ├── contracts/ # Contract components +│ │ ├── dashboard/ # Dashboard components +│ │ └── onboarding/ # Onboarding components +│ ├── lib/ # Utility libraries +│ │ ├── api/ # API client functions +│ │ ├── auth-helpers.ts # Auth utilities +│ │ ├── campaignApi.ts # Campaign API client +│ │ ├── geminiApi.ts # Gemini API client +│ │ └── supabaseClient.ts # Supabase client +│ ├── types/ # TypeScript type definitions +│ ├── public/ # Static assets +│ ├── package.json # Frontend dependencies +│ └── next.config.ts # Next.js configuration +│ +├── backend/ # FastAPI backend application +│ ├── app/ # Main application code +│ │ ├── api/ # API routes +│ │ │ └── routes/ # Route handlers +│ │ │ ├── analytics.py # Analytics endpoints +│ │ │ ├── auth.py # Authentication endpoints +│ │ │ ├── campaigns.py # Campaign endpoints +│ │ │ ├── collaborations.py # Collaboration endpoints +│ │ │ ├── creators.py # Creator endpoints +│ │ │ ├── gemini_generate.py # Gemini AI endpoints +│ │ │ ├── groq_generate.py # Groq AI endpoints +│ │ │ ├── health.py # Health check endpoints +│ │ │ └── proposals.py # Proposal endpoints +│ │ ├── core/ # Core application logic +│ │ │ ├── config.py # Configuration settings +│ │ │ ├── dependencies.py # FastAPI dependencies +│ │ │ ├── security.py # Security utilities +│ │ │ └── supabase_clients.py # Supabase clients +│ │ ├── db/ # Database utilities +│ │ ├── models/ # Pydantic models +│ │ ├── services/ # Business logic services +│ │ └── main.py # FastAPI application entry point +│ ├── requirements.txt # Python dependencies +│ └── env_example # Environment variables example +│ +├── docs/ # Documentation +│ └── database/ # Database schema documentation +│ +├── guides/ # Implementation guides +│ └── summaries/ # Feature implementation summaries +│ +└── README.md # This file +``` -- Creators, brands, and agencies sign up and set up their profiles. -- AI gathers audience insights and engagement data. +--- -### 2. AI-Powered Sponsorship Matchmaking +## 📋 Prerequisites -- The platform suggests brands and sponsorship deals based on audience metrics. -- Creators can apply for sponsorships or receive brand invitations. +Before you begin, ensure you have the following installed on your system: -### 3. Collaboration Hub +### Required Software +- **Node.js** (v18 or higher) - [Download](https://nodejs.org/) +- **npm** (comes with Node.js) or **yarn** +- **Python** (3.11 or higher) - [Download](https://www.python.org/downloads/) +- **pip** (Python package manager) +- **Git** - [Download](https://git-scm.com/downloads) -- Creators can find and connect with others for joint campaigns. -- AI recommends potential collaborations based on niche and audience overlap. +### Required Accounts & API Keys +- **Supabase Account** - [Sign up](https://supabase.com/) +- **Groq API Key** (for AI features) - [Get API Key](https://console.groq.com/) +- **Google Gemini API Key** (for AI features) - [Get API Key](https://makersuite.google.com/app/apikey) -### 4. AI-Based Pricing & Contract Optimization +### Recommended Tools +- **VS Code** or any modern code editor +- **Postman** or **Insomnia** (for API testing) +- **Supabase CLI** (optional, for local development) -- AI provides fair pricing recommendations for sponsorships. -- Auto-generates contract templates with optimized terms. +--- -### 5. Campaign Execution & Tracking +## 🚀 Installation & Setup -- Creators execute sponsorship campaigns. -- Brands track campaign performance through engagement and ROI metrics. +### 1. Clone the Repository -### 6. Performance Analysis & Continuous Optimization +```bash +git clone https://github.com/AOSSIE-Org/InPact.git +cd InPact +``` -- AI analyzes campaign success and suggests improvements for future deals. -- Brands and creators receive insights for optimizing future sponsorships. +### 2. Frontend Setup ---- +#### Step 1: Navigate to Frontend Directory -## Getting Started +```bash +cd frontend +``` -### Prerequisites +#### Step 2: Install Dependencies -Ensure you have the following installed: +```bash +npm install +``` -- Node.js & npm -- Python & FastAPI -- Supabase account +This will install all required packages listed in `package.json`. -### Installation +#### Step 3: Create Environment File -#### 1. Clone the repository +Create a `.env.local` file in the `frontend` directory: -```sh -git clone https://github.com/AOSSIE-Org/InPact.git -cd inpact +```bash +touch .env.local ``` -#### 2. Frontend Setup +#### Step 4: Configure Environment Variables -1. Navigate to the frontend directory: +Add the following variables to `.env.local`: -```sh -cd frontend -``` - -2. Install dependencies: +```env +# Supabase Configuration +NEXT_PUBLIC_SUPABASE_URL=your-supabase-project-url +NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key -```sh -npm install +# Backend API URL +NEXT_PUBLIC_API_URL=http://localhost:8000 ``` -3. Create a `.env` file using `.env.example` at the frontend root: +**How to get Supabase credentials:** +1. Go to [Supabase Dashboard](https://app.supabase.com/) +2. Log in and create a new project (or select an existing one) +3. Navigate to **Project Settings** → **API** +4. Copy the **Project URL** and paste it as `NEXT_PUBLIC_SUPABASE_URL` +5. Copy the **anon public** key and paste it as `NEXT_PUBLIC_SUPABASE_ANON_KEY` -4. Get your Supabase credentials: - - Go to [Supabase](https://supabase.com/) - - Log in and create a new project (or use existing) - - Go to Project Settings -> API - - Copy the "Project URL" and paste it as VITE_SUPABASE_URL - - Copy the "anon public" key and paste it as VITE_SUPABASE_ANON_KEY +> **Important**: For production, ensure `NEXT_PUBLIC_API_URL` uses HTTPS. -#### 3. Backend Setup +### 3. Backend Setup -1. Navigate to the backend directory: +#### Step 1: Navigate to Backend Directory -```sh +```bash cd ../backend ``` -2. Install dependencies: +#### Step 2: Create Virtual Environment (Recommended) + +```bash +# Create virtual environment +python -m venv venv + +# Activate virtual environment +# On macOS/Linux: +source venv/bin/activate +# On Windows: +# venv\Scripts\activate +``` + +#### Step 3: Install Dependencies -```sh +```bash pip install -r requirements.txt ``` -3. Navigate to the app directory: +#### Step 4: Navigate to App Directory -```sh +```bash cd app ``` -4. Create a `.env` file using `.env.example` as a reference. - -5. Obtain Supabase credentials: - - Go to [Supabase](https://supabase.com/) - - Log in and create a new project - - Click on the project and remember the project password - - Go to the **Connect** section at the top - - Select **SQLAlchemy** and copy the connection string: - - ```sh - user=postgres - password=[YOUR-PASSWORD] - host=db.wveftanaurduixkyijhf.supabase.co - port=5432 - dbname=postgres - ``` +#### Step 5: Create Environment File + +Create a `.env` file in the `backend/app` directory: + +```bash +touch .env +``` + +#### Step 6: Configure Environment Variables + +Copy the example file and edit it: - --OR-- +```bash +cp ../env_example .env +``` + +Edit `.env` with your credentials: + +```env +# Supabase Configuration (Required) +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_KEY=your-supabase-anon-key-here +SUPABASE_SERVICE_KEY=your-service-role-key + +# Database Configuration (Optional - for direct PostgreSQL connection) +DATABASE_URL=postgresql://postgres.your-project-ref:[YOUR-PASSWORD]@aws-0-region.pooler.supabase.com:6543/postgres + +# AI Configuration (Optional) +GROQ_API_KEY=your-groq-api-key +GEMINI_API_KEY=your-gemini-api-key-here - [The above works in ipv6 networks, if you are in ipv4 network or it cause errors, use the below connection string which could be found in Session Pooler connection] +# CORS Origins (comma-separated) +ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001 - ```sh - user=postgres. - password=[YOUR-PASSWORD] - host=aws-.pooler.supabase.com - port=5432 - dbname=postgres +# JWT Secret Key from Supabase +# Location: Dashboard → Project Settings → API → JWT Settings → JWT Secret +SUPABASE_JWT_SECRET=your-jwt-secret-from-supabase-dashboard +``` + +**How to get Supabase credentials:** + +1. **Supabase URL & Keys:** + - Go to **Project Settings** → **API** + - Copy **Project URL** → `SUPABASE_URL` + - Copy **anon public** key → `SUPABASE_KEY` + - Copy **service_role** key → `SUPABASE_SERVICE_KEY` (keep this secret!) + +2. **Database URL (Optional):** + - Go to **Project Settings** → **Database** + - Under **Connection string**, select **URI** or **Session Pooler** + - For IPv6 networks, use the direct connection: + ``` + postgresql://postgres:[YOUR-PASSWORD]@db.xxxxx.supabase.co:5432/postgres + ``` + - For IPv4 networks or if you encounter connection issues, use the Session Pooler: + ``` + postgresql://postgres.xxxxx:[YOUR-PASSWORD]@aws-0-region.pooler.supabase.com:6543/postgres ``` -6. Get the Groq API key: - - Visit [Groq Console](https://console.groq.com/) - - Create an API key and paste it into the `.env` file +3. **JWT Secret:** + - Go to **Project Settings** → **API** → **JWT Settings** + - Copy the **JWT Secret** (NOT the anon key!) -#### 4. Start Development Servers +4. **AI API Keys:** + - **Groq**: Visit [Groq Console](https://console.groq.com/) → Create API key + - **Gemini**: Visit [Google AI Studio](https://makersuite.google.com/app/apikey) → Create API key -1. Start the frontend server (from the frontend directory): +### 4. Database Setup -```sh -npm run dev +#### Step 1: Set Up Database Schema + +1. **Open Supabase Dashboard** + - Go to [Supabase Dashboard](https://app.supabase.com/) + - Select your project + +2. **Access SQL Editor** + - In the left sidebar, click on **SQL Editor** + +3. **Run Schema Script** + - The database schema is located in `backend/SQL` + - Copy the contents of the SQL file + - Paste into the SQL Editor + - Click **Run** to execute + + > **Note**: The schema file contains table definitions and ENUM types. Make sure to run it in the correct order. + +#### Step 2: Verify Tables + +After running the schema, verify that the following tables exist: +- `profiles` +- `brands` +- `creators` +- `campaigns` +- `proposals` +- `contracts` +- `collaborations` +- `campaign_deliverables` +- `campaign_metrics` +- And other related tables + +#### Step 3: Add Onboarding Column (if needed) + +If the `profiles` table doesn't have the `onboarding_completed` column, run: + +```sql +ALTER TABLE profiles +ADD COLUMN IF NOT EXISTS onboarding_completed BOOLEAN DEFAULT FALSE; ``` -2. Start the backend server (from the backend/app directory): +### 5. Environment Variables + +#### Frontend Environment Variables (`.env.local`) + +| Variable | Description | Required | Example | +|----------|-------------|----------|---------| +| `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL | Yes | `https://xxxxx.supabase.co` | +| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase anon/public key | Yes | `eyJhbGc...` | +| `NEXT_PUBLIC_API_URL` | Backend API URL | Yes | `http://localhost:8000` | + +#### Backend Environment Variables (`.env`) + +| Variable | Description | Required | Example | +|----------|-------------|----------|---------| +| `SUPABASE_URL` | Supabase project URL | Yes | `https://xxxxx.supabase.co` | +| `SUPABASE_KEY` | Supabase anon key | Yes | `eyJhbGc...` | +| `SUPABASE_SERVICE_KEY` | Supabase service role key | Yes | `eyJhbGc...` | +| `SUPABASE_JWT_SECRET` | JWT secret from Supabase | Yes | `your-jwt-secret` | +| `DATABASE_URL` | PostgreSQL connection string | No | `postgresql://...` | +| `GROQ_API_KEY` | Groq API key for AI | No | `gsk_xxxxx` | +| `GEMINI_API_KEY` | Gemini API key for AI | No | `AIzaSy...` | +| `ALLOWED_ORIGINS` | CORS allowed origins | No | `http://localhost:3000` | + +--- + +## 🏃 Running the Application + +### Development Mode + +#### Start Backend Server + +1. Navigate to the backend app directory: + ```bash + cd backend/app + ``` + +2. Activate virtual environment (if using one): + ```bash + source ../venv/bin/activate # macOS/Linux + # or + venv\Scripts\activate # Windows + ``` + +3. Start the FastAPI server: + ```bash + uvicorn main:app --reload + ``` + + The backend will be available at: `http://localhost:8000` + + - API Documentation: `http://localhost:8000/docs` (Swagger UI) + - Alternative Docs: `http://localhost:8000/redoc` (ReDoc) -```sh -uvicorn main:app --reload +#### Start Frontend Server + +1. Navigate to the frontend directory: + ```bash + cd frontend + ``` + +2. Start the Next.js development server: + ```bash +npm run dev ``` -## Data Population + The frontend will be available at: `http://localhost:3000` -To populate the database with initial data, follow these steps: +### Production Build -1. **Open Supabase Dashboard** - - Go to [Supabase](https://supabase.com/) and log in. - - Select your created project. +#### Build Frontend -2. **Access the SQL Editor** - - In the left sidebar, click on **SQL Editor**. +```bash +cd frontend +npm run build +npm start +``` -3. **Run the SQL Script** - - Open the `sql.txt` file in your project. - - Copy the SQL queries from the file. - - Paste the queries into the SQL Editor and click **Run**. +#### Build Backend -This will populate the database with the required initial data for the platform. 🚀 +```bash +cd backend/app +uvicorn main:app --host 0.0.0.0 --port 8000 +``` --- -## Contributing +## 📚 API Documentation + +### Base URL +- **Development**: `http://localhost:8000` +- **Production**: Your production backend URL + +### Main API Endpoints + +#### Authentication +- `POST /api/auth/signup` - User registration +- `POST /api/auth/login` - User login +- `GET /api/auth/me` - Get current user profile + +#### Campaigns +- `GET /campaigns` - List campaigns (with filters) +- `POST /campaigns` - Create new campaign +- `GET /campaigns/{campaign_id}` - Get campaign details +- `PUT /campaigns/{campaign_id}` - Update campaign +- `DELETE /campaigns/{campaign_id}` - Delete campaign + +#### Proposals +- `GET /proposals` - List proposals +- `POST /proposals` - Create proposal +- `GET /proposals/{proposal_id}` - Get proposal details +- `PUT /proposals/{proposal_id}` - Update proposal +- `DELETE /proposals/{proposal_id}` - Delete proposal +- `POST /proposals/{proposal_id}/accept` - Accept proposal +- `POST /proposals/{proposal_id}/reject` - Reject proposal + +#### Contracts +- `GET /contracts` - List contracts +- `GET /contracts/{contract_id}` - Get contract details +- `POST /contracts` - Create contract +- `PUT /contracts/{contract_id}` - Update contract + +#### Collaborations +- `GET /collaborations` - List collaborations +- `POST /collaborations` - Create collaboration +- `GET /collaborations/{collaboration_id}` - Get collaboration details + +#### Creators +- `GET /creators` - List creators (with search/filters) +- `GET /creators/{creator_id}` - Get creator profile + +#### Analytics +- `GET /analytics/campaigns/{campaign_id}` - Get campaign analytics +- `POST /analytics/metrics` - Create metric +- `POST /analytics/metrics/{metric_id}/submit` - Submit metric value +- `POST /analytics/screenshots/extract` - Extract metrics from screenshot + +#### AI Generation +- `POST /api/groq/generate` - Generate content using Groq +- `POST /api/gemini/generate` - Generate content using Gemini + +#### Health Check +- `GET /health` - Health check endpoint +- `GET /health/supabase` - Supabase connection check -We welcome contributions from the community! To contribute: +### Interactive API Documentation -1. Fork the repository. -2. Create a new branch for your feature (`git checkout -b feature-name`). -3. Commit your changes (`git commit -m "Added feature"`). -4. Push to your branch (`git push origin feature-name`). -5. Open a Pull Request. +Once the backend is running, visit: +- **Swagger UI**: `http://localhost:8000/docs` +- **ReDoc**: `http://localhost:8000/redoc` + +These provide interactive documentation where you can test endpoints directly. --- -## Overall Workflow +## 📖 Usage Guide + +### For Creators + +1. **Sign Up / Login** + - Visit the signup page and create an account + - Select "Creator" as your role + - Verify your email address + +2. **Complete Onboarding** + - Fill out your profile information + - Add your social media platforms + - Specify your niche and content types + - Upload profile picture + +3. **Browse Campaigns** + - View available sponsorship opportunities + - Filter by niche, budget, platform, etc. + - View campaign details and requirements + +4. **Apply for Sponsorships** + - Submit proposals for campaigns + - Include your pitch and portfolio + - Track application status + +5. **Manage Collaborations** + - Discover potential collaboration partners + - Send collaboration proposals + - Manage active collaborations + +6. **Track Performance** + - View analytics for your campaigns + - Submit deliverables and metrics + - Monitor engagement and ROI + +### For Brands + +1. **Sign Up / Login** + - Create a brand account + - Select "Brand" as your role + - Verify your email + +2. **Complete Onboarding** + - Add company information + - Define target audience + - Set marketing goals and budget + - Upload brand assets + +3. **Create Campaigns** + - Create new sponsorship campaigns + - Define deliverables and requirements + - Set budget and timeline + - Specify preferred creator criteria + +4. **Review Proposals** + - View creator applications + - Review creator profiles and portfolios + - Accept or reject proposals + +5. **Manage Contracts** + - Generate contracts using AI + - Negotiate terms + - Track contract status + +6. **Monitor Analytics** + - View campaign performance + - Track ROI and engagement metrics + - Analyze creator submissions + - Get AI-powered insights + +--- + +## 🔄 Project Workflow + +### Overall System Workflow ```mermaid graph TD; @@ -225,7 +636,7 @@ graph TD; I -->|Feedback Loop| C; ``` -**FRONTEND workflow in detail** +### Frontend Workflow ```mermaid graph TD; @@ -241,7 +652,7 @@ graph TD; J -->|Show Performance Analytics| K[AI Optimizes Future Matches]; ``` -**BACKEND workflow in detail** +### Backend Workflow ```mermaid graph TD; @@ -260,8 +671,169 @@ graph TD; M -->|Return Insights| N[AI Refines Future Recommendations]; ``` -## Contact +--- + +## 🔧 Troubleshooting + +### Common Issues + +#### Frontend Issues + +**Issue: "Missing Supabase environment variables"** +- **Solution**: Ensure `.env.local` exists in the `frontend` directory with all required variables +- Check that variable names start with `NEXT_PUBLIC_` for client-side access + +**Issue: "NEXT_PUBLIC_API_URL is missing or not valid"** +- **Solution**: For local development, set `NEXT_PUBLIC_API_URL=http://localhost:8000` +- For production, ensure it's a valid HTTPS URL + +**Issue: Build fails with TypeScript errors** +- **Solution**: Run `npm install` to ensure all dependencies are installed +- Check that TypeScript version is compatible (v5+) + +#### Backend Issues + +**Issue: "Supabase client initialization failed"** +- **Solution**: + - Verify `SUPABASE_URL` and `SUPABASE_KEY` in `.env` + - Check that your Supabase project is active + - Ensure network connectivity to Supabase + +**Issue: "JWT verification failed"** +- **Solution**: + - Verify `SUPABASE_JWT_SECRET` matches the JWT Secret in Supabase dashboard + - Ensure you're using the JWT Secret, not the anon key + +**Issue: Database connection errors** +- **Solution**: + - Check `DATABASE_URL` format (if using direct connection) + - For IPv4 networks, use Session Pooler connection string + - Verify database password is correct + - Check Supabase project status + +**Issue: "Module not found" errors** +- **Solution**: + - Activate virtual environment: `source venv/bin/activate` + - Reinstall dependencies: `pip install -r requirements.txt` + +#### Database Issues -For queries, issues, or feature requests, please raise an issue or reach out on our Discord server. +**Issue: Tables don't exist** +- **Solution**: Run the SQL schema script in Supabase SQL Editor +- Check that all ENUM types are created before tables + +**Issue: "onboarding_completed column doesn't exist"** +- **Solution**: Run the ALTER TABLE command: + ```sql + ALTER TABLE profiles + ADD COLUMN IF NOT EXISTS onboarding_completed BOOLEAN DEFAULT FALSE; + ``` + +#### API Issues + +**Issue: CORS errors** +- **Solution**: + - Add frontend URL to `ALLOWED_ORIGINS` in backend `.env` + - Ensure backend CORS middleware is configured correctly + +**Issue: 401 Unauthorized errors** +- **Solution**: + - Verify JWT token is being sent in request headers + - Check token expiration + - Ensure user is logged in + +### Getting Help + +If you encounter issues not covered here: +1. Check the [Issues](https://github.com/AOSSIE-Org/InPact/issues) page +2. Review the documentation in the `docs/` and `guides/` directories +3. Reach out on Discord or create a new issue + +--- + +## 🤝 Contributing + +We welcome contributions from the community! Here's how you can help: + +### Contribution Process + +1. **Fork the Repository** + ```bash + git fork https://github.com/AOSSIE-Org/InPact.git + ``` + +2. **Create a Feature Branch** + ```bash + git checkout -b feature/your-feature-name + ``` + +3. **Make Your Changes** + - Write clean, documented code + - Follow existing code style + - Add tests if applicable + - Update documentation as needed + +4. **Commit Your Changes** + ```bash + git commit -m "Add: Description of your feature" + ``` + + Use clear, descriptive commit messages: + - `Add:` for new features + - `Fix:` for bug fixes + - `Update:` for updates to existing features + - `Docs:` for documentation changes + +5. **Push to Your Fork** + ```bash + git push origin feature/your-feature-name + ``` + +6. **Open a Pull Request** + - Go to the repository on GitHub + - Click "New Pull Request" + - Select your branch + - Fill out the PR template + - Submit for review + +### Code Style Guidelines + +- **Frontend**: Follow Next.js and React best practices +- **Backend**: Follow PEP 8 Python style guide +- **TypeScript**: Use strict mode, avoid `any` types +- **Comments**: Add comments for complex logic +- **Documentation**: Update README and code comments + +### Development Setup for Contributors + +1. Follow the installation steps above +2. Create a separate branch for your work +3. Test your changes thoroughly +4. Ensure all tests pass (if applicable) +5. Update relevant documentation + +--- + +## 📞 Contact + +- **GitHub Issues**: [Create an issue](https://github.com/AOSSIE-Org/InPact/issues) +- **Discord**: Join our Discord server (link in repository) +- **Email**: Contact through GitHub profile + +--- + +## 📄 License + +This project is open source. Please check the LICENSE file for details. + +--- + +## 🙏 Acknowledgments + +- Built with ❤️ by the AOSSIE community +- Powered by Supabase, Next.js, and FastAPI +- AI capabilities powered by Groq and Google Gemini + +--- -Happy Coding! +**Happy Coding! 🚀** From 0545feef9d3a78a9628c7ebfe12e5fd691b25346 Mon Sep 17 00:00:00 2001 From: Saahi30 Date: Sun, 16 Nov 2025 20:58:59 +0530 Subject: [PATCH 2/2] docs(contributing): clarify forking and branching --- README.md | 108 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 427c616..60786af 100644 --- a/README.md +++ b/README.md @@ -31,32 +31,38 @@ Inpact is an open-source AI-powered platform designed to connect content creator ## ✨ Features ### AI-Driven Sponsorship Matchmaking + - Automatically connects creators with brands based on audience demographics, engagement rates, and content style - Real-time matching algorithm powered by AI - Personalized recommendations for both creators and brands ### AI-Powered Creator Collaboration Hub + - Facilitates partnerships between creators with complementary audiences and content niches - AI-suggested collaboration ideas based on audience overlap - Joint campaign planning and execution tools ### AI-Based Pricing & Deal Optimization + - Provides fair sponsorship pricing recommendations based on engagement, market trends, and historical data - Dynamic pricing suggestions for different campaign types - Budget optimization for brands ### AI-Powered Negotiation & Contract Assistant + - Assists in structuring deals, generating contracts, and optimizing terms using AI insights - Automated contract generation with customizable templates - Smart negotiation suggestions ### Performance Analytics & ROI Tracking + - Enables brands and creators to track sponsorship performance, audience engagement, and campaign success - Real-time analytics dashboards - AI-powered insights and recommendations for future campaigns - Screenshot extraction and metric tracking using Gemini Vision API ### Campaign Management + - Full lifecycle campaign management for brands - Creator proposal system with status tracking - Deliverable tracking and metric submission @@ -67,6 +73,7 @@ Inpact is an open-source AI-powered platform designed to connect content creator ## 🛠 Tech Stack ### Frontend + - **Framework**: Next.js 16.0.1 (React 19.2.0) - **Language**: TypeScript - **Styling**: Tailwind CSS 4 @@ -79,6 +86,7 @@ Inpact is an open-source AI-powered platform designed to connect content creator - **Icons**: Lucide React ### Backend + - **Framework**: FastAPI 0.120.3 - **Language**: Python 3.13+ - **Database**: Supabase (PostgreSQL) @@ -90,6 +98,7 @@ Inpact is an open-source AI-powered platform designed to connect content creator - **Validation**: Pydantic ### Database & Services + - **Database**: Supabase PostgreSQL - **Authentication**: Supabase Auth - **Storage**: Supabase Storage (for images and files) @@ -178,6 +187,7 @@ InPactAI/ Before you begin, ensure you have the following installed on your system: ### Required Software + - **Node.js** (v18 or higher) - [Download](https://nodejs.org/) - **npm** (comes with Node.js) or **yarn** - **Python** (3.11 or higher) - [Download](https://www.python.org/downloads/) @@ -185,11 +195,13 @@ Before you begin, ensure you have the following installed on your system: - **Git** - [Download](https://git-scm.com/downloads) ### Required Accounts & API Keys + - **Supabase Account** - [Sign up](https://supabase.com/) - **Groq API Key** (for AI features) - [Get API Key](https://console.groq.com/) - **Google Gemini API Key** (for AI features) - [Get API Key](https://makersuite.google.com/app/apikey) ### Recommended Tools + - **VS Code** or any modern code editor - **Postman** or **Insomnia** (for API testing) - **Supabase CLI** (optional, for local development) @@ -243,6 +255,7 @@ NEXT_PUBLIC_API_URL=http://localhost:8000 ``` **How to get Supabase credentials:** + 1. Go to [Supabase Dashboard](https://app.supabase.com/) 2. Log in and create a new project (or select an existing one) 3. Navigate to **Project Settings** → **API** @@ -373,6 +386,7 @@ SUPABASE_JWT_SECRET=your-jwt-secret-from-supabase-dashboard #### Step 2: Verify Tables After running the schema, verify that the following tables exist: + - `profiles` - `brands` - `creators` @@ -397,24 +411,24 @@ ADD COLUMN IF NOT EXISTS onboarding_completed BOOLEAN DEFAULT FALSE; #### Frontend Environment Variables (`.env.local`) -| Variable | Description | Required | Example | -|----------|-------------|----------|---------| -| `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL | Yes | `https://xxxxx.supabase.co` | -| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase anon/public key | Yes | `eyJhbGc...` | -| `NEXT_PUBLIC_API_URL` | Backend API URL | Yes | `http://localhost:8000` | +| Variable | Description | Required | Example | +| ------------------------------- | ------------------------ | -------- | --------------------------- | +| `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL | Yes | `https://xxxxx.supabase.co` | +| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase anon/public key | Yes | `eyJhbGc...` | +| `NEXT_PUBLIC_API_URL` | Backend API URL | Yes | `http://localhost:8000` | #### Backend Environment Variables (`.env`) -| Variable | Description | Required | Example | -|----------|-------------|----------|---------| -| `SUPABASE_URL` | Supabase project URL | Yes | `https://xxxxx.supabase.co` | -| `SUPABASE_KEY` | Supabase anon key | Yes | `eyJhbGc...` | -| `SUPABASE_SERVICE_KEY` | Supabase service role key | Yes | `eyJhbGc...` | -| `SUPABASE_JWT_SECRET` | JWT secret from Supabase | Yes | `your-jwt-secret` | -| `DATABASE_URL` | PostgreSQL connection string | No | `postgresql://...` | -| `GROQ_API_KEY` | Groq API key for AI | No | `gsk_xxxxx` | -| `GEMINI_API_KEY` | Gemini API key for AI | No | `AIzaSy...` | -| `ALLOWED_ORIGINS` | CORS allowed origins | No | `http://localhost:3000` | +| Variable | Description | Required | Example | +| ---------------------- | ---------------------------- | -------- | --------------------------- | +| `SUPABASE_URL` | Supabase project URL | Yes | `https://xxxxx.supabase.co` | +| `SUPABASE_KEY` | Supabase anon key | Yes | `eyJhbGc...` | +| `SUPABASE_SERVICE_KEY` | Supabase service role key | Yes | `eyJhbGc...` | +| `SUPABASE_JWT_SECRET` | JWT secret from Supabase | Yes | `your-jwt-secret` | +| `DATABASE_URL` | PostgreSQL connection string | No | `postgresql://...` | +| `GROQ_API_KEY` | Groq API key for AI | No | `gsk_xxxxx` | +| `GEMINI_API_KEY` | Gemini API key for AI | No | `AIzaSy...` | +| `ALLOWED_ORIGINS` | CORS allowed origins | No | `http://localhost:3000` | --- @@ -425,11 +439,13 @@ ADD COLUMN IF NOT EXISTS onboarding_completed BOOLEAN DEFAULT FALSE; #### Start Backend Server 1. Navigate to the backend app directory: + ```bash cd backend/app ``` 2. Activate virtual environment (if using one): + ```bash source ../venv/bin/activate # macOS/Linux # or @@ -437,26 +453,29 @@ ADD COLUMN IF NOT EXISTS onboarding_completed BOOLEAN DEFAULT FALSE; ``` 3. Start the FastAPI server: + ```bash uvicorn main:app --reload ``` The backend will be available at: `http://localhost:8000` - - API Documentation: `http://localhost:8000/docs` (Swagger UI) - Alternative Docs: `http://localhost:8000/redoc` (ReDoc) #### Start Frontend Server 1. Navigate to the frontend directory: + ```bash cd frontend ``` 2. Start the Next.js development server: ```bash -npm run dev -``` + npm run dev + ``` + +```` The frontend will be available at: `http://localhost:3000` @@ -468,7 +487,7 @@ npm run dev cd frontend npm run build npm start -``` +```` #### Build Backend @@ -482,17 +501,20 @@ uvicorn main:app --host 0.0.0.0 --port 8000 ## 📚 API Documentation ### Base URL + - **Development**: `http://localhost:8000` - **Production**: Your production backend URL ### Main API Endpoints #### Authentication + - `POST /api/auth/signup` - User registration - `POST /api/auth/login` - User login - `GET /api/auth/me` - Get current user profile #### Campaigns + - `GET /campaigns` - List campaigns (with filters) - `POST /campaigns` - Create new campaign - `GET /campaigns/{campaign_id}` - Get campaign details @@ -500,6 +522,7 @@ uvicorn main:app --host 0.0.0.0 --port 8000 - `DELETE /campaigns/{campaign_id}` - Delete campaign #### Proposals + - `GET /proposals` - List proposals - `POST /proposals` - Create proposal - `GET /proposals/{proposal_id}` - Get proposal details @@ -509,37 +532,44 @@ uvicorn main:app --host 0.0.0.0 --port 8000 - `POST /proposals/{proposal_id}/reject` - Reject proposal #### Contracts + - `GET /contracts` - List contracts - `GET /contracts/{contract_id}` - Get contract details - `POST /contracts` - Create contract - `PUT /contracts/{contract_id}` - Update contract #### Collaborations + - `GET /collaborations` - List collaborations - `POST /collaborations` - Create collaboration - `GET /collaborations/{collaboration_id}` - Get collaboration details #### Creators + - `GET /creators` - List creators (with search/filters) - `GET /creators/{creator_id}` - Get creator profile #### Analytics + - `GET /analytics/campaigns/{campaign_id}` - Get campaign analytics - `POST /analytics/metrics` - Create metric - `POST /analytics/metrics/{metric_id}/submit` - Submit metric value - `POST /analytics/screenshots/extract` - Extract metrics from screenshot #### AI Generation + - `POST /api/groq/generate` - Generate content using Groq - `POST /api/gemini/generate` - Generate content using Gemini #### Health Check + - `GET /health` - Health check endpoint - `GET /health/supabase` - Supabase connection check ### Interactive API Documentation Once the backend is running, visit: + - **Swagger UI**: `http://localhost:8000/docs` - **ReDoc**: `http://localhost:8000/redoc` @@ -680,31 +710,37 @@ graph TD; #### Frontend Issues **Issue: "Missing Supabase environment variables"** + - **Solution**: Ensure `.env.local` exists in the `frontend` directory with all required variables - Check that variable names start with `NEXT_PUBLIC_` for client-side access **Issue: "NEXT_PUBLIC_API_URL is missing or not valid"** + - **Solution**: For local development, set `NEXT_PUBLIC_API_URL=http://localhost:8000` - For production, ensure it's a valid HTTPS URL **Issue: Build fails with TypeScript errors** + - **Solution**: Run `npm install` to ensure all dependencies are installed - Check that TypeScript version is compatible (v5+) #### Backend Issues **Issue: "Supabase client initialization failed"** + - **Solution**: - Verify `SUPABASE_URL` and `SUPABASE_KEY` in `.env` - Check that your Supabase project is active - Ensure network connectivity to Supabase **Issue: "JWT verification failed"** + - **Solution**: - Verify `SUPABASE_JWT_SECRET` matches the JWT Secret in Supabase dashboard - Ensure you're using the JWT Secret, not the anon key **Issue: Database connection errors** + - **Solution**: - Check `DATABASE_URL` format (if using direct connection) - For IPv4 networks, use Session Pooler connection string @@ -712,6 +748,7 @@ graph TD; - Check Supabase project status **Issue: "Module not found" errors** + - **Solution**: - Activate virtual environment: `source venv/bin/activate` - Reinstall dependencies: `pip install -r requirements.txt` @@ -719,10 +756,12 @@ graph TD; #### Database Issues **Issue: Tables don't exist** + - **Solution**: Run the SQL schema script in Supabase SQL Editor - Check that all ENUM types are created before tables **Issue: "onboarding_completed column doesn't exist"** + - **Solution**: Run the ALTER TABLE command: ```sql ALTER TABLE profiles @@ -732,11 +771,13 @@ graph TD; #### API Issues **Issue: CORS errors** + - **Solution**: - Add frontend URL to `ALLOWED_ORIGINS` in backend `.env` - Ensure backend CORS middleware is configured correctly **Issue: 401 Unauthorized errors** + - **Solution**: - Verify JWT token is being sent in request headers - Check token expiration @@ -745,6 +786,7 @@ graph TD; ### Getting Help If you encounter issues not covered here: + 1. Check the [Issues](https://github.com/AOSSIE-Org/InPact/issues) page 2. Review the documentation in the `docs/` and `guides/` directories 3. Reach out on Discord or create a new issue @@ -757,23 +799,36 @@ We welcome contributions from the community! Here's how you can help: ### Contribution Process -1. **Fork the Repository** +1. **Fork the Repository on GitHub** + - Go to [https://github.com/AOSSIE-Org/InPact](https://github.com/AOSSIE-Org/InPact) and click the "Fork" button in the top right. + +2. **Clone Your Fork Locally** + ```bash - git fork https://github.com/AOSSIE-Org/InPact.git + git clone + cd InPact ``` -2. **Create a Feature Branch** +3. **Add the Original Repository as Upstream Remote** + + ```bash + git remote add upstream https://github.com/AOSSIE-Org/InPact.git + ``` + +4. **Create a Feature Branch** + ```bash git checkout -b feature/your-feature-name ``` -3. **Make Your Changes** +5. **Make Your Changes** - Write clean, documented code - Follow existing code style - Add tests if applicable - Update documentation as needed -4. **Commit Your Changes** +6. **Commit Your Changes** + ```bash git commit -m "Add: Description of your feature" ``` @@ -784,12 +839,13 @@ We welcome contributions from the community! Here's how you can help: - `Update:` for updates to existing features - `Docs:` for documentation changes -5. **Push to Your Fork** +7. **Push to Your Fork** + ```bash git push origin feature/your-feature-name ``` -6. **Open a Pull Request** +8. **Open a Pull Request** - Go to the repository on GitHub - Click "New Pull Request" - Select your branch