├── apps └── web │ ├── .env │ ├── .gitignore │ ├── static │ ├── favicon.png │ └── opengraph.png │ ├── src │ ├── routes │ │ ├── auth-demo │ │ │ ├── guarded-page │ │ │ │ ├── +page.svelte │ │ │ │ └── +page.server.ts │ │ │ └── +page.svelte │ │ ├── api │ │ │ └── trpc │ │ │ │ └── [trpc] │ │ │ │ └── +server.ts │ │ ├── drinks │ │ │ ├── [id] │ │ │ │ ├── +page.server.ts │ │ │ │ └── +page.svelte │ │ │ ├── +page.server.ts │ │ │ └── +page.svelte │ │ ├── +layout.svelte │ │ └── +page.svelte │ ├── lib │ │ ├── server │ │ │ ├── db │ │ │ │ └── index.ts │ │ │ └── authjs │ │ │ │ └── index.ts │ │ ├── api │ │ │ ├── procedures │ │ │ │ ├── publicProcedure.ts │ │ │ │ └── authedProcedure.ts │ │ │ ├── routes │ │ │ │ ├── public-viewer │ │ │ │ │ ├── _router.ts │ │ │ │ │ ├── session.router.ts │ │ │ │ │ └── drinks │ │ │ │ │ │ ├── drinks.schema.ts │ │ │ │ │ │ ├── drinks.router.ts │ │ │ │ │ │ └── drinks.json │ │ │ │ └── authed-viewer │ │ │ │ │ └── _router.ts │ │ │ ├── trpc.ts │ │ │ ├── middlewares │ │ │ │ ├── perfMiddleware.ts │ │ │ │ └── sessionMiddleware.ts │ │ │ ├── root.ts │ │ │ ├── createContext.ts │ │ │ ├── client.ts │ │ │ ├── trpc-load.ts │ │ │ └── handle.ts │ │ └── drinks │ │ │ ├── queries │ │ │ └── index.ts │ │ │ └── components │ │ │ └── DrinksGrid.svelte │ ├── hooks.server.ts │ ├── app.html │ ├── app.d.ts │ └── app.css │ ├── postcss.config.cjs │ ├── .eslintignore │ ├── README.md │ ├── tailwind.config.cjs │ ├── vite.config.js │ ├── tsconfig.json │ ├── svelte.config.js │ └── package.json ├── packages ├── database │ ├── .env │ ├── .gitignore │ ├── index.ts │ ├── package.json │ └── prisma │ │ └── schema.prisma ├── core │ ├── index.ts │ ├── class-utils.ts │ ├── tsconfig.json │ └── package.json ├── ui │ ├── index.ts │ ├── components │ │ ├── card │ │ │ ├── CardContent.svelte │ │ │ ├── CardFooter.svelte │ │ │ ├── CardDescription.svelte │ │ │ ├── CardHeader.svelte │ │ │ ├── index.ts │ │ │ ├── Card.svelte │ │ │ └── CardTitle.svelte │ │ ├── badge │ │ │ ├── index.ts │ │ │ └── Badge.svelte │ │ ├── pulse │ │ │ └── Pulse.svelte │ │ └── button │ │ │ ├── index.ts │ │ │ └── Button.svelte │ ├── tsconfig.json │ └── package.json ├── tsconfig │ ├── package.json │ ├── tsconfig-base.json │ └── tsconfig-svelte-library.json └── config │ ├── eslint-preset.js │ ├── prettier-preset.js │ ├── package.json │ └── tailwind-preset.js ├── .npmrc ├── pnpm-workspace.yaml ├── .eslintrc.cjs ├── .prettierrc.js ├── commitlint.config.cjs ├── .husky ├── pre-push ├── commit-msg └── pre-commit ├── .lintstagedrc ├── .prettierignore ├── .env.example ├── .gitignore ├── turbo.json ├── package.json ├── CONTRIBUTING.md └── README.md /apps/web/.env: -------------------------------------------------------------------------------- 1 | ../../.env -------------------------------------------------------------------------------- /packages/database/.env: -------------------------------------------------------------------------------- 1 | ../../.env -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | auto-install-peers = true 2 | -------------------------------------------------------------------------------- /packages/database/.gitignore: -------------------------------------------------------------------------------- 1 | !.env 2 | -------------------------------------------------------------------------------- /packages/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './class-utils' -------------------------------------------------------------------------------- /packages/database/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@prisma/client'; -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "apps/*" 3 | - "packages/*" 4 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require("./packages/config/eslint-preset"); 2 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./packages/config/prettier-preset"); -------------------------------------------------------------------------------- /commitlint.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | pnpm type-check 5 | -------------------------------------------------------------------------------- /apps/web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | !.env 7 | -------------------------------------------------------------------------------- /apps/web/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiplehats/jaydens-stack/HEAD/apps/web/static/favicon.png -------------------------------------------------------------------------------- /apps/web/static/opengraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiplehats/jaydens-stack/HEAD/apps/web/static/opengraph.png -------------------------------------------------------------------------------- /apps/web/src/routes/auth-demo/guarded-page/+page.svelte: -------------------------------------------------------------------------------- 1 |

Guarded page. Only if you have an active session you can see this.

-------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit $1 5 | 6 | 7 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | # pnpm 5 | pnpm run lint-staged 6 | # pnpx lint-staged -------------------------------------------------------------------------------- /apps/web/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /apps/web/src/lib/server/db/index.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from '@prisma/client'; 2 | 3 | export const prisma = new PrismaClient(); 4 | -------------------------------------------------------------------------------- /packages/ui/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./components/button"; 2 | export * from "./components/badge"; 3 | export * from "./components/card"; -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "apps/**/*.{js,ts,svelte,svx}": [ 3 | "eslint --fix" 4 | ], 5 | "packages/components/**/*.{js,ts,svelte,svx}": [ 6 | "eslint --fix" 7 | ] 8 | } -------------------------------------------------------------------------------- /apps/web/src/routes/api/trpc/[trpc]/+server.ts: -------------------------------------------------------------------------------- 1 | import { trpcServerHandle } from "$lib/api/handle"; 2 | 3 | export const GET = trpcServerHandle; 4 | export const POST = trpcServerHandle; 5 | -------------------------------------------------------------------------------- /packages/core/class-utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from 'clsx'; 2 | import { twMerge } from 'tailwind-merge'; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /apps/web/.eslintignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /apps/web/src/lib/api/procedures/publicProcedure.ts: -------------------------------------------------------------------------------- 1 | import perfMiddleware from "../middlewares/perfMiddleware"; 2 | import { tRPCContext } from "../trpc"; 3 | 4 | const publicProcedure = tRPCContext.procedure.use(perfMiddleware); 5 | 6 | export default publicProcedure; 7 | -------------------------------------------------------------------------------- /apps/web/README.md: -------------------------------------------------------------------------------- 1 | # SvelteKit application 2 | 3 | This is a SvelteKit application that utilises components from `@acme/ui`, as well as utilities from `@acme/core`. It also includes an example of fetching data with tRPC on the server, and hydrating Tanstack Query on the client. 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .svelte-kit 3 | node_modules 4 | /build 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | vite.config.js* 10 | 11 | # Ignore files for PNPM, NPM and YARN 12 | pnpm-lock.yaml 13 | pnpm-workspace.yaml 14 | package-lock.json 15 | yarn.lock 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | DATABASE_URL="" 2 | 3 | ## Use openssl rand -base64 32 to generate a secret 4 | AUTH_SECRET="" 5 | 6 | # Optional: When deploying your app outside Vercel, set the AUTH_TRUST_HOST variable to true for other hosting providers like Cloudflare Pages or Netlify. 7 | # AUTH_TRUST_HOST -------------------------------------------------------------------------------- /apps/web/tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | const base = require("@acme/config/tailwind-preset"); 2 | 3 | /** @type {import('tailwindcss').Config} */ 4 | export default { 5 | presets: [base], 6 | content: ["./src/**/*.{html,js,svelte,ts}", "../../packages/ui/components/**/*.{svelte,ts}"], 7 | }; 8 | -------------------------------------------------------------------------------- /apps/web/vite.config.js: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import tsconfigPaths from 'vite-tsconfig-paths'; 3 | 4 | /** @type {import('vite').UserConfig} */ 5 | const config = { 6 | plugins: [sveltekit(), tsconfigPaths()] 7 | }; 8 | 9 | export default config; 10 | -------------------------------------------------------------------------------- /packages/tsconfig/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@acme/tsconfig", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "files": [ 6 | "tsconfig-base.json", 7 | "tsconfig-svelte-library.json" 8 | ], 9 | "devDependencies": { 10 | "@tsconfig/svelte": "3.0.0" 11 | } 12 | } -------------------------------------------------------------------------------- /packages/ui/components/card/CardContent.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /packages/ui/components/card/CardFooter.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /apps/web/src/hooks.server.ts: -------------------------------------------------------------------------------- 1 | import { authConfig } from "$lib/server/authjs"; 2 | import { SvelteKitAuth } from "@auth/sveltekit"; 3 | import type { Handle } from "@sveltejs/kit"; 4 | import { sequence } from "@sveltejs/kit/hooks"; 5 | 6 | export const authHandle = SvelteKitAuth(authConfig) satisfies Handle; 7 | 8 | export const handle = sequence(authHandle); -------------------------------------------------------------------------------- /packages/ui/components/card/CardDescription.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |

9 | 10 |

11 | -------------------------------------------------------------------------------- /packages/ui/components/card/CardHeader.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /apps/web/src/routes/drinks/[id]/+page.server.ts: -------------------------------------------------------------------------------- 1 | import { trpcLoad } from "$lib/api/trpc-load"; 2 | 3 | import type { PageServerLoad } from "./$types"; 4 | 5 | export const load = (async (event) => { 6 | return { 7 | drink: trpcLoad(event, (trpc) => trpc.public.drinks.get({ id: Number(event.params.id) })), 8 | }; 9 | }) satisfies PageServerLoad; 10 | -------------------------------------------------------------------------------- /apps/web/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@acme/tsconfig/tsconfig-base.json", 3 | "compilerOptions": { 4 | "target": "es5", 5 | "jsx": "preserve", 6 | "resolveJsonModule": true 7 | }, 8 | "include": [ 9 | ".", 10 | ], 11 | "exclude": [ 12 | "dist", 13 | "build", 14 | "node_modules" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@acme/core", 3 | "version": "1.0.0", 4 | "description": "Core functionality and common utilities for Acme", 5 | "main": "./index.ts", 6 | "dependencies": { 7 | "clsx": "^1.2.1", 8 | "tailwind-merge": "^1.13.2" 9 | }, 10 | "devDependencies": { 11 | "@acme/tsconfig": "workspace:^", 12 | "typescript": "^5.0.0" 13 | } 14 | } -------------------------------------------------------------------------------- /apps/web/src/lib/api/procedures/authedProcedure.ts: -------------------------------------------------------------------------------- 1 | import perfMiddleware from "../middlewares/perfMiddleware"; 2 | import { isAuthed } from "../middlewares/sessionMiddleware"; 3 | import { procedure } from "../trpc"; 4 | 5 | /** 6 | * THis is just an example, this doesn't include any auth. 7 | */ 8 | const authedProcedure = procedure.use(perfMiddleware).use(isAuthed) 9 | 10 | export default authedProcedure; 11 | -------------------------------------------------------------------------------- /packages/ui/components/card/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Card } from "./Card.svelte"; 2 | export { default as CardContent } from "./CardContent.svelte"; 3 | export { default as CardDescription } from "./CardDescription.svelte"; 4 | export { default as CardFooter } from "./CardFooter.svelte"; 5 | export { default as CardHeader } from "./CardHeader.svelte"; 6 | export { default as CardTitle } from "./CardTitle.svelte"; 7 | -------------------------------------------------------------------------------- /packages/database/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@acme/database", 3 | "private": true, 4 | "main": "./index.ts", 5 | "types": "./index.ts", 6 | "scripts": { 7 | "prisma": "prisma", 8 | "db:generate": "prisma generate", 9 | "db:push": "prisma db push" 10 | }, 11 | "devDependencies": { 12 | "prisma": "^4.16.1" 13 | }, 14 | "dependencies": { 15 | "@prisma/client": "^4.16.1" 16 | } 17 | } -------------------------------------------------------------------------------- /apps/web/src/lib/api/routes/public-viewer/_router.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Place for public routes. 3 | */ 4 | import { mergeRouters, router } from "$lib/api/trpc"; 5 | import { drinksRouter } from "./drinks/drinks.router"; 6 | 7 | export const publicViewerRouter = mergeRouters( 8 | // Easily merge "one-off" routers that don't make sense to put in their own file until they grow. 9 | router({ 10 | drinks: drinksRouter, 11 | }) 12 | ); 13 | -------------------------------------------------------------------------------- /apps/web/src/lib/api/routes/public-viewer/session.router.ts: -------------------------------------------------------------------------------- 1 | import sessionMiddleware from '$lib/api/middlewares/sessionMiddleware'; 2 | import publicProcedure from '$lib/api/procedures/publicProcedure'; 3 | import { router } from '$lib/api/trpc'; 4 | 5 | export const sessionRouter = router({ 6 | session: publicProcedure 7 | .use(sessionMiddleware) 8 | .query(async ({ ctx: { session } }) => { 9 | return { 10 | session, 11 | }; 12 | }) 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ui/components/card/Card.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |
16 | 17 |
18 | -------------------------------------------------------------------------------- /apps/web/src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | coverage 10 | 11 | # svelte 12 | .svelte-kit 13 | 14 | # misc 15 | .DS_Store 16 | *.pem 17 | 18 | # debug 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # env files 24 | .env 25 | .env.* 26 | !.env.example 27 | 28 | # turbo 29 | .turbo 30 | 31 | # vercel build output 32 | .vercel -------------------------------------------------------------------------------- /apps/web/src/routes/auth-demo/guarded-page/+page.server.ts: -------------------------------------------------------------------------------- 1 | import { trpcLoad } from '$lib/api/trpc-load'; 2 | import { redirect } from '@sveltejs/kit'; 3 | import type { PageServerLoad } from './$types'; 4 | 5 | export const load = (async (event) => { 6 | const { session } = await trpcLoad(event, (t) => t.session()); 7 | 8 | if (!session) { 9 | throw redirect(302, '/auth-demo') 10 | } 11 | 12 | return { 13 | session 14 | }; 15 | }) satisfies PageServerLoad; -------------------------------------------------------------------------------- /packages/ui/components/card/CardTitle.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/web/src/lib/api/trpc.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC } from "@trpc/server"; 2 | import superjson from "superjson"; 3 | 4 | import type { createContextInner } from "./createContext"; 5 | 6 | export const tRPCContext = initTRPC.context().create({ 7 | transformer: superjson, 8 | }); 9 | export const router = tRPCContext.router; 10 | export const mergeRouters = tRPCContext.mergeRouters; 11 | export const middleware = tRPCContext.middleware; 12 | export const procedure = tRPCContext.procedure; 13 | -------------------------------------------------------------------------------- /apps/web/src/lib/api/routes/authed-viewer/_router.ts: -------------------------------------------------------------------------------- 1 | import authedProcedure from "$lib/api/procedures/authedProcedure"; 2 | import { mergeRouters, router } from "$lib/api/trpc"; 3 | 4 | const meRouter = router({ 5 | me: authedProcedure.query(async () => { 6 | return { 7 | id: "1", 8 | name: "John Doe", 9 | }; 10 | }), 11 | }); 12 | 13 | export const authedViewerRouter = mergeRouters( 14 | // Easily merge "one-off" routers that don't make sense to put in their own file until they grow. 15 | meRouter 16 | // Add more routers here 👇 17 | // router({ 18 | // 19 | // }) 20 | ); 21 | -------------------------------------------------------------------------------- /apps/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.svelte-kit/tsconfig.json", 3 | "compilerOptions": { 4 | "ignoreDeprecations": "5.0", 5 | "allowJs": true, 6 | "checkJs": true, 7 | "esModuleInterop": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "resolveJsonModule": true, 10 | "skipLibCheck": true, 11 | "sourceMap": true, 12 | "strict": true, 13 | "baseUrl": ".", 14 | "paths": { 15 | "$lib": ["src/lib"], 16 | "$lib/*": ["src/lib/*"], 17 | "$components": ["src/components"], 18 | "$components/*": ["src/components/*"] 19 | }, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/config/eslint-preset.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: "@typescript-eslint/parser", 4 | extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "turbo", "prettier"], 5 | plugins: ["svelte3", "@typescript-eslint"], 6 | ignorePatterns: ["*.cjs"], 7 | overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }], 8 | settings: { 9 | "svelte3/typescript": () => require("typescript"), 10 | }, 11 | parserOptions: { 12 | sourceType: "module", 13 | ecmaVersion: 2020, 14 | }, 15 | env: { 16 | browser: true, 17 | es2017: true, 18 | node: true, 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /apps/web/src/lib/api/middlewares/perfMiddleware.ts: -------------------------------------------------------------------------------- 1 | import { middleware } from "../trpc"; 2 | 3 | const perfMiddleware = middleware(async ({ path, type, next }) => { 4 | const start = Date.now(); 5 | performance.mark("Start"); 6 | const result = await next(); 7 | performance.mark("End"); 8 | performance.measure(`[${result.ok ? "OK" : "ERROR"}][$1] ${type} '${path}'`, "Start", "End"); 9 | const durationMs = Date.now() - start; 10 | 11 | if (import.meta.env.DEV) { 12 | console.log(`[${result.ok ? "OK" : "ERROR"}][ ${durationMs}ms ] ${type} '${path}'`); 13 | } 14 | 15 | return result; 16 | }); 17 | 18 | export default perfMiddleware; 19 | -------------------------------------------------------------------------------- /apps/web/src/lib/api/routes/public-viewer/drinks/drinks.schema.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | export const ZDrinkSchema = z.object({ 4 | id: z.number(), 5 | }); 6 | 7 | export type TDrinkSchema = z.infer; 8 | 9 | export const ZDrinksSchema = z.object({ 10 | filters: z.object({ 11 | name: z.string().nullish(), 12 | }), 13 | limit: z.number().min(1).max(100).nullish(), 14 | /** 15 | * Cursor needs to exist to use useInfiniteQuery. 16 | * This is automatically set by Tanstack Query. 17 | */ 18 | cursor: z.number().nullish(), 19 | }); 20 | 21 | export type TDrinksSchema = z.infer; 22 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "pipeline": { 4 | "build": { 5 | "dependsOn": [ 6 | "^db:generate", 7 | "^build" 8 | ], 9 | "outputs": [".svelte-kit/**", ".vercel/**"] 10 | }, 11 | "lint": { 12 | "cache": false 13 | }, 14 | "lint:fix": { 15 | "cache": false 16 | }, 17 | "type-check": { 18 | "cache": false 19 | }, 20 | "dev": { 21 | "cache": false, 22 | "persistent": true 23 | }, 24 | "db:generate": { 25 | "cache": false 26 | }, 27 | "db:push": { 28 | "cache": false 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@acme/tsconfig/tsconfig-svelte-library.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "$components": [ 7 | "./components" 8 | ], 9 | "$components/*": [ 10 | "./components/*" 11 | ] 12 | }, 13 | }, 14 | "include": [ 15 | "./index.ts", 16 | "./components/**/*.d.ts", 17 | "./components/**/*.ts", 18 | "./components/**/*.js", 19 | "./components/**/*.svelte" 20 | ], 21 | "exclude": [ 22 | "dist", 23 | "build", 24 | "node_modules" 25 | ] 26 | } -------------------------------------------------------------------------------- /packages/tsconfig/tsconfig-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Default", 4 | "compilerOptions": { 5 | "composite": false, 6 | "declaration": true, 7 | "declarationMap": true, 8 | "esModuleInterop": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "inlineSources": false, 11 | "isolatedModules": true, 12 | "moduleResolution": "node", 13 | "noUnusedLocals": false, 14 | "noUnusedParameters": false, 15 | "preserveWatchOutput": true, 16 | "skipLibCheck": true, 17 | "strict": true 18 | }, 19 | "exclude": [ 20 | "node_modules" 21 | ] 22 | } -------------------------------------------------------------------------------- /apps/web/src/lib/api/root.ts: -------------------------------------------------------------------------------- 1 | import { authedViewerRouter } from "./routes/authed-viewer/_router"; 2 | import { publicViewerRouter } from "./routes/public-viewer/_router"; 3 | import { sessionRouter } from "./routes/public-viewer/session.router"; 4 | import { mergeRouters, router } from "./trpc"; 5 | 6 | /** 7 | * This is the primary router. 8 | */ 9 | export const appRouter = mergeRouters( 10 | sessionRouter, 11 | authedViewerRouter, 12 | router({ 13 | /** 14 | * All routes here are prefixed with `public`. 15 | * This makes it easy to add things such as: 16 | * cache headers, rate limiting, etc. 17 | */ 18 | public: publicViewerRouter, 19 | }) 20 | ); 21 | 22 | export type AppRouter = typeof appRouter; 23 | -------------------------------------------------------------------------------- /apps/web/src/routes/drinks/+page.server.ts: -------------------------------------------------------------------------------- 1 | import type { TDrinksSchema } from "$lib/api/routes/public-viewer/drinks/drinks.schema"; 2 | import { trpcLoad } from "$lib/api/trpc-load"; 3 | 4 | import type { PageServerLoad } from "./$types"; 5 | 6 | export const load = (async (event) => { 7 | const drinksQueryFilter = { 8 | name: null, 9 | }; 10 | 11 | const drinksQueryLimit = 6; 12 | 13 | const drinksQueryProps = { 14 | filters: drinksQueryFilter, 15 | limit: drinksQueryLimit, 16 | } satisfies Omit; 17 | 18 | return { 19 | drinks: trpcLoad(event, (trpc) => 20 | trpc.public.drinks.getMany({ 21 | ...drinksQueryProps, 22 | }) 23 | ), 24 | drinksQueryProps, 25 | }; 26 | }) satisfies PageServerLoad; 27 | -------------------------------------------------------------------------------- /apps/web/src/routes/drinks/[id]/+page.svelte: -------------------------------------------------------------------------------- 1 | 11 | 12 |
13 |
14 |
15 | Return to drinks 16 |

17 | {drink.name} 18 |

19 | 20 |

21 | {drink.description} 22 |

23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@acme/ui", 3 | "version": "0.0.0", 4 | "description": "Svelte component library", 5 | "license": "MIT", 6 | "type": "module", 7 | "main": "index", 8 | "module": "index.ts", 9 | "svelte": "index.ts", 10 | "scripts": { 11 | "lint": "eslint .", 12 | "lint:fix": "eslint . --fix", 13 | "type-check": "svelte-check --tsconfig ./tsconfig.json" 14 | }, 15 | "devDependencies": { 16 | "@acme/config": "workspace:^", 17 | "@acme/tsconfig": "workspace:^", 18 | "class-variance-authority": "^0.6.0", 19 | "lucide-svelte": "^0.246.0", 20 | "svelte": "^3.59.1", 21 | "svelte-check": "^2.7.1", 22 | "typescript": "^5.0.0" 23 | }, 24 | "dependencies": { 25 | "@acme/core": "workspace:^", 26 | "radix-svelte": "^0.7.1" 27 | } 28 | } -------------------------------------------------------------------------------- /packages/config/prettier-preset.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: true, 3 | bracketSameLine: true, 4 | singleQuote: false, 5 | jsxSingleQuote: false, 6 | trailingComma: "es5", 7 | semi: true, 8 | printWidth: 110, 9 | arrowParens: "always", 10 | importOrder: [ 11 | "^@(acme)/(.*)$", 12 | "^\\$lib/(.*)$", 13 | "^\\$components/(.*)$", 14 | "^\\$(core)/(.*)$", 15 | "^[./]", 16 | ], 17 | importOrderSeparation: true, 18 | plugins: [ 19 | "@trivago/prettier-plugin-sort-imports", 20 | /** 21 | * Tailwind plugin must come last! 22 | * 23 | * @see https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins 24 | */ 25 | "prettier-plugin-tailwindcss", 26 | ] 27 | }; -------------------------------------------------------------------------------- /packages/ui/components/badge/index.ts: -------------------------------------------------------------------------------- 1 | import { cva } from "class-variance-authority"; 2 | 3 | export { default as Badge } from "./Badge.svelte"; 4 | export const badgeVariants = cva( 5 | "inline-flex items-center border rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", 6 | { 7 | variants: { 8 | variant: { 9 | default: "bg-primary hover:bg-primary/80 border-transparent text-primary-foreground", 10 | secondary: "bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground", 11 | destructive: "bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground", 12 | outline: "text-foreground", 13 | }, 14 | }, 15 | defaultVariants: { 16 | variant: "default", 17 | }, 18 | } 19 | ); 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "acme-monorepo", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "turbo run build", 7 | "dev": "turbo run dev", 8 | "lint": "turbo run lint", 9 | "lint:fix": "turbo run lint:fix", 10 | "pre-commit": "lint-staged", 11 | "format": "prettier --write \"**/*.{ts,tsx,md,svelte}\"", 12 | "prisma": "pnpm run --filter @acme/database prisma", 13 | "lint-staged": "lint-staged", 14 | "prepare": "husky install", 15 | "type-check": "turbo run type-check" 16 | }, 17 | "devDependencies": { 18 | "@commitlint/cli": "^17.6.5", 19 | "@commitlint/config-conventional": "^17.6.5", 20 | "eslint": "^8.43.0", 21 | "husky": "^8.0.3", 22 | "lint-staged": "^13.2.2", 23 | "prettier": "^2.8.8", 24 | "turbo": "latest" 25 | }, 26 | "packageManager": "pnpm@7.15.0" 27 | } 28 | -------------------------------------------------------------------------------- /packages/tsconfig/tsconfig-svelte-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/svelte/tsconfig.json", 3 | "compilerOptions": { 4 | /** 5 | * use ignoreDeprecations because verbatimModuleSyntax not supported upstream by @tsconfig/svelte yet. 6 | * @see https://github.com/sveltejs/svelte/issues/8424 7 | */ 8 | "ignoreDeprecations": "5.0", 9 | "target": "ESNext", 10 | "useDefineForClassFields": true, 11 | "module": "ESNext", 12 | "resolveJsonModule": true, 13 | /** 14 | * Typecheck JS in `.svelte` and `.js` files by default. 15 | * Disable checkJs if you'd like to use dynamic types in JS. 16 | * Note that setting allowJs false does not prevent the use 17 | * of JS in `.svelte` files. 18 | */ 19 | "allowJs": true, 20 | "checkJs": true, 21 | "isolatedModules": true 22 | } 23 | } -------------------------------------------------------------------------------- /packages/ui/components/pulse/Pulse.svelte: -------------------------------------------------------------------------------- 1 | 12 | 13 |