A web-based platform for creating and sharing coding adventures - promoting active learning through gamification and adaptive problem sequences. Live at: https://adventurecode.tech/.
Adventure Code is an educational platform that enables educators and students to create "coding adventures" - sequences of programming problems represented as interactive graphs. Each node represents a coding problem, and edges determine the path through the adventure based on whether problems are solved correctly or incorrectly. This approach facilitates adaptive learning experiences that can adjust difficulty dynamically based on performance.
- Interactive Adventure Creation: Build coding adventures using a visual graph interface
- Adaptive Problem Sequences: Create branching paths based on correct/incorrect solutions
- Secure Code Execution: Safe execution of user code using containerised sandboxing (Piston engine)
- Multi-language support: Adventure Code supports Python, JavaScript, TypeScript, Java, C++, C, Go, Rust, PHP, Ruby, and Bash.
- Guest Mode: Attempt adventures without account creation
- Progress Tracking: Save progress for registered users
- Leaderboard System: Gamification through fastest completion times
- Sharable Adventures: Generate unique 6-digit access codes for easy sharing of adventures.
Adventure Code follows a 3-tier architecture
- Frontend: React with TypeScript, Vite, React Flow, and TailwindCSS
- Backend: FastAPI with Python
- Database: PostgreSQL hosted on Supabase
- Deployment: Azure Static Web Apps (frontend) and Azure App Service (backend)
- Azure Static Web Apps - Frontend hosting
- Azure App Service - Backend hosting
- GitHub Actions - CI/CD pipeline
- Pytest - Testing framework
-
Clone the repository: run
git clone https://github.com/Joshua-Onley/AdventureCode -
Create a new terminal session and cd into the project
-
Run
cd frontendto open the frontend directory -
Run
npm installto install dependencies -
Create a new ".env" file in the root of the frontend directory. Add the following variable:
VITE_API_URL=http://127.0.0.1:8000 -
Run
cd ..to exit the frontend directory -
Run
cd backendto enter the backend directory -
Run
python -m venv venvto create a virtual environment -
Run
source venv/bin/activateto activate the virtual environment -
Run
pip install -r requirements.txtto install dependencies -
Create a ".env" file in the root of the backend directory and add
DATABASE_URL=postgresql://dev_user:dev_password@localhost:5432/adventure_code(this database is created in a later step). Runopenssl rand -base64 32in the terminal to generate a secret key. Add this secret key to the environment variable file as follows:SECRET_KEY=<your output from the previous command>. -
Exit the backend directory by running
cd .. -
Install PostgreSQL via homebrew - run
brew install postgresql -
Start running PostgreSQL locally - run
brew services start postgresql(may need to append version to the end of postgresql) -
Open the PostgreSQL shell using
psql postgresand then RunCREATE USER dev_user WITH PASSWORD 'dev_password'; CREATE DATABASE adventure_code OWNER dev_user; GRANT ALL PRIVILEGES ON DATABASE adventure_code TO dev_user;
to create the Database -
Create a file in the root of the backend called create_tables.py. Add the following code to it then save the file:
from database import Base, engine
from models import User, Adventure, Leaderboard, Problem, AdventureProblemSubmission
if __name__ == "__main__":
Base.metadata.create_all(bind=engine)
print("Tables created successfully!")
-
Exit the psql shell using
\q. Cd into the backend directory again usingcd backend. Within the backend directory, runpython create_tables.pyto create the database and tables. -
Run
uvicorn main:app --reloadin the backend -
Create a new terminal window, cd into the frontend and run
npm run dev -
The app should be running at http://localhost:5173/



