- לך ל: https://www.mongodb.com/cloud/atlas/register
- הירשם עם Google/GitHub או אימייל
- בחר Free (M0)
- בחר Create a deployment
- בחר M0 Free (512MB חינם)
- בחר Provider: AWS
- בחר Region: קרוב אליך (Europe - Frankfurt)
- שם ל-Cluster:
otzaria-cluster - לחץ Create Deployment
- תראה מסך "Security Quickstart"
- Username:
otzaria-user - Password: צור סיסמה חזקה (שמור אותה!)
- לחץ Create Database User
- במסך "Where would you like to connect from?"
- בחר My Local Environment
- IP Address: הקלד
0.0.0.0/0(גישה מכל מקום) - Description:
Allow all - לחץ Add Entry
- לחץ Finish and Close
- לחץ על Connect (ליד שם ה-Cluster)
- בחר Drivers
- בחר Node.js וגרסה 6.8 or later
- העתק את ה-Connection String:
mongodb+srv://otzaria-user:<password>@otzaria-cluster.xxxxx.mongodb.net/?retryWrites=true&w=majority
- לך ל: https://vercel.com/dashboard
- בחר את הפרויקט otzariaeditor
- Settings → Environment Variables
- הוסף משתנה חדש:
- Name:
DATABASE_URL - Value: ה-Connection String (החלף
<password>בסיסמה שיצרת!) - Environments: בחר את כל 3 (Production, Preview, Development)
- Name:
- לחץ Save
הוסף גם:
-
NEXTAUTH_URL
- Value:
https://otzariaeditor.vercel.app - Environments: Production
- Value:
-
NEXTAUTH_SECRET
- Value:
uXtB7d2N+lJDKvsENu2y8sXsmfrfa1qH2XsIiQN8X9k - Environments: כל 3
- Value:
הרץ: deploy-vercel.bat ובחר 3 (Production)
האתר שלך יהיה חי עם מסד נתונים עובד ב: https://otzariaeditor.vercel.app
mongodb+srv://otzaria-user:MyPassword123@otzaria-cluster.abc123.mongodb.net/otzaria?retryWrites=true&w=majority
שים לב:
- החלף
<password>בסיסמה האמיתית - אם הסיסמה מכילה תווים מיוחדים (@, :, /, וכו'), צריך לעשות URL encoding