A FastAPI backend for a Norse mythology-themed game built for Hacknarok 2025, connecting the nine worlds of Norse mythology.
"Connect 9 worlds into one code" - A game based on the nine worlds of Norse mythology:
- Asgard - world of the Aesir (gods)
- Alfheim - world of the Light Elves
- Nidavellir/Svartalfheim - world of the Dwarves/Dark Elves
- Midgard - world of humans
- Jotunheim - world of Giants
- Vanaheim - world of the Vanir (second family of gods)
- Niflheim - world of ice and mist
- Muspelheim - world of fire
- Helheim - world of the dead
- Progress through the nine Norse worlds
- Score tracking and leaderboard functionality
- Game state persistence
- No login required - player identification via unique tokens
- FastAPI: Modern, fast web framework for building APIs
- SQLModel: SQL databases in Python, designed for simplicity and type safety
- PostgreSQL: Database backend for storing game data and progress
- Uvicorn: ASGI server implementation for Python
- Clone the repository
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile with your database connection string:DATABASE_URL=postgresql://username:password@localhost:5432/dbname
Start the server with:
uvicorn core.main:app --host 127.0.0.1 --port 8000POST /players/new: Create a new player and receive unique player tokenGET /worlds/: Get information about all nine worldsGET /worlds/{world_id}: Get details about a specific world
GET /players/{player_token}/current: Get current player state and available worldsPOST /players/{player_token}/complete/{world_id}: Mark a world as completed and update progress
GET /leaderboard: Get the top 10 players by score
The application is configured for deployment on Render.com using the provided render.yaml file.