-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tbh-app/feat/drizzle
feat: move to lucia auth and drizzle orm
- Loading branch information
Showing
57 changed files
with
1,780 additions
and
1,526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Dockerfile | ||
.dockerignore | ||
.git | ||
.gitignore | ||
.gitattributes | ||
README.md | ||
.npmrc | ||
.prettierrc | ||
.eslintrc.cjs | ||
.graphqlrc | ||
.editorconfig | ||
.svelte-kit | ||
.vscode | ||
node_modules | ||
build | ||
package | ||
**/.env | ||
|
||
db/database.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: srizan10/tbh | ||
tags: latest | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Emit a webhook to the server | ||
env: | ||
AUTH_HEADER: ${{ secrets.WHSERVER_TOKEN }} | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: $AUTH_HEADER" \ | ||
https://webhooks.srizan.dev/hooks/tbh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:lts-alpine AS builder | ||
WORKDIR /app | ||
COPY package.json . | ||
COPY yarn.lock . | ||
RUN yarn install | ||
COPY . . | ||
RUN yarn build | ||
RUN yarn install --production --ignore-scripts --prefer-offline | ||
|
||
FROM node:lts-alpine | ||
WORKDIR /app | ||
COPY --from=builder /app/build build/ | ||
COPY --from=builder /app/public public/ | ||
COPY --from=builder /app/db db/ | ||
COPY --from=builder /app/node_modules node_modules/ | ||
COPY package.json . | ||
EXPOSE 3000 | ||
ENV NODE_ENV=production | ||
CMD ["node", "build"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'dotenv/config'; | ||
import { defineConfig } from 'drizzle-kit'; | ||
|
||
export default defineConfig({ | ||
dialect: 'sqlite', | ||
out: './src/drizzle', | ||
schema: './src/lib/server/db/schema.ts', | ||
dbCredentials: { | ||
url: 'db/database.db' | ||
}, | ||
// Print all statements | ||
verbose: true, | ||
// Always ask for confirmation | ||
strict: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,48 +2,42 @@ | |
"name": "tbh", | ||
"version": "0.0.1-alpha", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"dev:pages": "wrangler pages dev .svelte-kit/cloudflare", | ||
"build": "yarn db:generateprod && vite build", | ||
"dev": "docker compose -f dev/compose.yml up -d && vite dev", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"db:generate": "prisma generate", | ||
"db:generateprod": "prisma generate --no-engine", | ||
"tail": "wrangler pages deployment tail --project-name=tbh" | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "^3.0.0", | ||
"@sveltejs/adapter-cloudflare": "^4.2.0", | ||
"@sveltejs/adapter-node": "^5.2.1", | ||
"@sveltejs/kit": "^2.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.0", | ||
"@types/better-sqlite3": "^7.6.11", | ||
"@types/node": "^22.1.0", | ||
"@types/ws": "^8.5.10", | ||
"autoprefixer": "^10.4.17", | ||
"daisyui": "^4.6.1", | ||
"dotenv": "^16.4.5", | ||
"drizzle-kit": "^0.23.2", | ||
"postcss": "^8.4.34", | ||
"prisma": "^5.11.0", | ||
"svelte": "^4.2.7", | ||
"svelte-check": "^3.6.0", | ||
"tailwindcss": "^3.4.1", | ||
"tslib": "^2.4.1", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.3", | ||
"wrangler": "^3.41.0" | ||
"vite": "^5.0.3" | ||
}, | ||
"type": "module", | ||
"dependencies": { | ||
"@clerk/themes": "^1.7.10", | ||
"@neondatabase/serverless": "^0.9.0", | ||
"@prisma/adapter-neon": "^5.11.0", | ||
"@prisma/client": "^5.11.0", | ||
"@prisma/extension-accelerate": "^1.0.0", | ||
"@types/node": "^20.11.17", | ||
"clerk-sveltekit": "^0.4.1", | ||
"isomorphic-ws": "^5.0.0", | ||
"ts-node": "^10.9.2", | ||
"ws": "^8.16.0", | ||
"zod": "^3.22.4" | ||
} | ||
"@lucia-auth/adapter-drizzle": "^1.0.7", | ||
"better-sqlite3": "^11.1.2", | ||
"drizzle-orm": "^0.32.2", | ||
"lucia": "^3.2.0", | ||
"lucide-svelte": "^0.381.0", | ||
"svelte-sonner": "^0.3.27", | ||
"zod": "^3.23.8" | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
CREATE TABLE `question` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`for_username` text NOT NULL, | ||
`text` text NOT NULL, | ||
`created_at` text DEFAULT (CURRENT_TIMESTAMP), | ||
FOREIGN KEY (`for_username`) REFERENCES `user`(`username`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `session` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`user_id` text NOT NULL, | ||
`expires_at` integer NOT NULL, | ||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `user` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`username` text NOT NULL, | ||
`hashed_password` text NOT NULL, | ||
`image_url` text DEFAULT '/tbh.webp' | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`); |
Oops, something went wrong.