drizzle-team / drizzle-team/drizzle-orm

[DOCS]: Inconsistent file paths between basic structure and setup steps in Supabase guide

Open
#4,492 0 comments 0 reactions 0 assignees View on GitHub
bug docs
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.43.1

### What version of `drizzle-kit` are you using?

0.31.1

### Other packages

_No response_

### Describe the Bug

### Summary

In the official docs at:
**Drizzle → Meet Drizzle → Getting Started → New Database → Supabase**

There’s an inconsistency between the **basic file structure** shown at the top, and the paths mentioned in **Step 3** and **Step 4**.

### Details

#### 🔹 The top "Basic File Structure" shows:
📦
├ 📂 drizzle
├ 📂 src
│ ├ 📂 db
│ │ └ 📜 schema.ts
│ └ 📜 index.ts
├ 📜 .env
├ 📜 drizzle.config.ts
├ 📜 package.json
└ 📜 tsconfig.json

#### 🔸 But Step 3 says:
> "Create an `index.ts` file in the `src/db` directory and initialize the connection"

Which implies:
📦 src/db/index.ts

#### 🔸 Step 4 also says:
> "Create a `schema.ts` file in the `src/db` directory..."

Which is consistent with Step 3, but not with the initial structure.

---
#### 🔹 Additional minor issue

In **Step 3 → Tips**, the provided example uses:

```ts const client = postgres(process.env.DATABASE_URL, { prepare: false });```

However, in strict TypeScript configurations (strictNullChecks), this will raise a type error, since process.env.DATABASE_URL is potentially undefined.

Suggested fix:

```const client = postgres(process.env.DATABASE_URL!, { prepare: false });```

Or alternatively, a safer version:

```
ts const url = process.env.DATABASE_URL;
if (!url) throw new Error("Missing DATABASE_URL");
const client = postgres(url, { prepare: false });
```
---

### Suggestion

It would be helpful to:

- Either update the **initial file structure diagram** to match the real setup (i.e. move `index.ts` under `src/db`)
- Or clarify the difference (e.g. if `src/index.ts` is for test usage, while `src/db/index.ts` initializes the db client)
- And in **Step 3 → Tips**, explicitly include a non-null assertion (`!`) or a null check when accessing `process.env.DATABASE_URL`, to prevent potential type errors in strict TypeScript environments

I'd be happy to submit a PR to fix the structure if needed!

---

### Version Info

- drizzle-orm: `0.43.1`
- drizzle-kit: `0.31.1`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.