Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docusaurus: Feat/da 139 finish tech switcher #5762

Merged
merged 11 commits into from
Apr 1, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: 'Relational databases'
metaTitle: 'Start from scratch with relational databases (15 min)'
metaDescription: 'Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your relational database and generating a Prisma Client for database access.'
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']
sidebar_custom_props: { badge: '15 min' }
sidebar_class_name: hidden-sidebar
---

<TopBlock
title={frontMatter.title}
langSwitcher={['typescript', 'node']}
dbSwitcher={['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']}
slug={"/getting-started/setup-prisma/start-from-scratch/relational-databases-"}
>

Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the [Prisma CLI](/orm/tools/prisma-cli), [Prisma Client](/orm/prisma-client), and [Prisma Migrate](/orm/prisma-migrate).

</TopBlock>

## Prerequisites

In order to successfully complete this guide, you need:

- [Node.js](https://nodejs.org/en/) installed on your machine
- a [CockroachDB](https://www.cockroachlabs.com/) database server running

> See [System requirements](/orm/reference/system-requirements) for exact version requirements.
Make sure you have your database [connection URL](/orm/reference/connection-urls) at hand. If you don't have a database server running and just want to explore Prisma ORM, check out the [Quickstart](/getting-started/quickstart).

## Create project setup

As a first step, create a project directory and navigate into it:

```terminal copy
mkdir hello-prisma
cd hello-prisma
```

Next, initialize a Node.js project and add the Prisma CLI as a development dependency to it:

```terminal copy
npm init -y
npm install prisma --save-dev
```

This creates a `package.json` with an initial setup for a Node.js app.

<NavigationLinksContainer isFirstLink>

<ButtonLink
color="dark"
type="primary"
href="./relational-databases/connect-your-database-node-cockroachdb"
arrow
>
Connect your database
</ButtonLink>

</NavigationLinksContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: 'Relational databases'
metaTitle: 'Start from scratch with relational databases (15 min)'
metaDescription: 'Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your relational database and generating a Prisma Client for database access.'
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']
sidebar_custom_props: { badge: '15 min' }
sidebar_class_name: hidden-sidebar
---

<TopBlock
title={frontMatter.title}
langSwitcher={['typescript', 'node']}
dbSwitcher={['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']}
slug={"/getting-started/setup-prisma/start-from-scratch/relational-databases-"}
>

Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the [Prisma CLI](/orm/tools/prisma-cli), [Prisma Client](/orm/prisma-client), and [Prisma Migrate](/orm/prisma-migrate).

</TopBlock>

## Prerequisites

In order to successfully complete this guide, you need:

- [Node.js](https://nodejs.org/en/) installed on your machine
- a [MySQL](https://www.mysql.com/) database server running

> See [System requirements](/orm/reference/system-requirements) for exact version requirements.
Make sure you have your database [connection URL](/orm/reference/connection-urls) at hand. If you don't have a database server running and just want to explore Prisma ORM, check out the [Quickstart](/getting-started/quickstart).

## Create project setup

As a first step, create a project directory and navigate into it:

```terminal copy
mkdir hello-prisma
cd hello-prisma
```

Next, initialize a Node.js project and add the Prisma CLI as a development dependency to it:

```terminal copy
npm init -y
npm install prisma --save-dev
```

This creates a `package.json` with an initial setup for a Node.js app.

<Admonition>

See [installation instructions](/orm/tools/prisma-cli#installation) to learn how to install Prisma using a different package manager.

</Admonition>

You can now invoke the Prisma CLI by prefixing it with `npx`:

```terminal
npx prisma
```

Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command:

```terminal copy
npx prisma init
```

This command does two things:

- creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models
- creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection)


<NavigationLinksContainer isFirstLink>

<ButtonLink
color="dark"
type="primary"
href="./relational-databases/connect-your-database-node-mysql"
arrow
>
Connect your database
</ButtonLink>

</NavigationLinksContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: 'Relational databases'
metaTitle: 'Start from scratch with relational databases (15 min)'
metaDescription: 'Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your relational database and generating a Prisma Client for database access.'
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']
sidebar_custom_props: { badge: '15 min' }
sidebar_class_name: hidden-sidebar
---

<TopBlock
title={frontMatter.title}
langSwitcher={['typescript', 'node']}
dbSwitcher={['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']}
slug={"/getting-started/setup-prisma/start-from-scratch/relational-databases-"}
>

Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the [Prisma CLI](/orm/tools/prisma-cli), [Prisma Client](/orm/prisma-client), and [Prisma Migrate](/orm/prisma-migrate).

</TopBlock>

## Prerequisites

In order to successfully complete this guide, you need:

- [Node.js](https://nodejs.org/en/) installed on your machine
- a [PlanetScale](https://www.planetscale.com/) database server running

<Admonition type="warning">

This tutorial will also assume that you can push to the `main` branch of your database. Do not do this if your `main` branch has been promoted to production.

</Admonition>

Next, initialize a Node.js project and add the Prisma CLI as a development dependency to it:

```terminal copy
npm init -y
npm install prisma --save-dev
```

This creates a `package.json` with an initial setup for a Node.js app.

<Admonition>

See [installation instructions](/orm/tools/prisma-cli#installation) to learn how to install Prisma using a different package manager.

</Admonition>

You can now invoke the Prisma CLI by prefixing it with `npx`:

```terminal
npx prisma
```

Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command:

```terminal copy
npx prisma init
```

This command does two things:

- creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models
- creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection)

<NavigationLinksContainer isFirstLink>

<ButtonLink
color="dark"
type="primary"
href="./relational-databases/connect-your-database-node-planetscale"
arrow
>
Connect your database
</ButtonLink>

</NavigationLinksContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: 'Relational databases'
metaTitle: 'Start from scratch with relational databases (15 min)'
metaDescription: 'Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your relational database and generating a Prisma Client for database access.'
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']
sidebar_custom_props: { badge: '15 min' }
sidebar_class_name: hidden-sidebar
---

<TopBlock
title={frontMatter.title}
langSwitcher={['typescript', 'node']}
dbSwitcher={['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']}
slug={"/getting-started/setup-prisma/start-from-scratch/relational-databases-"}
>

Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the [Prisma CLI](/orm/tools/prisma-cli), [Prisma Client](/orm/prisma-client), and [Prisma Migrate](/orm/prisma-migrate).

</TopBlock>

## Prerequisites

In order to successfully complete this guide, you need:

- [Node.js](https://nodejs.org/en/) installed on your machine
- a [PostgreSQL](https://www.postgresql.org/) database server running

> See [System requirements](/orm/reference/system-requirements) for exact version requirements.
Make sure you have your database [connection URL](/orm/reference/connection-urls) at hand. If you don't have a database server running and just want to explore Prisma ORM, check out the [Quickstart](/getting-started/quickstart).

## Create project setup

As a first step, create a project directory and navigate into it:

```terminal copy
mkdir hello-prisma
cd hello-prisma
```

Next, initialize a Node.js project and add the Prisma CLI as a development dependency to it:

```terminal copy
npm init -y
npm install prisma --save-dev
```

This creates a `package.json` with an initial setup for a Node.js app.

<Admonition>

See [installation instructions](/orm/tools/prisma-cli#installation) to learn how to install Prisma using a different package manager.

</Admonition>

You can now invoke the Prisma CLI by prefixing it with `npx`:

```terminal
npx prisma
```

Next, set up your Prisma ORM project by creating your [Prisma schema](/orm/prisma-schema) file with the following command:

```terminal copy
npx prisma init
```

This command does two things:

- creates a new directory called `prisma` that contains a file called `schema.prisma`, which contains the Prisma schema with your database connection variable and schema models
- creates the [`.env` file](/orm/more/development-environment/environment-variables/env-files) in the root directory of the project, which is used for defining environment variables (such as your database connection)

<NavigationLinksContainer isFirstLink>

<ButtonLink
color="dark"
type="primary"
href="./relational-databases/connect-your-database-node-postgresql"
arrow
>
Connect your database
</ButtonLink>

</NavigationLinksContainer>
Loading