🗄️ Database Setup (Neon) – One Database per Repository
This document explains:
- How to access Neon
- How to create a separate database for each repo
- How to get the DATABASE_URL
- How to link the database to Next.js / Backend via
.env - Recommended naming & region strategy
📌 Important Rule (READ FIRST)
Each repository MUST use its own database ❌ No shared databases ❌ No shared credentials ✅ One repo → one Neon database
This improves:
- Security
- Isolation
- Easier debugging
- Safe migrations
🧩 Repositories → Databases Mapping
| Repository | Database Name |
|---|---|
student_app_backend |
gecian_hub_backend |
gecian_events |
gecian_events |
gecian_project_archive |
gecian_project_showcase |
gecian_project_collaboration |
gecian_project_collab |
Gec_Hostel |
nearbt_hostel |
1️⃣ Go to Neon Console
- Open 👉 https://console.neon.tech
- Sign in with GitHub / Email
- You will land on the Projects dashboard
2️⃣ Create a New Neon Database (Per Repo)
Repeat these steps for each repository.
Step-by-step
- Click New Project
- Fill details:
| Field | Value |
|---|---|
| Project name | e.g. gecian_project_collab |
| Postgres version | Default (recommended) |
| Region | Choose closest to users |
| Branch | main |
- Click Create Project
⏳ Neon provisions the database automatically.
3️⃣ Choose Region (IMPORTANT)
Recommended Regions
| Repo | Region |
|---|---|
| India / Asia-facing apps | AWS Asia Pacific (Singapore) |
| Global / US-facing apps | AWS US East (N. Virginia) |
⚠️ Do not mix regions randomly
4️⃣ Get the Database Connection URL
After creation:
- Open the Neon project
- Go to Dashboard → Connection Details
- Copy Connection String
It looks like this:
Example:
5️⃣ Link Database to Each Repo (.env.local)
🔹 Backend / Next.js Repo
Inside the repository root:
Then edit .env.local:
6️⃣ Repo-wise .env Examples
🔸 student_app_backend
🔸 gecian_project_collaboration
🔸 gecian_project_archive
🔸 Gec_Hostel
8️⃣ Verify Connection Locally
Run:
If DB is connected correctly:
- No connection errors
- Migrations run successfully
- API routes work
9️⃣ Neon Dashboard – What You’ll See
For each database:
- Name
- Region
- Created At
- Storage
- Branches
- Integrations
Example:
🔐 Security Rules (MANDATORY)
- ❌ Never commit
.env.local - ❌ Never reuse DATABASE_URL across repos
- ✅ Use
.env.examplefor reference - ✅ Rotate credentials if leaked
npx drizzle-kit push also this to get teh scheme a there