Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

feat(studio): add auth-specific paths and integrate auth database location

Shine1ibbb4cd0f0b0f
diff --git a/studio/backend/auth/storage.py b/studio/backend/auth/storage.py
index f72a7ed943d..cb5df6e3f94 100644
--- a/studio/backend/auth/storage.py
+++ b/studio/backend/auth/storage.py
@@ -7,10 +7,11 @@ SQLite storage for authentication data (user credentials + JWT secret).
import hashlib
import sqlite3
from datetime import datetime, timezone
-from pathlib import Path
from typing import Optional, Tuple
-DB_PATH = Path(__file__).parent / "auth.db"
+from utils.paths import auth_db_path, ensure_dir
+
+DB_PATH = auth_db_path()
def _hash_token(token: str) -> str:
@@ -20,6 +21,7 @@ def _hash_token(token: str) -> str:
def get_connection() -> sqlite3.Connection:
"""Get a connection to the auth database, creating tables if needed."""
+ ensure_dir(DB_PATH.parent)
conn = sqlite3.connect(DB_PATH)
conn.row_factory = sqlite3.Row
conn.execute(
@@ -256,4 +258,3 @@ def revoke_user_refresh_tokens(username: str) -> None:
conn.commit()
finally:
conn.close()
-
diff --git a/studio/backend/utils/paths/__init__.py b/studio/backend/utils/paths/__init__.py
index 307f630a299..b13d9499248 100644
--- a/studio/backend/utils/paths/__init__.py
+++ b/studio/backend/utils/paths/__init__.py
@@ -13,6 +13,8 @@ from .storage_roots import (
recipe_datasets_root,
outputs_root,
exports_root,
+ auth_root,
+ auth_db_path,
tmp_root,
seed_uploads_root,
unstructured_seed_cache_root,
@@ -38,6 +40,8 @@ __all__ = [
'recipe_datasets_root',
'outputs_root',
'exports_root',
+ 'auth_root',
+ 'auth_db_path',
'tmp_root',
'seed_uploads_root',
'unstructured_seed_cache_root',
diff --git a/studio/backend/utils/paths/storage_roots.py b/studio/backend/utils/paths/storage_roots.py
index 58d2af16c15..a005d604a8e 100644
--- a/studio/backend/utils/paths/storage_roots.py
+++ b/studio/backend/utils/paths/storage_roots.py
@@ -32,6 +32,14 @@ def exports_root() -> Path:
return studio_root() / "exports"
+def auth_root() -> Path:
+ return studio_root() / "auth"
+
+
+def auth_db_path() -> Path:
+ return auth_root() / "auth.db"
+
+
def tmp_root() -> Path:
return Path(tempfile.gettempdir()) / "unsloth-studio"