Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
a30e0f0
continue docs
nikolasburk Mar 25, 2020
32559fb
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 25, 2020
94387aa
continue docs
nikolasburk Mar 25, 2020
eaf63db
continue docs
nikolasburk Mar 25, 2020
8aef877
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 25, 2020
92641e5
continue docs
nikolasburk Mar 25, 2020
9e310bd
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 25, 2020
2ba3253
continue docs
nikolasburk Mar 25, 2020
ab2b826
continue docs
nikolasburk Mar 25, 2020
843741d
continue docs
nikolasburk Mar 25, 2020
a49a310
Tech switcher
nilubava Mar 26, 2020
c9a8c8d
Select route
nilubava Mar 26, 2020
913817c
ajdust sidenav
nikolasburk Mar 27, 2020
0549b26
ajdust sidenav
nikolasburk Mar 27, 2020
68e2ed8
improve introduction
nikolasburk Mar 27, 2020
abd1ffe
Merge branch 'master' into content/init
nikolasburk Mar 27, 2020
84a1250
resolve merge conflict
nikolasburk Mar 27, 2020
046aeaa
Merge branch 'content/init' of github.com:prisma/prisma2-docs into co…
nikolasburk Mar 27, 2020
190614f
add landing page and adjust sidenav
nikolasburk Mar 27, 2020
ec94755
continue docs
nikolasburk Mar 27, 2020
6b039f0
continue docs
nikolasburk Mar 27, 2020
3e52a6b
landing page content
nikolasburk Mar 27, 2020
3b97ca3
continue docs
nikolasburk Mar 27, 2020
e4c5eb1
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 27, 2020
86ab3f3
Merge branch 'tech-switcher' of github.com:prisma/prisma2-docs into c…
nikolasburk Mar 27, 2020
4381320
continue docs
nikolasburk Mar 27, 2020
97cd0cb
default lang, db
nilubava Mar 27, 2020
e7dabc8
Merge branch 'tech-switcher' of github.com:prisma/prisma2-docs into c…
nikolasburk Mar 27, 2020
50432a8
Merged master
nilubava Mar 27, 2020
ff7134b
Bug fix for table
nilubava Mar 27, 2020
41ebbd3
add more tech combos for getting started
nikolasburk Mar 27, 2020
a23e07a
Added '*' to tech switcher + changed mongodb to sqlite
nilubava Mar 27, 2020
c58c9a5
Merged master
nilubava Mar 27, 2020
c704ea5
start new relation syntax
nikolasburk Mar 27, 2020
de76d03
new tech switcher
nikolasburk Mar 27, 2020
6cc181c
relations update
nikolasburk Mar 27, 2020
d046350
relations update
nikolasburk Mar 27, 2020
2d4e973
relations update
nikolasburk Mar 27, 2020
2b73996
relations update
nikolasburk Mar 27, 2020
6b6fc97
relations update
nikolasburk Mar 28, 2020
d13ffa4
resolve merge conflict
nikolasburk Mar 28, 2020
c4e9876
update quickstart with new relation syntax
nikolasburk Mar 28, 2020
27072f7
update setup guides with new relation syntax and more tech combos
nikolasburk Mar 28, 2020
2b8b56b
fix build
nikolasburk Mar 28, 2020
c357c83
fix build
nikolasburk Mar 28, 2020
fd43e21
adjhust to new relation syntax
nikolasburk Mar 28, 2020
4e9ff8f
adjhust to new relation syntax
nikolasburk Mar 28, 2020
97dd603
relation docs
nikolasburk Mar 28, 2020
ce24bf8
relation docs
nikolasburk Mar 28, 2020
8dd9e78
relation docs
nikolasburk Mar 28, 2020
9c49070
relation docs
nikolasburk Mar 28, 2020
303cca3
relation docs
nikolasburk Mar 28, 2020
f821b03
continue docs
nikolasburk Mar 28, 2020
52d1641
continue docs content
nikolasburk Mar 29, 2020
854d159
update links in GSE
nikolasburk Mar 29, 2020
edd560c
update links in Introduction
nikolasburk Mar 29, 2020
545eb3f
update links in Understand Prisma
nikolasburk Mar 29, 2020
956c844
update links in schema reference
nikolasburk Mar 29, 2020
f7b4565
update links in prisma client reference
nikolasburk Mar 29, 2020
3419891
update links in prisma client reference
nikolasburk Mar 29, 2020
0dfa33f
reslove merge conflicts
nikolasburk Mar 29, 2020
410b2a3
reslove merge conflicts
nikolasburk Mar 29, 2020
da4e519
reslove merge conflicts
nikolasburk Mar 29, 2020
c7a05f0
update links on more reference pages
nikolasburk Mar 29, 2020
d4b23df
update links on more reference pages
nikolasburk Mar 29, 2020
4a31f35
continue docs content
nikolasburk Mar 29, 2020
6b0e448
wrap up fixing links
nikolasburk Mar 29, 2020
59297da
wrap up fixing links
nikolasburk Mar 29, 2020
2f340bc
fix build
nikolasburk Mar 30, 2020
af525ce
Merge branch 'master' into content/init
nikolasburk Mar 30, 2020
7460033
fix build
nikolasburk Mar 30, 2020
fe7933f
Merge branch 'content/init' of github.com:prisma/prisma2-docs into co…
nikolasburk Mar 30, 2020
6f9cfdc
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 30, 2020
e1a3eec
attempt to fix build
nikolasburk Mar 30, 2020
109f12a
attempt to fix build
nikolasburk Mar 30, 2020
768d026
attempt to fix build
nikolasburk Mar 30, 2020
7adc701
attempt to fix build
nikolasburk Mar 30, 2020
7e4a63c
attempt to fix build
nikolasburk Mar 30, 2020
0f05de4
attempt to fix build
nikolasburk Mar 30, 2020
7dfb1d3
Merge branch 'master' into content/init
nikolasburk Mar 30, 2020
080b302
fix content on landing page
nikolasburk Mar 30, 2020
4f6c4d7
Merge branch 'content/init' of github.com:prisma/prisma2-docs into co…
nikolasburk Mar 30, 2020
7970762
add meta data
nikolasburk Mar 30, 2020
5c8ea9f
add meta data
nikolasburk Mar 30, 2020
e35217f
add meta data
nikolasburk Mar 30, 2020
1d6c173
add meta data
nikolasburk Mar 30, 2020
0b53474
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 30, 2020
230e672
add meta data
nikolasburk Mar 30, 2020
44bc580
add meta data
nikolasburk Mar 30, 2020
f2c411b
add meta data
nikolasburk Mar 30, 2020
d274c64
adjust diagrams
nikolasburk Mar 30, 2020
ba5a85f
adjust diagrams
nikolasburk Mar 30, 2020
e9f87be
Merge branch 'master' into content/init
nikolasburk Mar 30, 2020
bc895e3
fix link for supported platforms
nikolasburk Mar 30, 2020
b4e3428
Merge branch 'content/init' of github.com:prisma/prisma2-docs into co…
nikolasburk Mar 30, 2020
68463eb
Merge branch 'master' of github.com:prisma/prisma2-docs into content/…
nikolasburk Mar 30, 2020
519ce51
fix build
nikolasburk Mar 30, 2020
9604357
adjust diagrams
nikolasburk Mar 30, 2020
a9bed65
resolve merge conflict
nikolasburk Mar 30, 2020
973f9c1
fix TS link
nikolasburk Mar 30, 2020
90fca26
continue docs content
nikolasburk Mar 30, 2020
602d7f2
add guide for prisma migrate
nikolasburk Mar 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 53 additions & 14 deletions content/01-getting-started/01-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Open your terminal and download the starter project with the following command:
<SwitchTech technologies={['typescript']}>

```copy
curl https://codeload.github.com/prisma/prisma-examples/tar.gz/starter | tar -xz --strip=2 prisma-examples-starter/javascript/starter
curl https://codeload.github.com/prisma/prisma-examples/tar.gz/starter | tar -xz --strip=2 prisma-examples-starter/typescript/starter
```

</SwitchTech>
Expand Down Expand Up @@ -94,7 +94,7 @@ Note that the dependencies defined in your project are:
The starter project consists of five files:

- `package.json`: Defines your npm dependencies
- `prisma/schema.prisma`: [Prisma schema file](../reference/tools-and-interfaces/prisma-schema/
- `prisma/schema.prisma`: [Prisma schema file](../reference/tools-and-interfaces/prisma-schema/) defining your models
- `prisma/.env`: Defines your database connection URL as an environment variable
- `prisma/dev.db`: A SQLite database file
- `scr/index.js`: A plain, executable Node.js script
Expand Down Expand Up @@ -134,6 +134,35 @@ npm install

## Write your first query with Prisma Client

In this section, you will write your first query with Prisma Client. For reference, this is what the [Prisma schema](../reference/tools-and-interfaces/prisma-schema/prisma-schema-file) for which your Prisma Client was generated looks like:

```prisma
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}

generator client {
provider = "prisma-client-js"
}

model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}

model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
```

<SwitchTech technologies={['typescript']}>

The code inside `src/index.ts` currently looks as follows:
Expand Down Expand Up @@ -475,8 +504,19 @@ const deletedUser = await prisma.user.delete({

To learn how to connect Prisma to your own database, you can follow the respective setup guide:

- [Setup a new project with Prisma from scratch](./setup-prisma/start-from-scratch-sql)
- [Add Prisma to an existing project](./setup-prisma/add-to-an-existing-project)
<ButtonLink color="dark" type="primary" href="./setup-prisma/start-from-scratch-sql">
Setup a new project from scratch
</ButtonLink>

<br />
<br />

<ButtonLink color="dark" type="primary" href="./setup-prisma/add-to-an-existing-project">
Add Prisma to an existing project
</ButtonLink>

<!-- - [Setup a new project with Prisma from scratch](./setup-prisma/start-from-scratch-sql)
- [Add Prisma to an existing project](./setup-prisma/add-to-an-existing-project) -->

---

Expand Down Expand Up @@ -558,7 +598,6 @@ Now you can run the migration against the database `npx prisma migrate up --expe

</details>


Finally, re-generate Prisma Client with this command:

``` copy
Expand All @@ -579,17 +618,17 @@ The [`prisma-examples`](https://github.com/prisma/prisma-examples/) repository c

| Demo | Stack | Description |
| :----------------------------------------------------------------------------------------------------------------- | :----------- | --------------------------------------------------------------------------------------------------- |
| [`rest-nextjs`](https://github.com/prisma/prisma-examples/typescript/rest-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a REST API |
| [`graphql-nextjs`](https://github.com/prisma/prisma-examples/typescript/graphql-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a GraphQL API |
| [`graphql-apollo-server`](https://github.com/prisma/prisma-examples/typescript/graphql-apollo-server) | Backend only | Simple GraphQL server based on [`apollo-server`](https://www.apollographql.com/docs/apollo-server/) |
| [`rest-express`](https://github.com/prisma/prisma-examples/typescript/rest-express) | Backend only | Simple REST API with Express.JS |
| [`grpc`](https://github.com/prisma/prisma-examples/typescript/grpc) | Backend only | Simple gRPC API |
| [`rest-nextjs`](https://github.com/prisma/prisma-examples/tree/prisma2/typescript/rest-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a REST API |
| [`graphql-nextjs`](https://github.com/prisma/prisma-examples/tree/prisma2/typescript/graphql-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a GraphQL API |
| [`graphql-apollo-server`](https://github.com/prisma/prisma-examples/tree/prisma2/typescript/graphql-apollo-server) | Backend only | Simple GraphQL server based on [`apollo-server`](https://www.apollographql.com/docs/apollo-server/) |
| [`rest-express`](https://github.com/prisma/prisma-examples/tree/prisma2/typescript/rest-express) | Backend only | Simple REST API with Express.JS |
| [`grpc`](https://github.com/prisma/prisma-examples/tree/prisma2/typescript/grpc) | Backend only | Simple gRPC API |

**JavaScript (Node.js)**

| Demo | Stack | Description |
| :----------------------------------------------------------------------------------------------------------------- | :----------- | :-------------------------------------------------------------------------------------------------- |
| [`rest-nextjs`](https://github.com/prisma/prisma-examples/javascript/rest-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a REST API |
| [`graphql-apollo-server`](https://github.com/prisma/prisma-examples/javascript/graphql-apollo-server) | Backend only | Simple GraphQL server based on [`apollo-server`](https://www.apollographql.com/docs/apollo-server/) |
| [`rest-express`](https://github.com/prisma/prisma-examples/javascript/rest-express) | Backend only | Simple REST API with Express.JS |
| [`grpc`](https://github.com/prisma/prisma-examples/javascript/grpc) | Backend only | Simple gRPC API |
| [`rest-nextjs`](https://github.com/prisma/prisma-examples/tree/prisma2/javascript/rest-nextjs) | Fullstack | Simple [Next.js](https://nextjs.org/) app (React) with a REST API |
| [`graphql-apollo-server`](https://github.com/prisma/prisma-examples/tree/prisma2/javascript/graphql-apollo-server) | Backend only | Simple GraphQL server based on [`apollo-server`](https://www.apollographql.com/docs/apollo-server/) |
| [`rest-express`](https://github.com/prisma/prisma-examples/tree/prisma2/javascript/rest-express) | Backend only | Simple REST API with Express.JS |
| [`grpc`](https://github.com/prisma/prisma-examples/tree/prisma2/javascript/grpc) | Backend only | Simple gRPC API |
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ This page walks you through the process of adding Prisma to a **Node.js** projec

</SwitchTech>

You can also watch this short [video series](https://www.youtube.com/playlist?list=PLn2e1F9Rfr6k9PnR_figWOcSHgc_erDr5) that shows the Prisma setup process with an existing database.

## Prerequisites

In order to successfully complete this guide, you need:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Start from scratch'
metaTitle: 'Setup a new projecct with Prisma from scratch (15 min)'
metaTitle: 'Setup a new project with Prisma from scratch (SQL)'
metaDescription: 'Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma to your database and generating Prisma Client for database access.'
dbSwitcher: true
langSwitcher: true
Expand Down
Loading