From b73d52919a04bd2b7b2e9b20325c7f0ce9fd2fb3 Mon Sep 17 00:00:00 2001 From: Aidan McAlister Date: Tue, 4 Nov 2025 13:49:32 -0500 Subject: [PATCH 1/6] added env vars section to various pages --- .../01-quickstart-prismaPostgres.mdx | 30 +++++++++++------- .../01-quickstart-sqlite.mdx | 29 +++++++++++++++-- .../010-generating-prisma-client.mdx | 29 +++++++++++++++++ .../325-prisma-config-reference.mdx | 31 ++++++++++++++++++- 4 files changed, 105 insertions(+), 14 deletions(-) diff --git a/content/100-getting-started/01-quickstart-prismaPostgres.mdx b/content/100-getting-started/01-quickstart-prismaPostgres.mdx index 404c632267..3324146637 100644 --- a/content/100-getting-started/01-quickstart-prismaPostgres.mdx +++ b/content/100-getting-started/01-quickstart-prismaPostgres.mdx @@ -44,23 +44,31 @@ At this point, you'll be redirected to the **Database** page where you will need Once the green **`CONNECTED`** label appears, your database is ready to use! -## 2. Download example and install dependencies +## 2. Configure environment variables -Copy the `try-prisma` command that's shown in the Console, paste it into your terminal and execute it. +First, install the required dependency: -For reference, this is what the command looks like: +```bash +npm install dotenv --save-dev +``` -```terminal -npx try-prisma@latest \ - --template databases/prisma-postgres \ - --name hello-prisma \ - --install npm +Create a `.env` file in your project root (if it doesn't exist) and add your database connection string: + +```env +DATABASE_URL="your_database_url_here" ``` -Once the `try-prisma` command has terminated, navigate into the project directory: +Update your `prisma.config.ts` file in your project root: -```terminal -cd hello-prisma +```ts +import "dotenv/config"; +import { defineConfig, env } from "prisma/config"; + +export default defineConfig({ + datasource: { + url: env("DATABASE_URL"), + }, +}); ``` ## 3. Set database connection URL diff --git a/content/100-getting-started/01-quickstart-sqlite.mdx b/content/100-getting-started/01-quickstart-sqlite.mdx index 79feb9783b..2fc54c1364 100644 --- a/content/100-getting-started/01-quickstart-sqlite.mdx +++ b/content/100-getting-started/01-quickstart-sqlite.mdx @@ -93,9 +93,34 @@ Models in the Prisma schema have two main purposes: - Represent the tables in the underlying database - Serve as foundation for the generated Prisma Client API -In the next section, you will map these models to database tables using Prisma Migrate. +## 3. Configure environment variables -## 3. Run a migration to create your database tables with Prisma Migrate +First, install the required dependency: + +```bash +npm install dotenv --save-dev +``` + +Create a `.env` file in your project root (if it doesn't exist) and add your database connection string: + +```env +DATABASE_URL="your_database_url_here" +``` + +Update your `prisma.config.ts` file in your project root: + +```ts +import "dotenv/config"; +import { defineConfig, env } from "prisma/config"; + +export default defineConfig({ + datasource: { + url: env("DATABASE_URL"), + }, +}); +``` + +## 4. Run a migration to create your database tables with Prisma Migrate At this point, you have a Prisma schema but no database yet. Run the following command in your terminal to create the SQLite database and the `User` and `Post` tables represented by your models: diff --git a/content/200-orm/200-prisma-client/000-setup-and-configuration/010-generating-prisma-client.mdx b/content/200-orm/200-prisma-client/000-setup-and-configuration/010-generating-prisma-client.mdx index fa86ed9fa5..8e7d257bf2 100644 --- a/content/200-orm/200-prisma-client/000-setup-and-configuration/010-generating-prisma-client.mdx +++ b/content/200-orm/200-prisma-client/000-setup-and-configuration/010-generating-prisma-client.mdx @@ -124,6 +124,35 @@ For improved compatibility with ECMAScript modules (ESM) and to ensure consisten ::: +## Loading environment variables + +To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management. + +1. First, install the required dependency: + + ```bash + npm install dotenv --save-dev + ``` + +2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string: + + ```env + DATABASE_URL="your_database_connection_string_here" + ``` + +3. Update your `prisma.config.ts` file in your project root: + + ```ts + import "dotenv/config"; + import { defineConfig, env } from "prisma/config"; + + export default defineConfig({ + datasource: { + url: env("DATABASE_URL"), + }, + }); + ``` + ## The `@prisma/client` npm package The `@prisma/client` npm package consists of two key parts: diff --git a/content/200-orm/500-reference/325-prisma-config-reference.mdx b/content/200-orm/500-reference/325-prisma-config-reference.mdx index 2ecf7bfdaf..d7a5492238 100644 --- a/content/200-orm/500-reference/325-prisma-config-reference.mdx +++ b/content/200-orm/500-reference/325-prisma-config-reference.mdx @@ -597,4 +597,33 @@ You can specify a custom location for your config file when running Prisma CLI c ```terminal prisma validate --config ./path/to/myconfig.ts -``` \ No newline at end of file +``` + +## Loading environment variables + +To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management. + +1. First, install the required dependency: + + ```bash + npm install dotenv --save-dev + ``` + +2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string: + + ```env + DATABASE_URL="your_database_connection_string_here" + ``` + +3. Update your `prisma.config.ts` file in your project root: + + ```ts + import "dotenv/config"; + import { defineConfig, env } from "prisma/config"; + + export default defineConfig({ + datasource: { + url: env("DATABASE_URL"), + }, + }); + ``` \ No newline at end of file From 491c11f62dd5d88992e24a5f0b88766941d98e8d Mon Sep 17 00:00:00 2001 From: Aidan McAlister Date: Tue, 4 Nov 2025 13:58:57 -0500 Subject: [PATCH 2/6] minor coderabbit updates --- .coderabbit.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 32aff8c11a..873a29ff16 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,6 +1,7 @@ # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json # yaml template to refer to https://docs.coderabbit.ai/reference/yaml-template#enterprise language: "en-US" +tone_instructions: "You are a principal engineer with natural teaching abilities. You detect issues and clearly explain why." reviews: collapse_walkthrough: false profile: "chill" @@ -14,6 +15,7 @@ reviews: auto_review: enabled: true drafts: false + base_branches: [".*"] finishing_touches: docstrings: enabled: false From 75746a3ce5cd9de5ddb0226e3bcb2c27d55026d3 Mon Sep 17 00:00:00 2001 From: Aidan McAlister Date: Tue, 4 Nov 2025 14:01:27 -0500 Subject: [PATCH 3/6] verbose removed --- .github/workflows/lychee.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index 72cf3fa499..77fd19f35a 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -25,7 +25,6 @@ jobs: --cache --cache-exclude-status 429,500,502,503,504 --max-cache-age 5m - --verbose --no-progress --accept 200,201,204,304,403,429 --timeout 20 @@ -50,7 +49,6 @@ jobs: args: > --cache --max-cache-age 5m - --verbose --no-progress --accept 200,201,204,304,403,429 --cache-exclude-status 429,500,502,503,504 From 154b8c29158d9c4ec02e8b73e2cb524844ac50f2 Mon Sep 17 00:00:00 2001 From: Aidan McAlister Date: Tue, 4 Nov 2025 15:18:32 -0500 Subject: [PATCH 4/6] test removed redirect list --- .github/workflows/lychee.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index 77fd19f35a..0b705f533c 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -77,8 +77,8 @@ jobs: fi if [ -n "$REPORT_FILE" ]; then - # Read the original output - ORIGINAL=$(cat "$REPORT_FILE") + # Read the original output and remove everything after 'Redirects per input' + ORIGINAL=$(cat "$REPORT_FILE" | sed '/^##* Redirects per input/,$d') # Create formatted output cat > lychee/formatted.md << EOF @@ -90,7 +90,7 @@ jobs: EOF - # Append the original content with title replacement + # Append the cleaned content with title replacement echo "$ORIGINAL" | sed 's/^# Summary$//' | sed 's/^## Summary$//' >> lychee/formatted.md fi From 37327b7f0ed46d25c2e3c91ecbf6fefeda61e67e Mon Sep 17 00:00:00 2001 From: Aidan McAlister Date: Tue, 4 Nov 2025 15:20:18 -0500 Subject: [PATCH 5/6] removed quickstart addition --- .../01-quickstart-prismaPostgres.mdx | 29 +------------------ .../01-quickstart-sqlite.mdx | 29 +------------------ 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/content/100-getting-started/01-quickstart-prismaPostgres.mdx b/content/100-getting-started/01-quickstart-prismaPostgres.mdx index 3324146637..d005047a37 100644 --- a/content/100-getting-started/01-quickstart-prismaPostgres.mdx +++ b/content/100-getting-started/01-quickstart-prismaPostgres.mdx @@ -44,34 +44,7 @@ At this point, you'll be redirected to the **Database** page where you will need Once the green **`CONNECTED`** label appears, your database is ready to use! -## 2. Configure environment variables - -First, install the required dependency: - -```bash -npm install dotenv --save-dev -``` - -Create a `.env` file in your project root (if it doesn't exist) and add your database connection string: - -```env -DATABASE_URL="your_database_url_here" -``` - -Update your `prisma.config.ts` file in your project root: - -```ts -import "dotenv/config"; -import { defineConfig, env } from "prisma/config"; - -export default defineConfig({ - datasource: { - url: env("DATABASE_URL"), - }, -}); -``` - -## 3. Set database connection URL +## 2. Set database connection URL The connection to your database is configured via an environment variable in a `.env` file. diff --git a/content/100-getting-started/01-quickstart-sqlite.mdx b/content/100-getting-started/01-quickstart-sqlite.mdx index 2fc54c1364..6a4a3e548c 100644 --- a/content/100-getting-started/01-quickstart-sqlite.mdx +++ b/content/100-getting-started/01-quickstart-sqlite.mdx @@ -93,34 +93,7 @@ Models in the Prisma schema have two main purposes: - Represent the tables in the underlying database - Serve as foundation for the generated Prisma Client API -## 3. Configure environment variables - -First, install the required dependency: - -```bash -npm install dotenv --save-dev -``` - -Create a `.env` file in your project root (if it doesn't exist) and add your database connection string: - -```env -DATABASE_URL="your_database_url_here" -``` - -Update your `prisma.config.ts` file in your project root: - -```ts -import "dotenv/config"; -import { defineConfig, env } from "prisma/config"; - -export default defineConfig({ - datasource: { - url: env("DATABASE_URL"), - }, -}); -``` - -## 4. Run a migration to create your database tables with Prisma Migrate +## 3. Run a migration to create your database tables with Prisma Migrate At this point, you have a Prisma schema but no database yet. Run the following command in your terminal to create the SQLite database and the `User` and `Post` tables represented by your models: From 70236aaf6bf1a2a819912703ea03d6268de7753c Mon Sep 17 00:00:00 2001 From: Aidan McAlister Date: Tue, 4 Nov 2025 15:49:04 -0500 Subject: [PATCH 6/6] converted quickstarts back --- .../01-quickstart-prismaPostgres.mdx | 21 ++++++++++++++++++- .../01-quickstart-sqlite.mdx | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/content/100-getting-started/01-quickstart-prismaPostgres.mdx b/content/100-getting-started/01-quickstart-prismaPostgres.mdx index d005047a37..404c632267 100644 --- a/content/100-getting-started/01-quickstart-prismaPostgres.mdx +++ b/content/100-getting-started/01-quickstart-prismaPostgres.mdx @@ -44,7 +44,26 @@ At this point, you'll be redirected to the **Database** page where you will need Once the green **`CONNECTED`** label appears, your database is ready to use! -## 2. Set database connection URL +## 2. Download example and install dependencies + +Copy the `try-prisma` command that's shown in the Console, paste it into your terminal and execute it. + +For reference, this is what the command looks like: + +```terminal +npx try-prisma@latest \ + --template databases/prisma-postgres \ + --name hello-prisma \ + --install npm +``` + +Once the `try-prisma` command has terminated, navigate into the project directory: + +```terminal +cd hello-prisma +``` + +## 3. Set database connection URL The connection to your database is configured via an environment variable in a `.env` file. diff --git a/content/100-getting-started/01-quickstart-sqlite.mdx b/content/100-getting-started/01-quickstart-sqlite.mdx index 6a4a3e548c..79feb9783b 100644 --- a/content/100-getting-started/01-quickstart-sqlite.mdx +++ b/content/100-getting-started/01-quickstart-sqlite.mdx @@ -93,6 +93,8 @@ Models in the Prisma schema have two main purposes: - Represent the tables in the underlying database - Serve as foundation for the generated Prisma Client API +In the next section, you will map these models to database tables using Prisma Migrate. + ## 3. Run a migration to create your database tables with Prisma Migrate At this point, you have a Prisma schema but no database yet. Run the following command in your terminal to create the SQLite database and the `User` and `Post` tables represented by your models: