Skip to content

Latest commit

Β 

History

History
403 lines (294 loc) Β· 15.1 KB

File metadata and controls

403 lines (294 loc) Β· 15.1 KB

πŸ”Ί Project Triangle β€” AI-Powered Freelancer Ecosystem

Solving the Triple Constraint of Scope, Time & Cost with intelligent AI-driven project management.

Node.js React Express.js MySQL Gemini AI Socket.io Twilio TailwindCSS License: MIT


Project Triangle is a full-stack, AI-enhanced freelance project management platform built on the MERN stack. It addresses the classic Project Management Triangle β€” balancing Scope, Time, and Cost β€” using Google Gemini AI for intelligent scoping, Socket.io for real-time collaboration, and Twilio for SMS and voice notifications. Clients can post projects, freelancers can bid, and both parties can track progress through a live visual dashboard.


πŸ“Œ Table of Contents


✨ Features

Feature Description Status
πŸ€– AI Scope Generator Gemini automatically breaks project descriptions into milestones, timelines, and budget estimates βœ… Active
πŸ’¬ Real-Time Chat Instant client-freelancer messaging powered by Socket.io βœ… Active
πŸ“Š Triple Constraint Tracker Live visual monitoring of Scope, Time, and Cost against project targets βœ… Active
πŸ” JWT Authentication Secure role-based login for clients and freelancers βœ… Active
πŸ“‘ AI Project Summarizer Gemini-generated summaries of long project discussions and timelines βœ… Active
πŸ“‹ Bidding System Freelancers submit competitive proposals with cost estimates and portfolios βœ… Active
πŸ“² Twilio Notifications SMS and voice call alerts for bid updates, milestone completions, and deadlines βœ… Active
πŸ“± Responsive UI Fully optimized dashboard for desktop and mobile browsers βœ… Active

πŸ—‚οΈ Project Structure

Final_Project_Triangle/
β”‚
β”œβ”€β”€ backend/                        # Node.js + Express β€” REST API & AI logic
β”‚   β”œβ”€β”€ controllers/                # Route handlers (projects, bids, chat, AI)
β”‚   β”œβ”€β”€ models/                     # MySQL schema models
β”‚   β”œβ”€β”€ middleware/                  # JWT authentication & request validation
β”‚   β”œβ”€β”€ routes/                     # API route definitions
β”‚   β”œβ”€β”€ config/                     # DB connection & environment setup
β”‚   └── server.js                   # Express + Socket.io server entry point
β”‚
β”œβ”€β”€ client/                         # React (Vite) β€” primary frontend app
β”‚   └── src/
β”‚       β”œβ”€β”€ components/             # Reusable UI (Chat, Dashboard, Navbar, Bid cards)
β”‚       β”œβ”€β”€ pages/                  # Home, Project View, Freelancer Profile, Login
β”‚       β”œβ”€β”€ context/                # Auth context & global state management
β”‚       └── main.jsx                # App entry point
β”‚
β”œβ”€β”€ project-triangle-frontend/      # Alternate / staging frontend build
β”‚
β”œβ”€β”€ node_modules/                   # Root-level Node dependencies
β”‚
β”œβ”€β”€ Dump20251007 (2).sql            # MySQL database dump β€” import to seed DB
β”œβ”€β”€ package.json                    # Root dependencies (Tailwind, Twilio)
β”œβ”€β”€ .gitignore
└── README.md

πŸ› οΈ Tech Stack

Frontend

Backend

  • Node.js + Express.js β€” RESTful API server
  • Socket.io β€” real-time event-driven messaging
  • JWT β€” stateless authentication and authorization
  • Twilio β€” SMS and voice call notifications

Database

  • MySQL β€” relational database for users, projects, bids, and messages
  • SQL dump file included: Dump20251007 (2).sql

AI


πŸ€– Google Gemini AI Integration

Gemini is the intelligence engine behind Project Triangle's most powerful features. It is called entirely from the backend (Express API routes) β€” keeping the API key secure and off the client.

What Gemini Does

AI Scope Generator β€” A client describes their project in plain language. Gemini analyzes it and generates a structured breakdown: deliverables, recommended milestones, estimated timeline, and a realistic budget range.

AI Project Summarizer β€” On long-running projects, Gemini reads through the chat history and milestone logs and generates a concise plain-language progress summary for both parties.

Scope Compliance Review β€” When a freelancer marks a milestone as complete, Gemini compares the deliverables against the original project scope and flags any discrepancies.

API Flow

Client submits project description
        β”‚
        β–Ό
  Express API route receives request
        β”‚
        β–Ό
  Prompt built with project context
        β”‚
        β–Ό
  Gemini API called (server-side only)
        β”‚
        β–Ό
  Structured JSON response parsed
        β”‚
        β–Ό
  Milestones, timeline & budget saved to MySQL
        β”‚
        β–Ό
  Dashboard updated with AI-generated plan

Getting Your Gemini API Key

  1. Visit https://ai.google.dev/ and sign in with your Google account
  2. Click "Get API Key" β†’ "Create API Key in new project"
  3. Copy the key and add it to your backend/.env file as GEMINI_API_KEY

⚠️ Always call Gemini from your Express backend routes β€” never expose the API key in React/frontend code.


πŸ’¬ Real-Time Features β€” Socket.io

Project Triangle uses Socket.io for instant, bidirectional communication between clients and freelancers without page refreshes.

Real-time events include:

  • Live chat messages between client and freelancer
  • Instant bid notifications when a new proposal arrives
  • Milestone status updates reflected immediately on both sides
  • Dashboard constraint meters (Scope/Time/Cost) updating in real time

The Socket.io server runs alongside Express on the same port using http.createServer().


πŸ“² Twilio Integration

Twilio handles all out-of-app communications so users never miss critical project updates.

Notification Trigger Channel
New bid received Freelancer submits a proposal SMS
Bid accepted / rejected Client responds to proposal SMS
Milestone completed Freelancer marks deliverable done SMS
Deadline approaching 24 hours before a milestone due date SMS + Voice Call
Payment released Client approves milestone SMS

Setting Up Twilio

  1. Create a free account at https://www.twilio.com/
  2. Get your Account SID, Auth Token, and a Twilio Phone Number from the console
  3. Add these to your backend/.env (see Environment Configuration)

βš™οΈ Installation

Prerequisites

  • Node.js 18 or higher
  • MySQL 8.0 or higher
  • A Google Gemini API key (free tier)
  • A Twilio account (free trial)

Step 1 β€” Clone the Repository

git clone https://github.com/Lucky-939/Final_Project_Triangle.git
cd Final_Project_Triangle

Step 2 β€” Backend Setup

cd backend
npm install

Step 3 β€” Frontend Setup

cd ../client
npm install

Step 4 β€” Configure Environment Variables

Create .env files for both backend and frontend (see Environment Configuration below).

Step 5 β€” Import the Database

mysql -u your_mysql_user -p your_database_name < "Dump20251007 (2).sql"

Step 6 β€” Start Both Servers

In one terminal (backend):

cd backend
npm run dev

In another terminal (frontend):

cd client
npm run dev
  • Backend API: http://localhost:5000
  • Frontend Dashboard: http://localhost:5173

πŸ”‘ Environment Configuration

Backend β€” backend/.env

# ── Server ───────────────────────────────────────────
PORT=5000
NODE_ENV=development

# ── MySQL Database ────────────────────────────────────
DB_HOST=localhost
DB_PORT=3306
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password
DB_NAME=project_triangle

# ── Authentication ────────────────────────────────────
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=7d

# ── Google Gemini AI ──────────────────────────────────
GEMINI_API_KEY=your_google_gemini_api_key_here

# ── Twilio (SMS & Voice) ──────────────────────────────
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=+1XXXXXXXXXX

Frontend β€” client/.env

# ── Backend API URL ───────────────────────────────────
VITE_API_URL=http://localhost:5000/api

# ── Socket.io Server ──────────────────────────────────
VITE_SOCKET_URL=http://localhost:5000

⚠️ Add both .env files to .gitignore. Never commit credentials to GitHub.

πŸ’‘ Generate a strong JWT secret with:

node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

πŸ—„οΈ Database Setup

A complete MySQL dump is included in the repository (Dump20251007 (2).sql). Import it to get the full schema with sample data:

# Create the database first
mysql -u root -p -e "CREATE DATABASE project_triangle;"

# Import the dump
mysql -u root -p project_triangle < "Dump20251007 (2).sql"

Core tables include: users, projects, bids, milestones, messages, notifications


πŸš€ Usage

Once both servers are running:

  1. Register as a Client or Freelancer on the sign-up page
  2. Clients β€” Post a new project; Gemini AI will auto-generate a scope breakdown, milestones, and budget estimate
  3. Freelancers β€” Browse open projects and submit competitive proposals with custom bids
  4. Clients β€” Review proposals and accept the best fit; the freelancer gets an SMS notification via Twilio
  5. Both parties β€” Use the real-time chat to collaborate; the Triple Constraint dashboard tracks Scope, Time, and Cost live
  6. Freelancers β€” Mark milestones complete; Gemini reviews the deliverables against the original scope
  7. Clients β€” Approve completed milestones; payment release triggers an SMS confirmation

🌐 API Overview

Method Endpoint Description Auth Required
POST /api/auth/register Register a new user No
POST /api/auth/login Login and get JWT token No
GET /api/projects List all open projects Yes
POST /api/projects Create a new project Yes (Client)
GET /api/projects/:id Get project details Yes
POST /api/projects/:id/bids Submit a bid on a project Yes (Freelancer)
PUT /api/bids/:id/accept Accept a freelancer's bid Yes (Client)
POST /api/ai/scope Generate AI project scope Yes
POST /api/ai/summary Generate AI project summary Yes
GET /api/chat/:projectId Get chat history Yes
POST /api/milestones/:id/complete Mark milestone complete Yes (Freelancer)

πŸ›£οΈ Roadmap

Planned features for upcoming releases:

  • Stripe integration β€” automated milestone-based payment releases
  • GitHub sync β€” pull repository commits directly into project milestones
  • AI-powered freelancer ranking β€” Gemini scores proposals based on relevance and past ratings
  • Voice commands β€” use Gemini for voice-activated project updates
  • Email notifications alongside Twilio SMS
  • Admin panel β€” platform-wide user and project management
  • Deployed production version (Render + PlanetScale)

🀝 Contributing

Contributions are welcome! Here's how to get involved:

# 1. Fork the repository on GitHub

# 2. Clone your fork
git clone https://github.com/YOUR-USERNAME/Final_Project_Triangle.git

# 3. Create a feature branch
git checkout -b feature/your-feature-name

# 4. Make your changes and commit
git add .
git commit -m "feat: describe your change here"

# 5. Push and open a Pull Request
git push origin feature/your-feature-name

Guidelines

  • Keep backend and frontend concerns separated in their respective folders
  • Comment Gemini prompt logic clearly β€” it helps collaborators tune AI output
  • Test API routes with Postman or Thunder Client before submitting a PR
  • For major changes, open an issue first to discuss the approach

πŸ› Reporting Issues

Open an issue with:

  • A clear description and steps to reproduce
  • Expected vs. actual behaviour
  • Relevant error logs or screenshots

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Made with ❀️ by Lucky-939 β€” Reimagining freelance project management with AI.