Setup Guide

Get Sophia Codex running on your local machine in minutes.

What You're Getting

10
Database Tables
31+
API Endpoints
4
AI Models
25+
Achievement Badges
15+
User Preferences
60%
CPU Optimization

Installation Steps

1

Clone the Repository

Download the source code from GitHub to your local machine.

Terminal
git clone https://github.com/AlexBiobelemo/Sophia-Code.git
cd Sophia-Code
2

Create Virtual Environment

Set up an isolated Python environment for the project.

Windows
python -m venv venv
venv\Scripts\activate
macOS / Linux
python3 -m venv venv
source venv/bin/activate
3

Install Dependencies

Install all required Python packages.

pip install -r requirements.txt
4

Configure Environment Variables

Create a .env file in the root directory with the following variables:

SECRET_KEY Your secret key
DATABASE_URL sqlite:///app.db
GEMINI_API_KEY Your Gemini API key
FLASK_APP run.py
FLASK_ENV development

Important: Replace GEMINI_API_KEY with your actual Google Gemini API key. You can get one from Google AI Studio.

5

Initialize the Database

Set up the database schema using Flask-Migrate.

flask db upgrade
6

Initialize Default Badges

Set up the gamification badge system.

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()"
7

Run the Application

Start the Flask development server.

python run.py

The application will be available at http://127.0.0.1:5000/

Prerequisites

Python

Version 3.9 or higher required for all features.

pip

Python package installer for dependencies.

Git

Version control for cloning the repository.

Post-Installation

First-Time Setup Checklist

  • Verify the database file (app.db) was created in the root directory
  • Ensure the instance/ folder exists for uploads
  • Test the Gemini API connection in Settings page
  • Create your first user account via registration
  • Explore the demo data if using the hosted version