Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Productivity Extension

A browser extension with a Node.js backend for AI-powered productivity features.

Project Structure

ai-productivity-extension/
├── backend/          # Node.js/Express backend
│   ├── src/
│   │   ├── app.js
│   │   ├── server.js
│   │   ├── config/
│   │   ├── controllers/
│   │   ├── middleware/
│   │   ├── models/
│   │   ├── routes/
│   │   ├── services/
│   │   └── utils/
│   └── package.json
└── extension/        # Browser extension
    ├── manifest.json
    ├── background.js
    ├── contentScript.js
    └── popup/

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (running locally or MongoDB Atlas)
  • OpenAI API key

Backend Setup

1. Install Dependencies

cd backend
npm install

2. Configure Environment Variables

Create a .env file in the backend directory:

cp .env.example .env

Edit .env and add your configuration:

PORT=5000
MONGO_URI=mongodb://localhost:27017/ai-productivity
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
OPENAI_API_KEY=your-openai-api-key-here

Important:

  • Replace MONGO_URI with your MongoDB connection string
  • Generate a strong random string for JWT_SECRET
  • Get your OpenAI API key from OpenAI Platform

3. Start MongoDB

Make sure MongoDB is running:

Local MongoDB:

# Windows
net start MongoDB

# macOS/Linux
sudo systemctl start mongod
# or
mongod

MongoDB Atlas (Cloud):

  • Use your MongoDB Atlas connection string in MONGO_URI

4. Run the Backend Server

npm start

The server will start on http://localhost:5000 (or the port specified in .env).

Extension Setup

1. Load the Extension in Chrome/Edge

  1. Open Chrome/Edge and navigate to chrome://extensions/ or edge://extensions/
  2. Enable "Developer mode" (toggle in top right)
  3. Click "Load unpacked"
  4. Select the extension folder from this project

2. Configure Extension

The extension is configured to connect to http://localhost:5000 by default.

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login user

AI Chat

  • POST /api/ai/chat - Send chat message (requires authentication)
  • GET /api/ai/history - Get conversation history (requires authentication)

History

  • GET /api/history - Get user history (requires authentication)

Troubleshooting

Server won't start

  1. Check if MongoDB is running:

    # Test MongoDB connection
    mongosh
  2. Check environment variables:

    • Ensure .env file exists in backend directory
    • Verify all required variables are set
  3. Check port availability:

    • Make sure port 5000 (or your configured PORT) is not in use
    • Change PORT in .env if needed

MongoDB Connection Failed

  • Verify MongoDB is running
  • Check MONGO_URI in .env is correct
  • For MongoDB Atlas, ensure your IP is whitelisted

Missing Dependencies

If you get module not found errors:

cd backend
npm install

OpenAI API Errors

  • Verify your OPENAI_API_KEY is correct in .env
  • Check your OpenAI account has credits/quota
  • Ensure the API key has proper permissions

Development

Running in Development Mode

cd backend
npm run dev

License

ISC

About

It is a smart campanion which helps by just giving prompts. It is easily accessible and useful.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages