diff --git a/backend/main.py b/backend/main.py
index 2483e657ef54ecf93d274faff3be4a83cc8031cb..70d554cf95f53f9512960e05560b3642eaf52337 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -17,6 +17,8 @@ from app.routers import (
 from app.database import Base, engine, SessionLocal
 from app.routers.protected_router import protected_router
 
+os.makedirs("images", exist_ok=True)
+
 
 # Utility function to fetch metadata from pyproject.toml
 def get_project_metadata():
@@ -225,7 +227,6 @@ if __name__ == "__main__":
         # Test or CI Mode: Run server process temporarily for test validation
         ssl_dir = Path(cert_path).parent
         ssl_dir.mkdir(parents=True, exist_ok=True)
-        os.makedirs("images", exist_ok=True)
 
         # Generate self-signed certs if missing
         if not Path(cert_path).exists() or not Path(key_path).exists():