Intelligent Chrome extension for prompt optimization using AI techniques including RAG, Chain-of-Thought, Role-playing, Few-shot learning and other.
- Intelligent Prompt Optimization: Automatic prompt improvement using AI techniques
- RAG System: Retrieval-Augmented Generation with vector knowledge base
- Interactive Variables: Create and manage variables in prompts for reusability
- Template Library: Save and organize frequently used prompts
- Direct Integration: Send optimized prompts to ChatGPT and Perplexity
- Multilingual Support: Russian and English languages
- Chain-of-Thought: Step-by-step reasoning for complex prompts
- Role-playing: Context-aware persona-based optimization
- Few-shot Learning: Example-based prompt enhancement
- Vector Search: Semantic similarity for relevant examples
- Context Awareness: Intelligent context preservation
- Framework: FastAPI (Python 3.11+)
- Database: PostgreSQL 14+ with pgvector extension
- Vector Store: Sentence Transformers + pgvector
- LLM Integration: OpenAI, Perplexity, Ollama
- Caching: Redis for performance optimization
- Authentication: JWT-based security
- Monitoring: Prometheus + Grafana
- Container: Docker + Docker Compose
- Framework: React 18 + TypeScript
- Build System: Webpack 5 with optimization
- UI Library: Material-UI (MUI) v5
- State Management: React Query for server state
- Internationalization: i18next
- Extension: Chrome Extension Manifest V3
- Testing: Jest + React Testing Library
- Database: PostgreSQL with pgvector for embeddings
- Cache: Redis for session and data caching
- LLM Services: Multiple AI provider integrations
- Monitoring: Prometheus metrics + Grafana dashboards
- Reverse Proxy: Nginx for production deployment
- Local LLM: Ollama for open-source model support
- Docker and Docker Compose
- Node.js 18+ (for frontend development)
- Python 3.11+ (for backend development)
- PostgreSQL 14+ with pgvector extension
- Redis 7+
- Clone the repository
git clone https://github.com/LISA-ITMO/promptab.git
cd promptab- Configure environment variables
cp .env.example .env
# Edit .env with your API keys and configuration- Start all services
docker-compose up -d- Install Chrome extension
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked extension"
- Select the
frontend/distfolder
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
pip install -r requirements-docs.txt
# Run database migrations
alembic upgrade head
# Start development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
# Development mode
npm start
# Build for production
npm run build
# Package extension
npm run packageCreate .env file in the root directory:
# Database
POSTGRES_DB=promptab
POSTGRES_USER=promptab_user
POSTGRES_PASSWORD=your_password
DATABASE_URL=postgresql://promptab_user:your_password@localhost:5432/promptab
# Redis
REDIS_URL=redis://localhost:6379
# LLM API Keys
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
PERPLEXITY_API_KEY=your_perplexity_key
# Security
SECRET_KEY=your_secret_key
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Monitoring
SENTRY_DSN=your_sentry_dsn
PROMETHEUS_PORT=9090
# Ollama (Local LLM)
OLLAMA_BASE_URL=http://localhost:11434The backend provides RESTful API endpoints:
- Authentication:
/api/auth/ - Prompts:
/api/prompts/ - Templates:
/api/templates/ - Variables:
/api/variables/ - Optimization:
/api/optimize/ - Health Check:
/health
cd backend
# Run all tests
pytest
# Run with coverage
pytest --cov=app --cov-report=html
# Run specific test categories
pytest tests/test_api_prompts.py
pytest tests/test_services.py
pytest tests/test_models.py- Live Documentation: GitHub Pages
- API Reference: Complete API documentation with examples
- Architecture Guide: Detailed system architecture and design decisions
- Development Guide: Setup and development workflow
# Backend documentation
cd backend
./scripts/build_docs.sh
# View locally
cd docs/_build/html
python -m http.server 8000- Documentation Pipeline (
.github/workflows/docs.yml)- Automatic Sphinx documentation build
- Quality checks and validation
- Deployment to GitHub Pages
- Code Quality: ESLint, Prettier, Black, Ruff
- Type Checking: TypeScript, MyPy
- Security: Bandit, Safety
- Performance: Bundle analysis, load testing
promptab/
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── api/ # API endpoints
│ │ ├── core/ # Core configuration
│ │ ├── db/ # Database models
│ │ ├── models/ # Pydantic models
│ │ ├── schemas/ # API schemas
│ │ └── services/ # Business logic
│ ├── docs/ # Sphinx documentation
│ ├── tests/ # Backend tests
│ └── scripts/ # Build and utility scripts
├── frontend/ # React Chrome extension
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API services
│ │ ├── utils/ # Utility functions
│ │ ├── popup/ # Extension popup
│ │ ├── options/ # Extension options
│ │ ├── background/ # Background scripts
│ │ └── contentScript/ # Content scripts
│ ├── scripts/ # Build scripts
│ └── dist/ # Built extension
├── docker/ # Docker configurations
├── docs/ # Project documentation
└── .github/ # GitHub Actions workflows
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name- Make your changes
- Run tests and linting
# Backend
cd backend && pytest && black app/ && ruff check app/
# Frontend
cd frontend && npm test && npm run lint- Commit your changes
git commit -m "feat: add your feature description"- Push and create a pull request
- Backend: Follow PEP 8, use type hints, add docstrings
- Frontend: Follow ESLint rules, use TypeScript, add JSDoc
- Testing: Maintain >80% code coverage
- Documentation: Update docs for new features
- Authentication: JWT-based secure authentication
- Authorization: Role-based access control
- Input Validation: Comprehensive input sanitization
- Rate Limiting: API rate limiting and abuse prevention
- HTTPS: Secure communication protocols
- Secrets Management: Environment-based configuration
- Regular dependency updates
- Security scanning in CI/CD
- Input validation and sanitization
- Proper error handling
- Secure session management
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: GitHub Pages
- Discussions: GitHub Discussions
- Email: natig.aminov@gmail.com