feat: add environment configuration and database setup; implement root layout and page components
This commit is contained in:
parent
5ab5cfda9c
commit
eebd6a400b
@ -4,21 +4,24 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"dev": "pnpm with-env next dev --turbopack",
|
||||
"build": "pnpm with-env next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"lint:fix": "next lint --fix",
|
||||
"typecheck": "tsc --noEmit"
|
||||
"typecheck": "tsc --noEmit",
|
||||
"with-env": "dotenv -e ../../.env --"
|
||||
},
|
||||
"dependencies": {
|
||||
"@workspace/ui": "workspace:*",
|
||||
"@t3-oss/env-nextjs": "^0.13.8",
|
||||
"@workspace/db": "workspace:*",
|
||||
"@workspace/ui": "workspace:*",
|
||||
"lucide-react": "^0.475.0",
|
||||
"next": "^15.2.3",
|
||||
"next-themes": "^0.4.4",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"react-dom": "^19.0.0",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
@ -26,6 +29,7 @@
|
||||
"@types/react-dom": "^19",
|
||||
"@workspace/eslint-config": "workspace:^",
|
||||
"@workspace/typescript-config": "workspace:*",
|
||||
"dotenv-cli": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@ -1,6 +1,9 @@
|
||||
import { db } from "@workspace/db"
|
||||
import { Button } from "@workspace/ui/components/button"
|
||||
|
||||
export default function Page() {
|
||||
export default async function Page() {
|
||||
const genres = await db.query.Genre.findMany({});
|
||||
console.log(genres)
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-svh">
|
||||
<div className="flex flex-col items-center justify-center gap-4">
|
30
apps/web/src/env.ts
Normal file
30
apps/web/src/env.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { createEnv } from "@t3-oss/env-nextjs";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const env = createEnv({
|
||||
/**
|
||||
* Specify your server-side environment variables schema here.
|
||||
* This way you can ensure the app isn't built with invalid env vars.
|
||||
*/
|
||||
server: {
|
||||
DATABASE_URL: z.url(),
|
||||
},
|
||||
|
||||
/**
|
||||
* Specify your client-side environment variables schema here.
|
||||
* For them to be exposed to the client, prefix them with `NEXT_PUBLIC_`.
|
||||
*/
|
||||
client: {
|
||||
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
||||
},
|
||||
/**
|
||||
* Destructure all variables from `process.env` to make sure they aren't tree-shaken away.
|
||||
*/
|
||||
experimental__runtimeEnv: {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
|
||||
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
||||
},
|
||||
skipValidation:
|
||||
!!process.env.CI || process.env.npm_lifecycle_event === "lint",
|
||||
});
|
@ -3,8 +3,9 @@
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
"@workspace/ui/*": ["../../packages/ui/src/*"]
|
||||
"@/*": ["./src/*"],
|
||||
"@workspace/ui/*": ["../../packages/ui/src/*"],
|
||||
"@workspace/db/*": ["../../packages/db/src/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
|
15
docker-compose.yaml
Normal file
15
docker-compose.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: webnovelfever
|
||||
ports:
|
||||
- 5432:5432
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
db_data:
|
@ -26,7 +26,7 @@
|
||||
"@types/pg": "^8.15.4",
|
||||
"@workspace/eslint-config": "workspace:*",
|
||||
"@workspace/typescript-config": "workspace:*",
|
||||
"dotenv-cli": "^9.0.0",
|
||||
"dotenv-cli": "catalog:",
|
||||
"drizzle-kit": "^0.31.4",
|
||||
"eslint": "^9.20.1",
|
||||
"tsup": "^8.5.0",
|
||||
|
@ -6,6 +6,9 @@ settings:
|
||||
|
||||
catalogs:
|
||||
default:
|
||||
dotenv-cli:
|
||||
specifier: ^9.0.0
|
||||
version: 9.0.0
|
||||
typescript:
|
||||
specifier: ^5.7.3
|
||||
version: 5.7.3
|
||||
@ -35,6 +38,9 @@ importers:
|
||||
|
||||
apps/web:
|
||||
dependencies:
|
||||
'@t3-oss/env-nextjs':
|
||||
specifier: ^0.13.8
|
||||
version: 0.13.8(typescript@5.7.3)(zod@3.25.76)
|
||||
'@workspace/db':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/db
|
||||
@ -56,6 +62,9 @@ importers:
|
||||
react-dom:
|
||||
specifier: ^19.0.0
|
||||
version: 19.0.0(react@19.0.0)
|
||||
zod:
|
||||
specifier: 'catalog:'
|
||||
version: 3.25.76
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^20
|
||||
@ -72,6 +81,9 @@ importers:
|
||||
'@workspace/typescript-config':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/typescript-config
|
||||
dotenv-cli:
|
||||
specifier: 'catalog:'
|
||||
version: 9.0.0
|
||||
typescript:
|
||||
specifier: 'catalog:'
|
||||
version: 5.7.3
|
||||
@ -101,7 +113,7 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../typescript-config
|
||||
dotenv-cli:
|
||||
specifier: ^9.0.0
|
||||
specifier: 'catalog:'
|
||||
version: 9.0.0
|
||||
drizzle-kit:
|
||||
specifier: ^0.31.4
|
||||
@ -914,6 +926,40 @@ packages:
|
||||
'@swc/helpers@0.5.15':
|
||||
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
|
||||
|
||||
'@t3-oss/env-core@0.13.8':
|
||||
resolution: {integrity: sha512-L1inmpzLQyYu4+Q1DyrXsGJYCXbtXjC4cICw1uAKv0ppYPQv656lhZPU91Qd1VS6SO/bou1/q5ufVzBGbNsUpw==}
|
||||
peerDependencies:
|
||||
arktype: ^2.1.0
|
||||
typescript: '>=5.0.0'
|
||||
valibot: ^1.0.0-beta.7 || ^1.0.0
|
||||
zod: ^3.24.0 || ^4.0.0-beta.0
|
||||
peerDependenciesMeta:
|
||||
arktype:
|
||||
optional: true
|
||||
typescript:
|
||||
optional: true
|
||||
valibot:
|
||||
optional: true
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
'@t3-oss/env-nextjs@0.13.8':
|
||||
resolution: {integrity: sha512-QmTLnsdQJ8BiQad2W2nvV6oUpH4oMZMqnFEjhVpzU0h3sI9hn8zb8crjWJ1Amq453mGZs6A4v4ihIeBFDOrLeQ==}
|
||||
peerDependencies:
|
||||
arktype: ^2.1.0
|
||||
typescript: '>=5.0.0'
|
||||
valibot: ^1.0.0-beta.7 || ^1.0.0
|
||||
zod: ^3.24.0 || ^4.0.0-beta.0
|
||||
peerDependenciesMeta:
|
||||
arktype:
|
||||
optional: true
|
||||
typescript:
|
||||
optional: true
|
||||
valibot:
|
||||
optional: true
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/node@4.0.8':
|
||||
resolution: {integrity: sha512-FKArQpbrbwv08TNT0k7ejYXpF+R8knZFAatNc0acOxbgeqLzwb86r+P3LGOjIeI3Idqe9CVkZrh4GlsJLJKkkw==}
|
||||
|
||||
@ -3696,6 +3742,18 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
|
||||
'@t3-oss/env-core@0.13.8(typescript@5.7.3)(zod@3.25.76)':
|
||||
optionalDependencies:
|
||||
typescript: 5.7.3
|
||||
zod: 3.25.76
|
||||
|
||||
'@t3-oss/env-nextjs@0.13.8(typescript@5.7.3)(zod@3.25.76)':
|
||||
dependencies:
|
||||
'@t3-oss/env-core': 0.13.8(typescript@5.7.3)(zod@3.25.76)
|
||||
optionalDependencies:
|
||||
typescript: 5.7.3
|
||||
zod: 3.25.76
|
||||
|
||||
'@tailwindcss/node@4.0.8':
|
||||
dependencies:
|
||||
enhanced-resolve: 5.18.1
|
||||
|
@ -4,3 +4,4 @@ packages:
|
||||
catalog:
|
||||
typescript: ^5.7.3
|
||||
zod: ^3.25.1
|
||||
dotenv-cli: ^9.0.0
|
||||
|
@ -32,6 +32,10 @@
|
||||
"studio": {
|
||||
"cache": false,
|
||||
"persistent": true
|
||||
},
|
||||
"push": {
|
||||
"cache": false,
|
||||
"persistent": true
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user