Gen-Ed is a framework for building web applications that use generative AI (LLMs) for education (i.e., organized around instructors and their classes of students for use in teaching and learning contexts).
The framework provides most of the common functionality any application of this type might need, including:
- Authentication, including single-sign-on from Google, Github, and Microsoft.
- Class enrollment, with separate instructor and student roles.
- Connecting to LMSes via LTI (for automatic authentication and enrolling).
- Class management and data export.
- Admin interfaces.
The repository also contains two applications that are built on Gen-Ed:
-
CodeHelp [1,2]: A tool for assisting students in computer science classes without giving them solution code. https://codehelp.app/
-
Starburst: A collection of the Gen-Ed components that are not coding- or CS-specific. https://strbrst.xyz/
[1] CodeHelp: Using Large Language Models with Guardrails for Scalable Support in Programming Classes. Mark Liffiton, Brad Sheese, Jaromir Savelka, and Paul Denny. 2023. In Proceedings of the 23rd Koli Calling International Conference on Computing Education Research (Koli Calling '23). DOI: 10.1145/3631802.3631830
[2] Patterns of Student Help-Seeking When Using a Large Language Model-Powered Programming Assistant. Brad Sheese, Mark Liffiton, Jaromir Savelka, and Paul Denny. 2024. In Proceedings of the 26th Australasian Computing Education Conference (ACE '24). DOI: 10.1145/3636243.3636249
Requires Python 3.11 or higher. (If your system Python version is not 3.11 or higher, we recommend using uv to create your virtual environment with a newer Python version.)
-
Create and activate a Python virtual environment. (E.g.,
python3 -m venv venv; source venv/bin/activate) -
Install the Gen-Ed package and bundled applications in 'editable' mode:
pip install -e .- In the root of the repository, create
.envand populate it with environment variables to configure the application. See.env.testfor a list of all available variables. The required variables are:FLASK_INSTANCE_PATH: Path to an instance folder for storing the database and other persistent files. Commonly set toinstance.SECRET_KEY: Used to sign session cookies. Generate a secure random string for this.SYSTEM_API_KEY: Your LLM API key to be used for queries outside of a class context (e.g. for free queries).SYSTEM_MODEL_SHORTNAME: Name from the application databse of the model to be used outside of a class context.GPT-4.1 miniis a good default.DEFAULT_CLASS_MODEL_SHORTNAME: Name from the application database for the default model to be used in new classes (can be configured after creating the class).GPT-4.1 miniis a good default.
Optionally, if you want to allow logins from 3rd party authentication providers, set any of the following pairs with IDs/secrets obtained from registering your application with the given provider:
GOOGLE_CLIENT_ID=[...]
GOOGLE_CLIENT_SECRET=[...]
GITHUB_CLIENT_ID=[...]
GITHUB_CLIENT_SECRET=[...]
MICROSOFT_CLIENT_ID=[...]
MICROSOFT_CLIENT_SECRET=[...]
Then, to set up an application (CodeHelp, for example):
- Initialize database:
flask --app codehelp initdb- Create at least one admin user:
flask --app codehelp newuser --admin [username]This will create and display a randomly-generated password. To change the password:
flask --app codehelp setpassword [username]- (Optional) To serve files from
/.well-known(for domain verification, etc.), place the files in a.well-knowndirectory inside the Flask instance folder.
Database backups (from migrations) and downloads (from the admin interface) can optionally be encrypted using age encryption. To enable encryption:
-
Generate an encryption keypair using either SSH (you might also choose to use an existing SSH keypair) or rage:
# SSH key ssh-keygen -t ed25519 -f backup_key # Age key rage-keygen
-
Add the public key (contents of
backup_key.pubfor an SSH keypair) to.envasAGE_PUBLIC_KEY -
Keep the private key (
backup_keyin an SSH keypair) secure and offline - it should never be present on the server. -
When you need to decrypt a backup, you can use rage:
rage -d -i backup_key backup.db.age -o backup.db
For example, to run the CodeHelp app:
flask --app codehelp run
# or, during development:
flask --app codehelp --debug runWhen deploying an application in production, do not use the development server
used by flask ... run. See the Flask
documentation for
production server options.
See DEVELOPING.md for additional instructions and information for developing
an application and/or contributing to the project.
Gen-Ed and the included applications are by Mark Liffiton with contributions from Zhansen Shingis.
Gen-Ed and the included applications are licensed under the GNU Affero General Public License version 3 (AGPL-3.0-only).
Brand icons from Simple Icons are licensed under CC0-1.0. Other icons from Lucide are licensed under the Lucide ISC license.
For the text of these licenses, see the LICENSES directory.