Skip to content

Commit 0f2abe9

Browse files
committed
feat: use prisma and postgresql
1 parent c0eace8 commit 0f2abe9

File tree

7 files changed

+2741
-2367
lines changed

7 files changed

+2741
-2367
lines changed

.env.example

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,38 @@ NEXT_PUBLIC_CSB_SCAN="https://scan.crossbell.io"
1313
NEXT_PUBLIC_IPFS_GATEWAY="https://ipfs.4everland.xyz/ipfs/"
1414
NEXT_PUBLIC_MIRA_LINK="https://mira.crossbell.io"
1515

16-
REDIS_URL=
16+
# NFT
17+
18+
MORALIS_WEB3_API_KEY=
19+
ALCHEMY_ETHEREUM_API_KEY=
20+
ALCHEMY_POLYGON_API_KEY=
21+
NFTSCAN_API_KEY=
22+
OPENSEA_API_KEY=
23+
POAP_API_KEY=
24+
25+
# OPENAI
26+
27+
OPENAI_API_KEY=
28+
29+
# POSTGRES
30+
31+
POSTGRES_USER=postgres
32+
POSTGRES_PASSWORD=password
33+
POSTGRES_DB=indexer
34+
35+
# Nest run locally
36+
37+
DB_HOST=localhost
38+
39+
# DB_HOST=postgres
40+
41+
DB_PORT=5432
42+
DB_SCHEMA=public
43+
44+
# Prisma database connection
45+
46+
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?schema=${DB_SCHEMA}&sslmode=prefer&connection_limit=400&pool_timeout=30
47+
48+
# Redis database connection
49+
50+
REDIS_URL=redis://localhost:6379

docker-compose.db.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: "3.7"
2+
services:
3+
postgres:
4+
image: postgres:latest
5+
container_name: postgres
6+
restart: always
7+
ports:
8+
- 5432:5432
9+
env_file:
10+
- .env
11+
volumes:
12+
- postgres:/var/lib/postgresql/data
13+
redis:
14+
image: redis/redis-stack:latest
15+
container_name: redis-stack
16+
restart: always
17+
ports:
18+
- 6379:6379
19+
- 8001:8001
20+
volumes:
21+
- redis:/var/lib/redis/data
22+
23+
volumes:
24+
postgres:
25+
name: xlog-db
26+
redis:
27+
name: xlog-redis

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"test-e2e": "playwright test",
1212
"start": "node server.js",
1313
"uno-generate": "unocss \"src/**/*.{ts,tsx}\" -o src/generated/uno.css",
14-
"prepare": "husky install"
14+
"prepare": "husky install",
15+
"prisma:generate": "prisma generate",
16+
"prisma:studio": "prisma studio",
17+
"docker:db": "docker-compose -f docker-compose.db.yml up -d"
1518
},
1619
"lint-staged": {
1720
"**/*": "prettier --write --ignore-unknown"
@@ -36,6 +39,7 @@
3639
"@iconify-json/mingcute": "^1.1.5",
3740
"@mantine/core": "^6.0.4",
3841
"@monaco-editor/react": "4.4.6",
42+
"@prisma/client": "^4.12.0",
3943
"@tanstack/react-query": "4.28.0",
4044
"@tanstack/react-query-devtools": "4.28.0",
4145
"@tanstack/react-query-persist-client": "4.28.0",
@@ -142,6 +146,7 @@
142146
"next-pwa": "^5.6.0",
143147
"postcss-import": "15.1.0",
144148
"prettier": "2.8.6",
149+
"prisma": "^4.12.0",
145150
"tailwindcss": "3.2.7",
146151
"typescript": "5.0.2",
147152
"unocss": "0.50.6",

0 commit comments

Comments
 (0)