Skip to content

Commit

Permalink
✨ add drizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
w3cj committed Sep 12, 2024
1 parent a0186d9 commit 7ae2bd6
Show file tree
Hide file tree
Showing 28 changed files with 1,493 additions and 14 deletions.
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NODE_ENV=development
DB_HOST=localhost
DB_USER=nextstarter
DB_PASSWORD=supersecret
DB_NAME=nextstarter
DB_PORT=5432
DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-value-here
GOOGLE_CLIENT_ID=your-value-here
GOOGLE_CLIENT_SECRET=your-value-here
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

docker-data
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
db:
image: postgres:16.4
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
- POSTGRES_DB=${DB_NAME}
ports:
- ${DB_PORT}:5432
volumes:
- ./docker-data/db:/var/lib/postgresql/data
12 changes: 12 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from "drizzle-kit";

import { env } from "@/env/server";

export default defineConfig({
schema: "./src/db/schema/index.ts",
dialect: "postgresql",
out: "./src/db/migrations",
dbCredentials: {
url: env.DATABASE_URL,
},
});
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,26 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"format": "prettier src/ --write"
"format": "prettier src/ --write",
"db:migrate": "cross-env DB_MIGRATING=true drizzle-kit migrate"
},
"dependencies": {
"@auth/drizzle-adapter": "^1.4.2",
"@conform-to/react": "^1.1.5",
"@conform-to/zod": "^1.1.5",
"@nextui-org/react": "^2.4.6",
"@t3-oss/env-nextjs": "^0.11.1",
"@tabler/icons-react": "^3.16.0",
"dotenv": "^16.4.5",
"dotenv-expand": "^11.0.6",
"drizzle-orm": "^0.33.0",
"drizzle-zod": "^0.5.1",
"framer-motion": "^11.5.4",
"jiti": "^1.21.6",
"next": "14.2.9",
"next-auth": "^4.24.7",
"next-themes": "^0.3.0",
"postgres": "^3.4.4",
"react": "^18",
"react-dom": "^18",
"zod": "^3.23.8"
Expand All @@ -27,6 +36,8 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"cross-env": "^7.0.3",
"drizzle-kit": "^0.24.2",
"eslint": "^8",
"eslint-config-next": "14.2.9",
"eslint-config-prettier": "^9.1.0",
Expand Down
Loading

0 comments on commit 7ae2bd6

Please sign in to comment.