The Cosmere API is your gateway to exploring the interconnected worlds, characters, and magic systems of Brandon Sanderson's epic fantasy universe. Whether you're a longtime fan or new to the Cosmere, this platform helps you discover the rich connections between stories spanning multiple series including The Stormlight Archive, Mistborn, Elantris, Warbreaker, and more.
π Character Connections: Track characters across different worlds and series, explore their relationships, magic abilities, and cosmic significance
π World Hopping: Navigate between planets like Roshar, Scadrial, Sel, and Nalthis, understanding their unique cultures, magic systems, and connections
β¨ Magic System Exploration: Dive deep into the various Investiture systems - from Allomancy and Surgebinding to AonDor and Awakening
π Cosmere Lore: Uncover the deeper mysteries of Shards, Adonalsium, and the fundamental forces that bind this universe together
- Fans wanting to explore character relationships and world connections
- Readers looking to understand the broader Cosmere connections
- Developers building Cosmere-related applications and tools
- Researchers studying the intricate world-building and magic systems
Find the latest release notes and what's coming for the project in the ROADMAP
Before you begin, ensure you have the following installed:
- Python 3.9+ (recommended: 3.9.6)
- Node.js 18+ and npm
- PostgreSQL 13+ (for the database)
- Git (for cloning the repository)
git clone <repository-url>
cd cosmere_api
Activate the Python Virtual Environment:
source cosmere_api_venv/bin/activate
Install Python Dependencies:
cd backend
pip install -r requirements.txt
Database Configuration:
- Create a PostgreSQL database named
cosmere
- Update the database connection in
backend/app/core/config.py
:DATABASE_URL: str = "postgresql://your_username@localhost/cosmere"
Run Database Migrations:
cd backend
alembic upgrade head
Install Node.js Dependencies:
cd frontend
npm install
Start Backend Server:
make backend-dev
Start Frontend Server (in a new terminal):
make frontend
Backend (with virtual environment activated):
cd backend
source ../cosmere_api_venv/bin/activate
python3 -c "from app.main import app; import uvicorn; uvicorn.run(app, host='127.0.0.1', port=8000, log_level='info')"
Frontend:
cd frontend
npm run dev
Once both servers are running:
- Frontend Application: http://localhost:5173
- Backend API: http://127.0.0.1:8000
- API Documentation: http://127.0.0.1:8000/api/v1/docs
cosmere_api/
βββ backend/ # FastAPI backend
β βββ app/ # Application code
β βββ data/ # JSON data files
β βββ scripts/ # Data import scripts
β βββ migrations/ # Database migrations
βββ frontend/ # React app (Vite)
β βββ src/ # Source code
β βββ public/ # Static assets
β βββ package.json # Dependencies
βββ docs/ # Documentation
βββ cosmere_api_venv/ # Python virtual environment
- Always activate the virtual environment:
source cosmere_api_venv/bin/activate
- The backend uses FastAPI with SQLAlchemy and PostgreSQL
- API endpoints are available at
/api/v1/
- Auto-generated documentation at
/api/v1/docs
- Built with React 18, TypeScript, and Vite
- Uses Tailwind CSS for styling
- API calls are proxied through Vite to the backend
- Hot module replacement enabled for development
Backend Issues:
- ModuleNotFoundError: Ensure you're in the
backend/
directory and virtual environment is activated - Database Connection Error: Check PostgreSQL is running and connection string is correct
- Port Already in Use: Kill existing processes:
killall python3
Frontend Issues:
- Port Already in Use: Vite will automatically try the next available port
- API Connection Error: Ensure backend is running on port 8000
- Build Errors: Clear node_modules and reinstall:
rm -rf node_modules && npm install
Virtual Environment Management:
# Activate (always do this for backend work)
source cosmere_api_venv/bin/activate
# Deactivate when done
deactivate
Database Management:
# Check database connection
psql cosmere -c "\dt"
# Run migrations
cd backend && alembic upgrade head
# Reset database (if needed)
cd backend && alembic downgrade base && alembic upgrade head
For detailed guides and advanced topics, see the documentation in the /docs
directory:
- Development Stack Setup: Detailed setup instructions
- Bulk Import Process: Data import workflows
- API Documentation: API reference
- Database Schema: Database design
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly (both frontend and backend)
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Need Help? Check the documentation in /docs or open an issue for support.