IzanagiDB is a tool that lets you save different versions of your document. Instead of just overwriting a file, it saves every change you make.
Think of it like "Undo/Redo" for your database. You can look back at what a document looked like yesterday, see exactly what words were changed, and "rewind" back to a previous version if you make a mistake.
We use a Hybrid Setup because different databases are good at different things:
Inside the Docker network, the apps talk to each other using internal names. Your Python code connects to db for Postgres and nosql for Mongo. This keeps the databases private and secure from the outside world.
IzanagiDB/
āāā .gitignore
āāā README.md
āāā Design_Roadmap.md # How I reasoned on system design
āāā docker-compose.yml # Orchestrates all services
āāā generate_keys.py # Generates RSA keys for JWT
āāā python_requirements.txt # Python dependencies
ā
āāā backend/
ā āāā Dockerfile # Backend container definition
ā āāā app/
ā āāā __init__.py
ā āāā main.py # FastAPI app entry point + CORS
ā āāā config.py # Environment variables & settings
ā āāā database.py # PostgreSQL & MongoDB connections
ā āāā tables.py # SQLAlchemy ORM models
ā āāā schemas.py # Pydantic validation schemas
ā āāā auth.py # JWT & password hashing logic
ā āāā dependencies.py # JWT authentication dependency
ā āāā create_databases.sql # Database schema (for reference, not used)
ā āāā routes/
ā āāā __init__.py
ā āāā auth.py # /auth endpoints (login, register, etc.)
ā āāā documents.py # /documents endpoints (CRUD, versions)
ā
āāā frontend/
āāā Dockerfile # Frontend container definition
āāā package.json # Node dependencies
āāā package-lock.json
āāā vite.config.ts # Vite config (port 7999)
āāā svelte.config.js # SvelteKit config
āāā tsconfig.json # TypeScript config
āāā .prettierrc # Code formatting
āāā .prettierignore
āāā .npmrc
āāā .gitignore
āāā README.md
ā
āāā static/
ā āāā robots.txt
ā
āāā src/
āāā app.html # HTML template
āāā app.d.ts # TypeScript declarations
āāā lib/
ā āāā index.ts
ā āāā styles.css # Global CSS variables & fonts
ā āāā assets/
ā ā āāā favicon.svg
ā āāā components/
ā āāā Nav.svelte # Navigation component
ā
āāā routes/
āāā +page.svelte # Home page (/)
āāā +layout.svelte # Global layout with Nav
ā
āāā auth/
ā āāā +page.svelte # Login/Signup page (/auth)
ā
āāā documents/
āāā +page.svelte # Document list (/documents)
āāā [id]/
āāā +page.svelte # Document viewer/editor (/documents/[id])
This project is built using the latest features of Python 3.14 and SvelteKit. It is assumed that Python 3.14 is already installed on your system.
The backend requires environment variables for database connections and JWT authentication. The .env file is gitignored, so add one of your own, whose content looks like this:
POSTGRES_HOST=postgre
POSTGRES_PORT=5432
POSTGRES_USER=izanagi_user
POSTGRES_PASSWORD=izanagi_pass
POSTGRES_DB=izanagi_db
MONGO_HOST=mongo
MONGO_PORT=27017
# JWT Configuration
JWT_ALGORITHM=RS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=30
We use a dedicated virtual environment to manage dependencies and ensure version consistency.
Navigate to the backend/ directory and create an environment named izanagi_venv:
python3.14 -m venv izanagi_venv
Activate the Environment:
source izanagi_venv/bin/activate # Linux/macOS
izanagi_venv\Scripts\activate # Windows
Install Core Libraries:
pip install -r python_requirements.txt
IzanagiDB uses RS256 (RSA asymmetric encryption) for JWT tokens. You need to generate a private/public key pair before starting the backend. These keys will be saved in backend/ directory, but their paths are added in .gitignore. Simply run:
cd backend/app
python3.14 ../../generate_keys.py
SvelteKit acts as the modern framework for our Svelte 5 components. It manages routing and communicates with the FastAPI backend via API calls.
If you are starting the frontend/ folder from scratch, use the following command to bootstrap a SvelteKit Minimal project with TypeScript and Prettier:
npx sv create --template minimal --types ts --add prettier --install npm frontend
After the project is created, navigate to the frontend/ directory and install the text-diffing library required for the document version viewer:
cd frontend
npm install diff
To avoid CORS issues during development, ensure your SvelteKit fetch calls point to the FastAPI default port (http://localhost:8000).
Since IzanagiDB relies on a hybrid database approach, the easiest way to get the environment ready is through Docker, as defined in the docker-compose.yml.
Verify Docker Installation: Ensure Docker and Docker Compose are running.
Launch the Stack:
docker-compose up --build
This command pulls the official images for PostgreSQL and MongoDB, sets up the internal network, and starts your Python and SvelteKit services simultaneously.
To launch the entire system (Databases, Backend, and Frontend), run the following command in your terminal:
docker-compose down && docker-compose up --build
http://localhost:7999http://localhost:8000/docsThis project is licensed under the GNU General Public License version 3 (GPLv3).