This commit is contained in:
Nathan Rashleigh committed 2025-04-29 18:52:36 +10:00
1 parent 2eb10eb4d6
commit ff371798a9
6 files changed
+80 -54

No files matched your search

+2
View File
@@ -7,3 +7,5 @@ db/
*sql.gz *sql.gz
crates/prisma/generated/client crates/prisma/generated/client
crates.sublime-workspace crates.sublime-workspace
crates/static/css
crates/prisma/generated
+10 -2
View File
@@ -1,12 +1,20 @@
import * as bcrypt from "https://deno.land/x/bcrypt@v0.4.1/mod.ts" import * as bcrypt from "https://deno.land/x/bcrypt@v0.4.1/mod.ts"
import { load } from "$std/dotenv/mod.ts" import { load } from "$std/dotenv/mod.ts"
import { Prisma, PrismaClient } from "prisma/generated/client/deno/edge.ts"; import { PrismaClient } from "prisma/generated/index.js";
// Load environment variables // Load environment variables
await load({ export: true }) await load({ export: true })
// Create and export the Prisma client // Create and export the Prisma client
export const prisma = new PrismaClient() const DATABASE_URL = Deno.env.get("DATABASE_URL")
console.log("DATABASE_URL", { DATABASE_URL })
export const prisma = new PrismaClient({
datasources: {
db: {
url: DATABASE_URL,
},
},
});
export interface UserCreateParams { export interface UserCreateParams {
email: string email: string
+3 -2
View File
@@ -4,10 +4,11 @@
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx", "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -", "cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
"manifest": "deno task cli manifest $(pwd)", "manifest": "deno task cli manifest $(pwd)",
"start": "deno run -A --watch=static/,routes/ dev.ts", "start": "deno run --unstable-detect-cjs -A --watch=static/,routes/ dev.ts",
"build": "deno run -A dev.ts build", "build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts", "preview": "deno run -A main.ts",
"prisma-generate": "deno run -A --unstable-detect-cjs npm:prisma@latest generate --no-engine", "prisma-generate": "deno run -A --env-file npm:prisma generate",
"prisma:migrate": "deno run -A --env-file npm:prisma migrate dev",
"update": "deno run -A -r https://fresh.deno.dev/update ." "update": "deno run -A -r https://fresh.deno.dev/update ."
}, },
+2 -2
View File
@@ -1,7 +1,7 @@
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
previewFeatures = ["deno"] output = "./generated"
output = "./generated/client" moduleFormat = "esm"
} }
datasource db { datasource db {
+63
View File
@@ -0,0 +1,63 @@
version: "3.3"
services:
pg:
image: postgres:latest
environment:
POSTGRES_USER: '${POSTGRES_USER}'
POSTGRES_DB: '${POSTGRES_DB}'
POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
volumes:
# so ez
# insane
- "./pg:/docker-entrypoint-initdb.d"
ports:
- '45432:5432'
api:
image: crates/api
build:
context: ./api
dockerfile: ./api.Dockerfile
working_dir: /opt/crates/api
depends_on:
- 'pg'
command: npm start
environment:
DATABASE_URL: 'postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?schema=public'
DISCORD_TOKEN: '${DISCORD_TOKEN}'
DISCOGS_TOKEN: '${DISCOGS_TOKEN}'
CHOKIDAR_USEPOLLING: 1
volumes:
- "./api:/opt/crates/api"
- "/opt/crates/api/node_modules"
migrate:
restart: on-failure:3
extends: api
command: npm run migrate status
client:
image: node:16
working_dir: /opt/crates/client
build:
context: ./client
dockerfile: ./client.dev.Dockerfile
entrypoint: npm start
ports:
- '8080:8080' # fwd the hmr websocket
environment:
CHOKIDAR_USEPOLLING: 1
volumes:
- "./client:/opt/crates/client"
- "./api:/opt/crates/api"
- "/opt/crates/client/node_modules"
nginx:
image: nginx:latest
depends_on:
- 'api'
volumes:
- './nginx/localhost.nginx.conf:/etc/nginx/conf.d/default.conf'
ports:
- '80:80'
-48
View File
@@ -13,51 +13,3 @@ services:
- "./pg:/docker-entrypoint-initdb.d" - "./pg:/docker-entrypoint-initdb.d"
ports: ports:
- '45432:5432' - '45432:5432'
api:
image: crates/api
build:
context: ./api
dockerfile: ./api.Dockerfile
working_dir: /opt/crates/api
depends_on:
- 'pg'
command: npm start
environment:
DATABASE_URL: 'postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?schema=public'
DISCORD_TOKEN: '${DISCORD_TOKEN}'
DISCOGS_TOKEN: '${DISCOGS_TOKEN}'
CHOKIDAR_USEPOLLING: 1
volumes:
- "./api:/opt/crates/api"
- "/opt/crates/api/node_modules"
migrate:
restart: on-failure:3
extends: api
command: npm run migrate status
client:
image: node:16
working_dir: /opt/crates/client
build:
context: ./client
dockerfile: ./client.dev.Dockerfile
entrypoint: npm start
ports:
- '8080:8080' # fwd the hmr websocket
environment:
CHOKIDAR_USEPOLLING: 1
volumes:
- "./client:/opt/crates/client"
- "./api:/opt/crates/api"
- "/opt/crates/client/node_modules"
nginx:
image: nginx:latest
depends_on:
- 'api'
volumes:
- './nginx/localhost.nginx.conf:/etc/nginx/conf.d/default.conf'
ports:
- '80:80'