Project Sophia is a comprehensive knowledge management system designed to help developers organize, manage, and share code snippets, solutions, and technical insights. It combines powerful AI capabilities with robust organization features to streamline your coding workflow.
Project Sophia addresses the common problem developers face in managing an ever-growing collection of code snippets, solutions to problems, and general technical knowledge. It provides a structured environment to:
- Organize Code Snippets - Create, categorize, and tag code snippets by language and collection
- Problem Solving - Add LeetCode-style problems and generate AI-powered solutions
- AI-Powered Development - Generate code, explain existing code, format, and refactor using AI
- Personal Knowledge Base - Create notes and document your technical knowledge
- Gamification - Track progress with points, badges, and activity streaks
- Advanced Search - Find snippets using keyword and semantic search with embeddings
- Backend: Flask (Python)
- Database: SQLite (SQLAlchemy ORM)
- Frontend: HTML, CSS (Bootstrap + custom styles), JavaScript
- AI Integration:
- Google Gemini API (gemini-2.5-flash, gemini-1.5-flash, gemini-2.5-pro)
- Minimax API (minimax-m2:free)
- Authentication: Flask-Login with password hashing (Werkzeug)
- Forms: WTForms with validation
- Database Migrations: Alembic/Flask-Migrate
- Syntax Highlighting: Pygments
- Markdown: python-markdown for note rendering
- [User Guide](User Guide.md) - Complete user manual with tutorials and examples
- [Developer Guide](Developer Guide.md) - Technical documentation for contributors
- Features - Detailed feature descriptions and demos
- Troubleshooting - Common issues and solutions
- Updates - Version history and migration guide
- Python 3.9+
- pip (Python package installer)
- Git
-
Clone the repository:
git clone https://github.com/AlexBiobelemo/Project-Sophia.git cd Project-Sophia -
Create and activate a virtual environment:
python -m venv venv \venv\Scripts\activate # On Windows source venv/bin/activate # On macOS/Linux
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the root directory and add the following:SECRET_KEY='your_secret_key_here' DATABASE_URL='sqlite:///app.db' GEMINI_API_KEY='your_gemini_api_key_here' MINIMAX_API_KEY='your_minimax_api_key_here' # Optional FLASK_APP=run.py FLASK_ENV=development- Replace
GEMINI_API_KEYwith your actual Google Gemini API key MINIMAX_API_KEYis optional for using the Minimax AI provider
- Replace
-
Initialize the database:
flask db upgrade
-
Initialize badges:
python -c "from app.badge_system import initialize_default_badges; from app import create_app, db; app = create_app(); with app.app_context(): initialize_default_badges()"
To run the application:
flask run The application will typically be available at http://127.0.0.1:5000/. Open this URL in your web browser.
- Create, edit, delete code snippets
- Syntax highlighting for multiple programming languages
- Tag-based organization
- Version history with rollback capability
- AI-powered code explanation and formatting
- Hierarchical collections with nested folders
- Drag-and-drop reordering
- Move and copy snippets between collections
- Collection statistics
- Code Generation: Generate code from natural language prompts
- Code Explanation: Get detailed explanations for any code snippet
- Code Formatting: AI-powered code formatting for consistency
- Tag Suggestion: Automatic tag suggestions for code
- Code Refinement: Fix bugs and improve code based on error messages
- Multi-Step Thinking: Architecture → Coder → Tester → Refiner pipeline
- Streaming Generation: Real-time code and explanation streaming
- Add programming problems with descriptions and difficulty levels
- Generate AI solutions in multiple programming languages
- Solution approval workflow
- Solution explanation and classification
- Create and manage personal notes
- AI-powered note explanation
- Rich text support with Markdown
- AI-powered coding assistant
- Conversation history with multiple sessions
- Context-aware responses based on your snippets
- Points system for activities (snippet creation, solution approval, etc.)
- 25+ badges for achievements
- Activity streaks tracking
- User profile analytics and statistics
- Advanced search with filters (language, tags, date, collection)
- Semantic search using vector embeddings
- Search highlighting and scoring
- Solution search for approved solutions
- Export snippets as Markdown files
- Export filtered snippets
- Bulk export to ZIP archive
- Automatic daily snapshots
- Secure registration and login
- Account lockout after failed login attempts
- Profile customization with avatars
- User preferences (dark mode, AI model selection, UI settings)
Project Sophia supports multiple AI providers:
- Set
GEMINI_API_KEYenvironment variable - Default model:
gemini-2.5-flash - Supports: gemini-1.5-flash, gemini-2.5-flash, gemini-2.5-pro
- Set
MINIMAX_API_KEYenvironment variable - Model:
minimax-m2:free - Fallback to Gemini if Minimax is unavailable
Users can select their preferred AI model in the User Settings.
Project-Sophia/
├── app/
│ ├── __init__.py # Flask app factory
│ ├── routes.py # All route handlers
│ ├── models.py # SQLAlchemy models
│ ├── forms.py # WTForms forms
│ ├── ai_services.py # AI service router
│ ├── ai_services_minimax.py # Minimax AI implementation
│ ├── badge_system.py # Badge and gamification
│ ├── utils/ # Utility functions
│ ├── static/ # Static assets (CSS, JS, uploads)
│ └── templates/ # Jinja2 templates
├── migrations/ # Alembic migrations
├── snapshots/ # Automatic daily snapshots
├── config.py # Configuration
├── requirements.txt # Python dependencies
└── run.py # Application entry point
- Password hashing with Werkzeug
- Session management with Flask-Login
- Account lockout after 5 failed login attempts (30-minute lockout)
- CSRF protection via WTForms
- Security headers (X-Content-Type-Options, X-Frame-Options, etc.)
- Input validation and sanitization
- Developed by Alex Biobelemo
- Inspired by personal needs for better code organization
- Uses Google Gemini API for AI capabilities
- Uses Minimax API for additional AI capabilities