Skip to content

Commit e194b33

Browse files
committed
feat: dockerfile, seeded, prisma schema updated
1 parent fd41657 commit e194b33

File tree

7 files changed

+89
-29
lines changed

7 files changed

+89
-29
lines changed

.env.example

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
# NEXTAUTH_SECRET=""
2121
NEXTAUTH_URL="http://localhost:3000"
2222

23+
POSTGRES_HOST=127.0.0.1
24+
POSTGRES_PORT=6500
25+
POSTGRES_USER=admin
26+
POSTGRES_PASSWORD=password123
27+
POSTGRES_DATABASE=nextauth_prisma
28+
29+
DATABASE_URL=postgresql://admin:password123@localhost:6500/nextauth_prisma?schema=public
30+
2331
POSTGRES_URL=
24-
POSTGRES_PRISMA_URL=
25-
POSTGRES_URL_NON_POOLING=
26-
POSTGRES_USER=
27-
POSTGRES_HOST=
28-
POSTGRES_PASSWORD=
29-
POSTGRES_DATABASE=
32+
POSTGRES_PRISMA_URL=postgresql://admin:password123@localhost:6500/nextauth_prisma?schema=public
33+
POSTGRES_URL_NON_POOLING=postgresql://admin:password123@localhost:6500/nextauth_prisma?schema=public
3034

3135
NEXT_PUBLIC_WALLET_CONNECT_ID=

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ run through the live site and make sure the code is performing as expected.
8181

8282
**Prerequisites:**
8383

84-
node --version 16.x
84+
node --version 18.x
8585

8686
Refer to the `node` and `npm` installation with `nvm` guide in Lesson 2. A link
8787
to the guide can be found

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: "3"
2+
services:
3+
postgres:
4+
image: postgres:latest
5+
container_name: postgres
6+
ports:
7+
- "6500:5432"
8+
volumes:
9+
- progresDB:/var/lib/postgresql/data
10+
env_file:
11+
- ./.env
12+
volumes:
13+
progresDB:

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"dev": "next dev",
88
"postinstall": "prisma generate",
99
"lint": "next lint",
10-
"start": "next start"
10+
"start": "next start",
11+
"prisma:seed": "npx prisma db seed"
12+
},
13+
"prisma": {
14+
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
1115
},
1216
"dependencies": {
1317
"@chakra-ui/icons": "^2.0.19",
@@ -16,7 +20,7 @@
1620
"@emotion/styled": "^11.11.0",
1721
"@fontsource/inter": "^5.0.3",
1822
"@next-auth/prisma-adapter": "^1.0.7",
19-
"@prisma/client": "^5.0.0",
23+
"@prisma/client": "^5.1.1",
2024
"@rainbow-me/rainbowkit": "^1.0.8",
2125
"@rainbow-me/rainbowkit-siwe-next-auth": "^0.3.0",
2226
"@tanstack/react-query": "^4.29.19",
@@ -26,6 +30,7 @@
2630
"@trpc/react-query": "^10.33.0",
2731
"@trpc/server": "^10.33.0",
2832
"@vercel/postgres": "^0.4.0",
33+
"bcryptjs": "^2.4.3",
2934
"ethers": "^6",
3035
"framer-motion": "^10.12.17",
3136
"next": "^13.4.7",
@@ -45,6 +50,7 @@
4550
"@mdx-js/loader": "^2.3.0",
4651
"@mdx-js/react": "^2.3.0",
4752
"@next/mdx": "^13.4.8",
53+
"@types/bcryptjs": "^2.4.2",
4854
"@types/eslint": "^8.40.2",
4955
"@types/mdx": "^2.0.5",
5056
"@types/node": "^20.3.2",
@@ -63,10 +69,11 @@
6369
"postcss": "^8.4.24",
6470
"prettier": "^2.8.8",
6571
"prettier-plugin-tailwindcss": "0.2.1",
66-
"prisma": "^5.0.0",
72+
"prisma": "^5.1.1",
6773
"react-syntax-highlighter": "^15.5.0",
6874
"remark-frontmatter": "^4.0.1",
6975
"tailwindcss": "^3.3.2",
76+
"ts-node": "^10.9.1",
7077
"typescript": "^5.1.6"
7178
},
7279
"ct3aMetadata": {

prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ model Account {
3939

4040
model User {
4141
id String @id @default(cuid())
42+
password String?
4243
name String?
4344
address String? @unique
4445
email String? @unique

prisma/seed.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { PrismaClient } from "@prisma/client";
2+
import { hash } from "bcryptjs";
3+
4+
const prisma = new PrismaClient();
5+
6+
async function main() {
7+
const password = (await hash("password123", 12)) as string;
8+
const user = await prisma.user.upsert({
9+
where: { email: "[email protected]" },
10+
update: {},
11+
create: {
12+
13+
name: "Admin",
14+
password,
15+
},
16+
});
17+
console.log({ user });
18+
}
19+
main()
20+
.then(() => prisma.$disconnect())
21+
.catch(async (e) => {
22+
console.error(e);
23+
await prisma.$disconnect();
24+
process.exit(1);
25+
});

yarn.lock

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,22 +1600,22 @@
16001600
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f"
16011601
integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==
16021602

1603-
"@prisma/client@^5.0.0":
1604-
version "5.0.0"
1605-
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.0.0.tgz#9f0cd4164f4ffddb28bb1811c27eb7fa1e01a087"
1606-
integrity sha512-XlO5ELNAQ7rV4cXIDJUNBEgdLwX3pjtt9Q/RHqDpGf43szpNJx2hJnggfFs7TKNx0cOFsl6KJCSfqr5duEU/bQ==
1603+
"@prisma/client@^5.1.1":
1604+
version "5.1.1"
1605+
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.1.1.tgz#ea2b0c8599bdb3f86d92e8df46fba795a744db01"
1606+
integrity sha512-fxcCeK5pMQGcgCqCrWsi+I2rpIbk0rAhdrN+ke7f34tIrgPwA68ensrpin+9+fZvuV2OtzHmuipwduSY6HswdA==
16071607
dependencies:
1608-
"@prisma/engines-version" "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584"
1608+
"@prisma/engines-version" "5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e"
16091609

1610-
"@prisma/engines-version@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584":
1611-
version "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584"
1612-
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584.tgz#b36eda5620872d3fac810c302a7e46cf41daa033"
1613-
integrity sha512-HHiUF6NixsldsP3JROq07TYBLEjXFKr6PdH8H4gK/XAoTmIplOJBCgrIUMrsRAnEuGyRoRLXKXWUb943+PFoKQ==
1610+
"@prisma/engines-version@5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e":
1611+
version "5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e"
1612+
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e.tgz#2e8a1f098ec09452dbe00923b24f582f95d1747c"
1613+
integrity sha512-owZqbY/wucbr65bXJ/ljrHPgQU5xXTSkmcE/JcbqE1kusuAXV/TLN3/exmz21SZ5rJ7WDkyk70J2G/n68iogbQ==
16141614

1615-
"@prisma/engines@5.0.0":
1616-
version "5.0.0"
1617-
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.0.0.tgz#5249650eabe77c458c90f2be97d8210353c2e22e"
1618-
integrity sha512-kyT/8fd0OpWmhAU5YnY7eP31brW1q1YrTGoblWrhQJDiN/1K+Z8S1kylcmtjqx5wsUGcP1HBWutayA/jtyt+sg==
1615+
"@prisma/engines@5.1.1":
1616+
version "5.1.1"
1617+
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.1.1.tgz#9c26d209f93a563e048eab63b1976f222f1707d0"
1618+
integrity sha512-NV/4nVNWFZSJCCIA3HIFJbbDKO/NARc9ej0tX5S9k2EVbkrFJC4Xt9b0u4rNZWL4V+F5LAjvta8vzEUw0rw+HA==
16191619

16201620
"@rainbow-me/rainbowkit-siwe-next-auth@^0.3.0":
16211621
version "0.3.0"
@@ -1975,6 +1975,11 @@
19751975
dependencies:
19761976
"@types/estree" "*"
19771977

1978+
"@types/bcryptjs@^2.4.2":
1979+
version "2.4.2"
1980+
resolved "https://registry.yarnpkg.com/@types/bcryptjs/-/bcryptjs-2.4.2.tgz#e3530eac9dd136bfdfb0e43df2c4c5ce1f77dfae"
1981+
integrity sha512-LiMQ6EOPob/4yUL66SZzu6Yh77cbzJFYll+ZfaPiPPFswtIlA/Fs1MzdKYA7JApHU49zQTbJGX3PDmCpIdDBRQ==
1982+
19781983
"@types/connect@^3.4.33":
19791984
version "3.4.35"
19801985
resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1"
@@ -3070,6 +3075,11 @@ base64-js@^1.3.1:
30703075
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
30713076
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
30723077

3078+
bcryptjs@^2.4.3:
3079+
version "2.4.3"
3080+
resolved "https://registry.yarnpkg.com/bcryptjs/-/bcryptjs-2.4.3.tgz#9ab5627b93e60621ff7cdac5da9733027df1d0cb"
3081+
integrity sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==
3082+
30733083
big-integer@^1.6.44:
30743084
version "1.6.51"
30753085
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686"
@@ -6665,12 +6675,12 @@ pretty-format@^3.8.0:
66656675
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-3.8.0.tgz#bfbed56d5e9a776645f4b1ff7aa1a3ac4fa3c385"
66666676
integrity sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==
66676677

6668-
prisma@^5.0.0:
6669-
version "5.0.0"
6670-
resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.0.0.tgz#f6571c46dc2478172cb7bc1bb62d74026a2c2630"
6671-
integrity sha512-KYWk83Fhi1FH59jSpavAYTt2eoMVW9YKgu8ci0kuUnt6Dup5Qy47pcB4/TLmiPAbhGrxxSz7gsSnJcCmkyPANA==
6678+
prisma@^5.1.1:
6679+
version "5.1.1"
6680+
resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.1.1.tgz#8f5c0f9467a828746cb94f846d694dc7b7481a9e"
6681+
integrity sha512-WJFG/U7sMmcc6TjJTTifTfpI6Wjoh55xl4AzopVwAdyK68L9/ogNo8QQ2cxuUjJf/Wa82z/uhyh3wMzvRIBphg==
66726682
dependencies:
6673-
"@prisma/engines" "5.0.0"
6683+
"@prisma/engines" "5.1.1"
66746684

66756685
prismjs@^1.27.0:
66766686
version "1.29.0"
@@ -7737,7 +7747,7 @@ ts-interface-checker@^0.1.9:
77377747
resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699"
77387748
integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==
77397749

7740-
ts-node@^10.8.1:
7750+
ts-node@^10.8.1, ts-node@^10.9.1:
77417751
version "10.9.1"
77427752
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
77437753
integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==

0 commit comments

Comments
 (0)