Skip to content

vishalm342/PromptPal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ PromptPal

PromptPal is a full-stack AI-powered web app to save, organize, and share your favorite ChatGPT prompts β€” with built-in intelligent AI suggestions powered by Google Gemini.


🌟 Features

  • πŸ’Ύ Save and tag your prompts
  • πŸ”’ Mark prompts public or private
  • πŸ€– Get intelligent AI-powered prompt suggestions (Google Gemini API + Smart Engine)
  • 🌍 Explore community prompts
  • 🎨 Clean modern UI (Tailwind CSS)
  • πŸ” User authentication (JWT)
  • ⚑ Fast, context-aware suggestions with gemini-2.5-flash-lite

🧠 Tech Stack

Layer Tech
Frontend React, Vite, Tailwind CSS, React Router
Backend Node.js, Express.js, MongoDB, Mongoose
AI Service Flask, Python, Google Gemini API + Smart Engine
Auth JWT (Firebase Auth planned)
Deployment Vercel, Render, MongoDB Atlas

πŸš€ Setup Instructions

🐳 Docker Setup (Recommended - Easy!)

One-command deployment with Docker:

# 1. Copy environment file
cp .env.example .env

# 2. Edit .env and add your API keys
nano .env

# 3. Start everything with Docker
./docker-start.sh
# OR manually: docker-compose up -d

That's it! Access at http://localhost:3000

πŸ“– Read the complete Docker guide for troubleshooting and advanced usage.


πŸ“¦ Manual Setup (Alternative)

Each service runs in its own terminal window:

1. Get Google Gemini API Key

# Visit Google AI Studio and create a free API key
# https://aistudio.google.com/app/apikey

# Copy your API key for the next step

2. Frontend Setup

cd client
npm install
npm run dev

3. Backend (API server) Setup

cd server
npm install

# Create .env file
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret

npm start

4. Flask AI Service Setup

cd flask-backend
pip install -r requirements.txt

# Copy environment variables
cp .env.example .env

# Edit .env with your settings:
# FLASK_PORT=5001
# CORS_ORIGIN=http://localhost:5173
# GEMINI_API_KEY=your_gemini_api_key_here

python app.py

πŸ€– AI Engine Features

PromptPal uses a hybrid AI approach with Google Gemini:

🌟 Google Gemini API (Primary AI Engine)

  • Powered by gemini-2.5-flash-lite: Fast, efficient, and cost-effective
  • High-quality suggestions: Advanced language understanding
  • Context-aware: Analyzes your prompt and tags intelligently
  • Rate limiting: Smart caching and quota management
  • Reliable: Production-ready with automatic retry logic

🧠 Smart Suggestion Engine (Built-in Fallback)

  • Context-aware: Analyzes prompt type and tags
  • Intelligent enhancement: Category-specific improvements for:
    • ✍️ Writing & Content
    • πŸ’Ό Business & Marketing
    • πŸ’» Technical & Development
    • 🎨 Creative & Design
    • πŸ“š Educational & Learning
    • πŸ“Š Analysis & Research
    • πŸ’ͺ Health & Fitness
  • Always available: Works even without API key
  • Zero-cost: No API charges for fallback mode

πŸ”„ Automatic Fallback System

User Request β†’ Gemini API (if quota available) β†’ Smart Engine (if needed) β†’ Enhanced Suggestions

Benefits:

  • βœ… Never fails to provide suggestions
  • βœ… Optimized for quota efficiency
  • βœ… 1-hour caching reduces duplicate requests
  • βœ… 15 requests/minute rate limiting
  • βœ… Graceful degradation on quota limits

πŸ“ Project Structure

PromptPal/
β”œβ”€β”€ client/          # React frontend
β”œβ”€β”€ server/          # Node.js API backend
β”œβ”€β”€ flask-backend/   # Python AI service
└── README.md

🌐 Live Demo


πŸ”§ Environment Variables

Flask Backend (.env)

FLASK_PORT=5001
CORS_ORIGIN=http://localhost:5173
GEMINI_API_KEY=your_gemini_api_key_here

Get your Gemini API key:

  1. Visit Google AI Studio
  2. Create a new API key
  3. Copy and paste into your .env file

Node.js Backend (.env)

PORT=3001
NODE_ENV=development
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
CORS_ORIGIN=http://localhost:5173

πŸš€ Deployment

Production Architecture

Vercel (Frontend) β†’ Render (Flask AI + Gemini API) β†’ Smart Engine Fallback
                 β†’ Render (Node.js API) β†’ MongoDB Atlas

Deployment Steps:

  1. Frontend (Vercel)

    • Connect your GitHub repository
    • Deploy from client/ directory
    • Set build command: npm run build
    • Set output directory: dist
  2. Flask AI Service (Render)

    • Deploy from flask-backend/ directory
    • Add environment variable: GEMINI_API_KEY
    • Start command: python app.py
  3. Node.js Backend (Render)

    • Deploy from server/ directory
    • Add environment variables: MONGODB_URI, JWT_SECRET
    • Start command: npm start

Note: Gemini API provides free tier with generous quotas. Smart Engine automatically activates if quota is exceeded.


🀝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Test locally with Gemini API and Smart Engine fallback
  4. Commit your changes (git commit -m 'Add some AmazingFeature')
  5. Push to the branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

Testing AI Suggestions

# Test Gemini API directly
cd flask-backend
python test_model_switch.py

# Test full suggestion endpoint
curl -X POST http://localhost:5001/suggest \
  -H "Content-Type: application/json" \
  -d '{"promptText":"Write a blog post","tags":["writing"]}'

πŸ“Š API Quotas & Limits

Google Gemini API Free Tier:

  • Generous monthly quota
  • 15 requests per minute (enforced by Flask backend)
  • Smart caching reduces duplicate requests
  • Automatic fallback to Smart Engine on quota limits

Monitor your usage:


πŸ”’ Security Notes

  • Never commit .env files to version control
  • API keys are sensitive - store them securely
  • Use environment variables for all secrets
  • The .gitignore is configured to exclude .env files
  • For production, use platform-specific secret management

πŸ“¬ Contact

For questions or feedback, open an issue or reach out to vishalm8656@gmail.com.


πŸ“„ License

This project is open source and available under the MIT License.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published