diff --git a/.env.example b/.env.example
index 56e7c069252d39c8ba1059a0de2ae412634f5599..5b749851cc044dc5c9d53faa89dd4814a59d0696 100644
--- a/.env.example
+++ b/.env.example
@@ -1,11 +1,7 @@
-# Copy this file to .env
-
-APP_NAME = Shopping App
-# Change to your own database
-DATABASE_URL = mysql+pymysql://your_user:your_password@localhost/shopping     # This template use mysql
-# change your_user to your mysql username
-# change your_password to your mysql password
-# change localhost to 127.0.0.1 if youre running on local
-
-SECRET_KEY = your_secret_key
-DEBUG = True    # Only True or False
\ No newline at end of file
+APP_NAME="Shopping App"
+DATABASE_USERNAME="your_mysql_username"
+DATABASE_PASSWORD="your_mysql_password"
+DATABASE_HOST="127.0.0.1"
+DATABASE_NAME="shopping"
+SECRET_KEY="your_secret_key"
+DEBUG=True
diff --git a/app/core/config.py b/app/core/config.py
index 40459337d2bbf950eac401848775ddbf285218fb..6aed5e95bbf84aa6033c1e13f1693d42f3f566b5 100644
--- a/app/core/config.py
+++ b/app/core/config.py
@@ -4,14 +4,21 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
 
 class Settings(BaseSettings):
     app_name: str = "Shopping App"
-    database_url: str  # Ensure lowercase to match the .env key
+    database_username: str
+    database_password: str
+    database_host: str
+    database_name: str
     secret_key: str
     debug: bool = True
 
+    @property
+    def database_url(self) -> str:
+        return f"mysql+pymysql://{self.database_username}:{self.database_password}@{self.database_host}/{self.database_name}"
+
     model_config = SettingsConfigDict(
         env_file=str(Path(__file__).resolve().parent.parent / ".env"),
         env_file_encoding="utf-8",
-        case_sensitive=False,  # Allows case-insensitive environment variable keys
+        case_sensitive=False,
     )