You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Open the code repository's [GitHub repository](https://github.com/cockroachdb/prisma-examples).
30
+
1. Fork it by clicking **Fork** at the top. Netlify requires you to own a Netlify app's repository.
31
+
- Set **Owner** to your GitHub identity or an organization.
32
+
- Disable **Copy the master branch only**.
33
+
- Click **Fork**.
28
34
29
-
1. Create a [GitHub](https://github.com/) account if you haven't already.
30
-
1. In GitHub, [create your own fork](https://docs.github.com/get-started/quickstart/fork-a-repo#forking-a-repository) of CockroachDB's [`prisma-examples` repo](https://github.com/cockroachdb/prisma-examples).
35
+
You now have an exact copy of the code repository in the GitHub location you chose.
36
+
1. Copy the fork's address, which you will use to clone it locally. Click **Code**, then in the **Local** tab, click **SSH** if you have added SSH keys to GitHub, or **HTTPS** if not. Click the copy symbol to copy the address.
37
+
1. Clone your fork locally. Replace `{ADDRESS}` with the full address of your fork, which will end with `prisma-examples.git`.
1. From the [Vercel dashboard](https://vercel.com/dashboard), click **Add new...** > **Project**.
35
44
1. Select the `prisma-examples` repository you forked in [Step 1](#step-1-get-the-code) to import.
@@ -43,22 +52,19 @@ Before starting the tutorial, do the following:
43
52
44
53
Your deployment will fail until you integrate CockroachDB in the next step, so you can leave this screen without waiting for it to finish.
45
54
46
-
## Step 3. Integrate CockroachDB
55
+
## Step 4. Integrate your project with CockroachDB
47
56
48
57
1. Navigate to the [CockroachDB page](https://vercel.com/integrations/cockroachdb) of Vercel's integration marketplace.
49
58
1. Click **Add Integration**.
50
59
1. Select your Vercel account and click **Continue**.
51
60
1. Select the project you just created and click **Continue**.
52
61
1. Accept the permissions and click **Add Integration**.
62
+
1. When prompted, log into CockroachDB Cloud and select the organization and cluster to integrate with.
63
+
1. Click **Create** to finish the integration.
53
64
54
-
A window will pop up prompting you to log in to CockroachDB {{ site.data.products.cloud }} if you haven't already.
55
-
56
-
1. In the CockroachDB {{ site.data.products.cloud }} pop-up window, select the organization in which you want to create a new CockroachDB {{ site.data.products.standard }} cluster.
57
-
1. Click **Create**.
65
+
After a few seconds, the window will close automatically and your Vercel project will have the `DATABASE_URL` environment variable configured with the cluster's connection string.
58
66
59
-
After a few seconds, your cluster will be created and the pop-up window will close automatically. Once this is done, your Vercel project will have the `DATABASE_URL` environment variable automatically populated with the connection string for your new cluster.
60
-
61
-
## Step 3. Deploy the application
67
+
## Step 5. Deploy the application
62
68
63
69
1. Navigate to the **Overview** page for your Vercel project.
64
70
1. Select the **Deployments** tab.
@@ -69,56 +75,14 @@ Before starting the tutorial, do the following:
## Step 1. Create a CockroachDB {{ site.data.products.standard }} cluster
74
-
75
-
{% include cockroachcloud/quickstart/create-free-trial-standard-cluster.md %}
76
-
77
-
<aname="connection-string"></a>
78
-
79
-
After the cluster is created, the **Connection info** window appears. Click the **Connection string** tab and copy the connection string to a secure location. You will use this connection string to connect to CockroachDB later in the tutorial.
80
-
81
-
{{site.data.alerts.callout_info}}
82
-
The connection string is pre-populated with your username, cluster name, and other details, including your password. Your password, in particular, will be provided only once. Save it in a secure place (we recommend a password manager) to connect to your cluster in the future. If you forget your password, you can reset it by going to the **SQL Users** page for the cluster, found at `https://cockroachlabs.cloud/cluster/<CLUSTER ID>/users`.
83
-
{{site.data.alerts.end}}
84
-
85
-
## Step 2. Get the code
86
-
87
-
1. Clone the `cockroachdb` fork of the `prisma-examples` repo:
1. Navigate to the `rest-nextjs-api-routes` directory:
95
-
96
-
{% include_cached copy-clipboard.html %}
97
-
~~~ shell
98
-
$ cd typescript/rest-nextjs-api-routes
99
-
~~~
100
-
101
-
1. Install the application dependencies:
102
-
103
-
{% include_cached copy-clipboard.html %}
104
-
~~~ shell
105
-
$ npm install
106
-
~~~
107
-
108
-
1. Install the `vercel` and `prisma` CLI tools:
109
-
110
-
{% include_cached copy-clipboard.html %}
111
-
~~~ shell
112
-
$ npm install --global vercel prisma
113
-
~~~
114
78
115
79
## Step 3. Initialize the database
116
80
117
81
1. Save [the connection string](#connection-string) you obtained earlier from the CockroachDB {{ site.data.products.cloud }} Console to the `DATABASE_URL` environment variable in an `.env` file in your project:
118
82
119
83
{% include_cached copy-clipboard.html %}
120
84
~~~shell
121
-
$ echo"DATABASE_URL=<connection-string>">> .env
85
+
echo"DATABASE_URL=<connection-string>">> .env
122
86
~~~
123
87
124
88
Prisma loads the variables defined in`.env` to the project environment. By default, Prisma uses the `DATABASE_URL` environment variable as the connection string to the database.
@@ -127,7 +91,7 @@ The connection string is pre-populated with your username, cluster name, and oth
127
91
128
92
{% include_cached copy-clipboard.html %}
129
93
~~~ shell
130
-
$ prisma migrate dev --name init
94
+
prisma migrate dev --name init
131
95
~~~
132
96
133
97
You should see the following output:
@@ -146,7 +110,7 @@ The connection string is pre-populated with your username, cluster name, and oth
146
110
147
111
{% include_cached copy-clipboard.html %}
148
112
~~~ shell
149
-
$ npm run dev
113
+
npm run dev
150
114
~~~
151
115
152
116
You should see the following output:
@@ -159,7 +123,7 @@ The connection string is pre-populated with your username, cluster name, and oth
159
123
160
124
{% include_cached copy-clipboard.html %}
161
125
~~~ shell
162
-
$ vercel deploy --confirm
126
+
vercel deploy --confirm
163
127
~~~
164
128
165
129
You will be asked to sign into your Vercel account. When you authenticate your credentials, you should see the following message:
@@ -179,7 +143,7 @@ The connection string is pre-populated with your username, cluster name, and oth
179
143
~~~
180
144
181
145
Follow the links provided to view and manage your deployed application.
182
-
146
+
183
147
</section>
184
148
185
149
## See also
@@ -188,4 +152,4 @@ The connection string is pre-populated with your username, cluster name, and oth
188
152
- [How to build a Complete Webapp with React, TypeScript & CockroachDB](https://www.cockroachlabs.com/blog/react-typescript-cockroachdb-sample-app/#deploy-the-application-to-netlify)
189
153
- [Build a Simple CRUD Node.js App with CockroachDB and Prisma Client]({% link {{ page.version.version }}/build-a-nodejs-app-with-cockroachdb-prisma.md %})
190
154
191
-
{% include {{page.version.version}}/app/see-also-links.md %}
0 commit comments