Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ To install all dependencies, run:
```bash
yarn install
# and optionally
yarn db:generate
yarn generate:db
```
Now, copy the example `.env` file and change all its options:

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
"clean": "turbo clean",
"start": "turbo start",
"dev": "turbo dev",
"dev:frontend": "turbo dev --filter=frontend...",
"lint": "turbo lint",
"prettier": "turbo prettier --ui=stream",
"db:generate": "turbo @repo/db#db:generate",
"db:studio": "turbo @repo/db#db:studio",
"db:migrate": "turbo @repo/db#db:migrate",
"git:pull": "git pull && yarn install && yarn run db:generate",
"generate:db": "turbo generate:db",
"studio:db": "yarn workspace @repo/db studio:db",
"migrate:db": "yarn workspace api migrate:db",
"git:pull": "git pull && yarn install && yarn run generate:db",
"ws": "yarn workspace"
},
"devDependencies": {
Expand Down
19 changes: 19 additions & 0 deletions packages/db/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
postgres:
image: postgres:18
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=website
- POSTGRES_DATABASE=database
ports:
- '5432:5432'

wait-for-postgres:
image: postgres:18
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=website
- POSTGRES_DATABASE=database
depends_on:
- postgres
command: sh -c "until pg_isready -h postgres -U $$POSTGRES_USER; do echo waiting for postgres; sleep 2; done;"
10 changes: 6 additions & 4 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"db:generate": "prisma generate",
"db:migrate": "prisma migrate deploy",
"db:studio": "prisma studio",
"db:pull": "prisma db pull",
"generate:db": "prisma generate",
"migrate:db": "prisma migrate deploy",
"studio:db": "prisma studio",
"pull:db": "prisma db pull",
"up": "docker compose up -d",
"wait": "docker compose up wait-for-postgres",
"env:copy": "cp .env.example .env",
"build": "tsc"
},
Expand Down
24 changes: 18 additions & 6 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"tasks": {
"$schema": "https://turbo.build/schema.json",
"ui": "tui",
"tasks": {
"build": {
"dependsOn": ["db:generate", "^build"],
"dependsOn": ["generate:db", "^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
},
Expand All @@ -18,6 +18,18 @@
},
"dev": {
"persistent": true,
"dependsOn": ["migrate:db"],
"cache": false
},
"migrate:db": {
"dependsOn": ["wait"],
"cache": false
},
"wait": {
"dependsOn": ["up"],
"cache": false
},
"up": {
"cache": false
},
"lint": {
Expand All @@ -26,10 +38,10 @@
"prettier": {
"dependsOn": ["^prettier"]
},
"db:generate": {
"generate:db": {
"cache": false
},
"db:studio": {
"studio:db": {
"persistent": true,
"cache": false
}
Expand Down