Skip to content

Commit

Permalink
switch to postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdeep-ghosh committed Jul 11, 2024
1 parent 973273f commit c17f164
Show file tree
Hide file tree
Showing 19 changed files with 1,571 additions and 113 deletions.
13 changes: 7 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
NEXT_PUBLIC_URL=http://localhost:3000

# mongodb connection url
MONGODB_URI=mongodb://localhost:27017
# postgres connection url
DB_URL=
DB_POOL_URL=

# aws credentials
AWS_REGION= your aws region
AWS_ACCESS_KEY_ID= your access key id
AWS_SECRET_ACCESS_KEY= your secret access key
AWS_BUCKET_NAME= your s3 bucket name
AWS_REGION=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_BUCKET_NAME=
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
.env*

# vercel
.vercel
Expand Down
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';

export default defineConfig({
schema: './src/lib/db/schema',
out: './src/lib/db/migrations',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DB_URL
},
verbose: true,
strict: true
});
3 changes: 2 additions & 1 deletion env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
namespace NodeJS {
interface ProcessEnv {
NEXT_PUBLIC_URL: string;
MONGODB_URI: string;
DB_URL: string;
DB_POOL_URL: string;
AWS_REGION: string;
AWS_ACCESS_KEY_ID: string;
AWS_SECRET_ACCESS_KEY: string;
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"db:generate": "drizzle-kit generate",
"db:migrate": "tsx --env-file=.env src/lib/db/migrate.ts",
"db:studio": "drizzle-kit studio",
"lint": "next lint",
"format:check": "prettier --check ./src",
"format:fix": "prettier --write ./src --ignore-unknown",
Expand All @@ -21,23 +24,27 @@
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"drizzle-orm": "^0.31.4",
"lucide-react": "^0.378.0",
"mime-types": "^2.1.35",
"mongoose": "^8.4.0",
"next": "^14.1.2",
"pg": "^8.12.0",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/mime-types": "^2.1.4",
"@types/node": "^20",
"@types/pg": "^8.11.6",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"autoprefixer": "^10.4.14",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"drizzle-kit": "^0.22.8",
"eslint": "^8",
"eslint-config-next": "^14.1.2",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -52,6 +59,7 @@
"tailwind-merge": "^2.3.0",
"tailwindcss": "^3.3.3",
"tailwindcss-animate": "^1.0.7",
"tsx": "^4.16.2",
"typescript": "^5"
}
}
Loading

0 comments on commit c17f164

Please sign in to comment.