├── .env.example ├── .eslintrc.js ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .lintstagedrc ├── .npmrc ├── .prettierignore ├── README.md ├── apps ├── my-t3-app │ ├── .eslintrc.cjs │ ├── README.md │ ├── next-env.d.ts │ ├── next.config.mjs │ ├── package.json │ ├── postcss.config.cjs │ ├── prettier.config.cjs │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── env.mjs │ │ ├── pages │ │ │ ├── _app.tsx │ │ │ ├── api │ │ │ │ ├── auth │ │ │ │ │ └── [...nextauth].ts │ │ │ │ └── trpc │ │ │ │ │ └── [trpc].ts │ │ │ └── index.tsx │ │ ├── server │ │ │ ├── api │ │ │ │ ├── root.ts │ │ │ │ ├── routers │ │ │ │ │ └── example.ts │ │ │ │ └── trpc.ts │ │ │ └── auth.ts │ │ ├── styles │ │ │ └── globals.css │ │ └── utils │ │ │ └── api.ts │ ├── tailwind.config.cjs │ └── tsconfig.json ├── my-t3-drizzle │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── .npmrc │ ├── README.md │ ├── drizzle.config.ts │ ├── next.config.mjs │ ├── package.json │ ├── pnpm-lock.yaml │ ├── postcss.config.cjs │ ├── prettier.config.cjs │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── env.mjs │ │ ├── pages │ │ │ ├── _app.tsx │ │ │ ├── api │ │ │ │ ├── auth │ │ │ │ │ └── [...nextauth].ts │ │ │ │ └── trpc │ │ │ │ │ └── [trpc].ts │ │ │ └── index.tsx │ │ ├── server │ │ │ ├── adapters │ │ │ │ └── drizzleAdapter.ts │ │ │ ├── api │ │ │ │ ├── root.ts │ │ │ │ ├── routers │ │ │ │ │ └── example.ts │ │ │ │ └── trpc.ts │ │ │ └── auth.ts │ │ ├── styles │ │ │ └── globals.css │ │ └── utils │ │ │ └── api.ts │ ├── tailwind.config.ts │ └── tsconfig.json └── web │ ├── .eslintrc.js │ ├── README.md │ ├── next-env.d.ts │ ├── next.config.js │ ├── package.json │ ├── postcss.config.cjs │ ├── prettier.config.cjs │ ├── public │ ├── next.svg │ └── vercel.svg │ ├── src │ └── app │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── tailwind.config.cjs │ └── tsconfig.json ├── commitlint.config.js ├── package.json ├── packages ├── config │ ├── commitlint.config.js │ ├── package.json │ ├── postcss.config.js │ ├── prettier.config.js │ └── tailwind.config.js ├── drizzle │ ├── .eslintrc.cjs │ ├── drizzle.config.ts │ ├── index.ts │ ├── package.json │ ├── prettier.config.cjs │ ├── schemas │ │ ├── auth.ts │ │ ├── index.ts │ │ └── schema.ts │ └── tsconfig.json ├── eslint-config-custom │ ├── index.js │ └── package.json ├── prisma-orm │ ├── index.ts │ ├── package.json │ ├── prisma │ │ └── schema.prisma │ └── tsconfig.json ├── tsconfig │ ├── base.json │ ├── nextjs.json │ ├── package.json │ └── react-library.json ├── ui │ ├── package.json │ ├── postcss.config.js │ ├── prettier.config.js │ ├── src │ │ ├── components │ │ │ ├── accordion.tsx │ │ │ ├── button.tsx │ │ │ └── index.ts │ │ ├── index.tsx │ │ └── layout │ │ │ ├── gradient.tsx │ │ │ ├── index.ts │ │ │ └── page-head.tsx │ ├── tailwind.config.js │ └── tsconfig.json └── utils │ ├── cn.ts │ ├── index.ts │ ├── package.json │ └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── prettier.config.js └── turbo.json /.env.example: -------------------------------------------------------------------------------- 1 | # Since the ".env" file is gitignored, you can use the ".env.example" file to 2 | # build a new ".env" file when you clone the repo. Keep this file up-to-date 3 | # when you add new variables to `.env`. 4 | 5 | # This file will be committed to version control, so make sure not to have any 6 | # secrets in it. If you are cloning this repo, create a copy of this file named 7 | # ".env" and populate it with your secrets. 8 | 9 | # When adding additional environment variables, the schema in "/src/env.mjs" 10 | # should be updated accordingly. 11 | 12 | # Node Envviorment 13 | NODE_ENV="development" 14 | 15 | # Prisma 16 | # https://www.prisma.io/docs/reference/database-reference/connection-urls#env 17 | DATABASE_URL="file:./db.sqlite" 18 | 19 | # Next Auth 20 | # You can generate a new secret on the command line with: 21 | # openssl rand -base64 32 22 | # https://next-auth.js.org/configuration/options#secret 23 | NEXTAUTH_SECRET="" 24 | NEXTAUTH_URL="http://localhost:3000" 25 | 26 | # Next Auth Discord Provider 27 | DISCORD_CLIENT_ID="" 28 | DISCORD_CLIENT_SECRET="" 29 | 30 | # Drizzle crediential 31 | DB_HOST="localhost" 32 | DB_USERNAME="root" 33 | DB_PASSWORD="password" 34 | DB_NAME="my_db" 35 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | // This tells ESLint to load the config from the package `eslint-config-custom` 4 | extends: ['@retconned/eslint-config-custom'], 5 | settings: { 6 | next: { 7 | rootDir: ['apps/*/'] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.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 | # next.js 12 | .next/ 13 | out/ 14 | dist/ 15 | build 16 | next-env.d.ts 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env.local 30 | .env.development.local 31 | .env.test.local 32 | .env.production.local 33 | 34 | # turbo 35 | .turbo 36 | .turbo_cache 37 | 38 | # vscode 39 | .vscode 40 | 41 | 42 | # env 43 | .env -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | # Check ESLint Standards 5 | pnpm run check:commit:msg:staged || 6 | ( 7 | echo '👋 Hey you typed a wrong message! 👋 8 | Commitlint ensures you keep best practices by enforcing you to follow them!' 9 | false; 10 | ) 11 | 12 | echo '🎉🎊🥳 Awesome, your commit rocks all over the place!' 13 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | echo '💅 Styling, testing and building your project before committing' 5 | 6 | # Check ESLint Standards 7 | pnpm run lint:staged || 8 | ( 9 | echo '❌😱 Get that weak shit out of here! 10 | ESLint Check Failed. Make the required changes listed above, add changes and try to commit again.' 11 | false; 12 | ) 13 | 14 | # Building... 15 | echo '🛠 Trying to build the code... ' 16 | 17 | pnpm run build || 18 | ( 19 | echo '❌😱 Next build failed: View the errors above to see why.' 20 | false; 21 | ) 22 | 23 | # If everything passes... Now we can check commit message 24 | echo '👨‍💻 Checking commit message ' 25 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "**/*.{js,jsx,ts,tsx,json,css,scss,md}": ["pnpm run check:prettier:staged"] 3 | } 4 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | auto-install-peers=true 2 | strict-peer-dependencies=false 3 | link-workspace-packages= 4 | public-hoist-pattern[]=*prisma* 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | public 4 | build 5 | coverage 6 | .turbo 7 | .turbo_cache 8 | .next 9 | next-env.d.ts 10 | .vscode -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Welcome to pnpm-turborepo-boilerplate 👋

2 | 3 | ## What's inside? 4 | 5 | This turborepo uses [pnpm](https://pnpm.io) as a package manager. It includes the following packages/apps: 6 | 7 | > ### Apps and Packages 8 | 9 | - `web`: a Next 13 [Next.js](https://nextjs.org/) app. 10 | - `t3-app`: a [T3 Stack](https://create.t3.gg/) project bootstrapped with create-t3-app. 11 | - `t3-drizzle`: a [T3 Stack](https://create.t3.gg/) project bootstrapped with create-t3-app & [Drizzle-orm](https://github.com/drizzle-team/drizzle-orm). 12 | - `ui`: a stub React component library shared throughout the monorepo. 13 | - `utils`: shared utils throughout the monorepo. 14 | - `prisma-orm`: Prisma instence / client used throughout the monorepo. 15 | - `drizzle`: Drizzle-orm & drizzle-kit used throughout the monorepo. 16 | - `eslint-config-custom`: `eslint` . 17 | - `tsconfig`: `tsconfig.json`'s used throughout the monorepo. 18 | 19 | Each package & app is 100% [TypeScript](https://www.typescriptlang.org/). 20 | 21 | > ### Utilities 22 | 23 | This turborepo has some additional tools already setup for you: 24 | 25 | - [TypeScript](https://www.typescriptlang.org/) for static type checking 26 | - [ESLint](https://eslint.org/) for code linting 27 | - [Prettier](https://prettier.io) for code formatting 28 | - [Pretty-quick](https://github.com/azz/pretty-quick) runs prettier over changed files 29 | - [Prisma](https://github.com/prisma/prisma) Prisma is a next-generation Typescript ORM 30 | - [Drizzle](https://github.com/drizzle-team/drizzle-orm) Drizzle ORM is a TypeScript ORM for SQL databases 31 | 32 | For git integration it has also: 33 | 34 | - [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for improving commits 35 | - [Husky](https://github.com/typicode/husky) for improving commits 36 | 37 | > ### Prerequisites 38 | 39 | - pnpm 40 | - node >=18.4.0 41 | -------------------------------------------------------------------------------- /apps/my-t3-app/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const path = require("path"); 3 | 4 | /** @type {import("eslint").Linter.Config} */ 5 | const config = { 6 | overrides: [ 7 | { 8 | extends: [ 9 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 10 | ], 11 | files: ["*.ts", "*.tsx"], 12 | parserOptions: { 13 | project: path.join(__dirname, "tsconfig.json"), 14 | }, 15 | }, 16 | ], 17 | parser: "@typescript-eslint/parser", 18 | parserOptions: { 19 | project: path.join(__dirname, "tsconfig.json"), 20 | }, 21 | plugins: ["@typescript-eslint"], 22 | extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], 23 | rules: { 24 | "@typescript-eslint/consistent-type-imports": [ 25 | "warn", 26 | { 27 | prefer: "type-imports", 28 | fixStyle: "inline-type-imports", 29 | }, 30 | ], 31 | "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], 32 | }, 33 | }; 34 | 35 | module.exports = config; 36 | -------------------------------------------------------------------------------- /apps/my-t3-app/README.md: -------------------------------------------------------------------------------- 1 | # Create T3 App 2 | 3 | This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app`. 4 | 5 | ## What's next? How do I make an app with this? 6 | 7 | We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary. 8 | 9 | If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help. 10 | 11 | - [Next.js](https://nextjs.org) 12 | - [NextAuth.js](https://next-auth.js.org) 13 | - [Prisma](https://prisma.io) 14 | - [Tailwind CSS](https://tailwindcss.com) 15 | - [tRPC](https://trpc.io) 16 | 17 | ## Learn More 18 | 19 | To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources: 20 | 21 | - [Documentation](https://create.t3.gg/) 22 | - [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials 23 | 24 | You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome! 25 | 26 | ## How do I deploy this? 27 | 28 | Follow our deployment guides for [Vercel](https://create.t3.gg/en/deployment/vercel), [Netlify](https://create.t3.gg/en/deployment/netlify) and [Docker](https://create.t3.gg/en/deployment/docker) for more information. 29 | -------------------------------------------------------------------------------- /apps/my-t3-app/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /apps/my-t3-app/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. 3 | * This is especially useful for Docker builds. 4 | */ 5 | !process.env.SKIP_ENV_VALIDATION && (await import("./src/env.mjs")); 6 | 7 | /** @type {import("next").NextConfig} */ 8 | const config = { 9 | reactStrictMode: true, 10 | transpilePackages: ["@retconned/ui","@retconned/prisma-orm"], 11 | /** 12 | * If you have the "experimental: { appDir: true }" setting enabled, then you 13 | * must comment the below `i18n` config out. 14 | * 15 | * @see https://github.com/vercel/next.js/issues/41980 16 | */ 17 | i18n: { 18 | locales: ["en"], 19 | defaultLocale: "en", 20 | }, 21 | }; 22 | export default config; 23 | -------------------------------------------------------------------------------- /apps/my-t3-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-t3-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build", 7 | "dev": "next dev", 8 | "postinstall": "prisma generate --schema=../../packages/prisma-orm/prisma/schema.prisma", 9 | "lint": "next lint", 10 | "start": "next start" 11 | }, 12 | "dependencies": { 13 | "@retconned/ui": "workspace:*", 14 | "@retconned/utils": "workspace:*", 15 | "@next-auth/prisma-adapter": "^1.0.5", 16 | "@tanstack/react-query": "^4.20.2", 17 | "@trpc/client": "^10.9.0", 18 | "@trpc/next": "^10.9.0", 19 | "@trpc/react-query": "^10.9.0", 20 | "@trpc/server": "^10.9.0", 21 | "next": "^13.2.1", 22 | "next-auth": "^4.19.0", 23 | "react": "18.2.0", 24 | "react-dom": "18.2.0", 25 | "superjson": "1.9.1", 26 | "zod": "^3.20.6" 27 | }, 28 | "devDependencies": { 29 | "@retconned/config": "workspace:*", 30 | "@retconned/eslint-config-custom": "workspace:*", 31 | "@retconned/tsconfig": "workspace:*", 32 | "@retconned/prisma-orm": "workspace:*", 33 | "@types/eslint": "^8.21.1", 34 | "@types/node": "^18.14.0", 35 | "@types/prettier": "^2.7.2", 36 | "@types/react": "^18.0.28", 37 | "@types/react-dom": "^18.0.11", 38 | "@typescript-eslint/eslint-plugin": "^5.53.0", 39 | "@typescript-eslint/parser": "^5.53.0", 40 | "autoprefixer": "^10.4.7", 41 | "eslint": "^8.34.0", 42 | "eslint-config-next": "^13.2.1", 43 | "postcss": "^8.4.14", 44 | "prettier": "^2.8.1", 45 | "prettier-plugin-tailwindcss": "^0.2.1", 46 | "prisma": "^4.9.0", 47 | "tailwindcss": "^3.2.0", 48 | "typescript": "^4.9.5" 49 | }, 50 | "ct3aMetadata": { 51 | "initVersion": "7.8.0" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /apps/my-t3-app/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/postcss.config') 2 | -------------------------------------------------------------------------------- /apps/my-t3-app/prettier.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require("@retconned/config/prettier.config"); 2 | -------------------------------------------------------------------------------- /apps/my-t3-app/public/favicon.ico: -------------------------------------------------------------------------------- 1 |  h6  (�00 h&�(  ���L���A���$������������5����������A����������������������b�������������������� 2 | �����������������������}���0����������b�����������������l����������_�������2����������_���X���\�������������������������R������m�����������������������L�������������������G���N������������������������������Q�������������A���O���������������������������������������|������( @ ������B���h���n���R������f�����������;��� ���������������������������������%��������������J����������������������������������������������O��������������J�������������������������f���_����������������������>��������������J������������������)��� ��������������������������������J������������������"������������������_��������������J���{����������=�������������������������J���{���5�����������������������������J��������������������������J�����������������������������J���i�������������������������J���%���������������3��������������J���4���9������U�����������������������������J���S�����������5���*���������������������������������J���������������������1���8������������������������J��� ������������������,�����������������J��� 3 | ������������������(��������������J��� �������������������$������<���<�������������������������!�������������������������V���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���+���������������������������������������������������������������������������������������������������������-�������������������������������������������������������������������������������������������������������������(�������������������������[���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���M��������������� 4 | (0` ������ ������"���%���$������������ ���J���J���J���;������ ���g��������������������������������B��� ���+������������������������b�����������������������������������������������������.������������������������������������������������������������������������������������;������.��������������������������������������������������������������������������������������������O������.���������������������������������������������������O���$������!���2������������������������������#���.����������������������:�����������������������j������!����������������������������.��������������������������������������������N�������������������������G���.����������������������)�������������������x������)�������������������������.����������������������y��������������� ����������������������&���.���������������������� 5 | ���{�������������!�������������������J���.���������������������� 6 | ���y���A����������������������_���.�����������������������������������������e���.�����������������������������������������]���.����������������������%�������������������G���.��������������������������������������������!���.����������������������5�������������������������.��������������������������������������������5���.����������������������������&������ ���,��������������������������.�������������������������C�����������8������ ���������������������������������.����������������������L�������������������"������y�����������������������8������.������������������������������������������������������������������������*���.����������������������$��������������������������.������u���������.�������������������������&�����������������������������������.���������������������������������������������������.����������������������*��������������������������&���.�������������������������-��������������������������������d���d���d���O��� 7 | ���%�����������������������������1��������������������������������4����������������������������� ������!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���������.�����������������������������U����������������������������������������������������������������������������������������������������������������������0���8�����������������������������a���������������������������������������������������������������������������������������������������������������������������������<�������������������������� ���a����������������������������������������������������������������������������������������������������������������������������������9�������������������������� ���X�������������������������������������������������������������������������������������������������������������������������������������<������������������1��� ���!���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#��� ��� ��������������������� -------------------------------------------------------------------------------- /apps/my-t3-app/src/env.mjs: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | /** 4 | * Specify your server-side environment variables schema here. This way you can ensure the app isn't 5 | * built with invalid env vars. 6 | */ 7 | const server = z.object({ 8 | DATABASE_URL: z.string().url(), 9 | NODE_ENV: z.enum(["development", "test", "production"]), 10 | NEXTAUTH_SECRET: 11 | process.env.NODE_ENV === "production" 12 | ? z.string().min(1) 13 | : z.string().min(1).optional(), 14 | NEXTAUTH_URL: z.preprocess( 15 | // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL 16 | // Since NextAuth.js automatically uses the VERCEL_URL if present. 17 | (str) => process.env.VERCEL_URL ?? str, 18 | // VERCEL_URL doesn't include `https` so it cant be validated as a URL 19 | process.env.VERCEL ? z.string().min(1) : z.string().url(), 20 | ), 21 | // Add `.min(1) on ID and SECRET if you want to make sure they're not empty 22 | DISCORD_CLIENT_ID: z.string(), 23 | DISCORD_CLIENT_SECRET: z.string(), 24 | }); 25 | 26 | /** 27 | * Specify your client-side environment variables schema here. This way you can ensure the app isn't 28 | * built with invalid env vars. To expose them to the client, prefix them with `NEXT_PUBLIC_`. 29 | */ 30 | const client = z.object({ 31 | // NEXT_PUBLIC_CLIENTVAR: z.string().min(1), 32 | }); 33 | 34 | /** 35 | * You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g. 36 | * middlewares) or client-side so we need to destruct manually. 37 | * 38 | * @type {Record | keyof z.infer, string | undefined>} 39 | */ 40 | const processEnv = { 41 | DATABASE_URL: process.env.DATABASE_URL, 42 | NODE_ENV: process.env.NODE_ENV, 43 | NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, 44 | NEXTAUTH_URL: process.env.NEXTAUTH_URL, 45 | DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, 46 | DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, 47 | // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, 48 | }; 49 | 50 | // Don't touch the part below 51 | // -------------------------- 52 | 53 | const merged = server.merge(client); 54 | 55 | /** @typedef {z.input} MergedInput */ 56 | /** @typedef {z.infer} MergedOutput */ 57 | /** @typedef {z.SafeParseReturnType} MergedSafeParseReturn */ 58 | 59 | let env = /** @type {MergedOutput} */ (process.env); 60 | 61 | if (!!process.env.SKIP_ENV_VALIDATION == false) { 62 | const isServer = typeof window === "undefined"; 63 | 64 | const parsed = /** @type {MergedSafeParseReturn} */ ( 65 | isServer 66 | ? merged.safeParse(processEnv) // on server we can validate all env vars 67 | : client.safeParse(processEnv) // on client we can only validate the ones that are exposed 68 | ); 69 | 70 | if (parsed.success === false) { 71 | console.error( 72 | "❌ Invalid environment variables:", 73 | parsed.error.flatten().fieldErrors, 74 | ); 75 | throw new Error("Invalid environment variables"); 76 | } 77 | 78 | env = new Proxy(parsed.data, { 79 | get(target, prop) { 80 | if (typeof prop !== "string") return undefined; 81 | // Throw a descriptive error if a server-side env var is accessed on the client 82 | // Otherwise it would just be returning `undefined` and be annoying to debug 83 | if (!isServer && !prop.startsWith("NEXT_PUBLIC_")) 84 | throw new Error( 85 | process.env.NODE_ENV === "production" 86 | ? "❌ Attempted to access a server-side environment variable on the client" 87 | : `❌ Attempted to access server-side environment variable '${prop}' on the client`, 88 | ); 89 | return target[/** @type {keyof typeof target} */ (prop)]; 90 | }, 91 | }); 92 | } 93 | 94 | export { env }; 95 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { type AppType } from "next/app"; 2 | import { type Session } from "next-auth"; 3 | import { SessionProvider } from "next-auth/react"; 4 | 5 | import { api } from "@/utils/api"; 6 | 7 | import "@/styles/globals.css"; 8 | 9 | const MyApp: AppType<{ session: Session | null }> = ({ 10 | Component, 11 | pageProps: { session, ...pageProps }, 12 | }) => { 13 | return ( 14 | 15 | 16 | 17 | ); 18 | }; 19 | 20 | export default api.withTRPC(MyApp); 21 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/pages/api/auth/[...nextauth].ts: -------------------------------------------------------------------------------- 1 | import NextAuth from "next-auth"; 2 | import { authOptions } from "@/server/auth"; 3 | 4 | export default NextAuth(authOptions); 5 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/pages/api/trpc/[trpc].ts: -------------------------------------------------------------------------------- 1 | import { createNextApiHandler } from "@trpc/server/adapters/next"; 2 | 3 | import { env } from "@/env.mjs"; 4 | import { createTRPCContext } from "@/server/api/trpc"; 5 | import { appRouter } from "@/server/api/root"; 6 | 7 | // export API handler 8 | export default createNextApiHandler({ 9 | router: appRouter, 10 | createContext: createTRPCContext, 11 | onError: 12 | env.NODE_ENV === "development" 13 | ? ({ path, error }) => { 14 | console.error( 15 | `❌ tRPC failed on ${path ?? ""}: ${error.message}`, 16 | ); 17 | } 18 | : undefined, 19 | }); 20 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { type NextPage } from "next"; 2 | import Head from "next/head"; 3 | import Link from "next/link"; 4 | import { signIn, signOut, useSession } from "next-auth/react"; 5 | 6 | import { api } from "@/utils/api"; 7 | 8 | const Home: NextPage = () => { 9 | const hello = api.example.hello.useQuery({ text: "from tRPC" }); 10 | 11 | return ( 12 | <> 13 | 14 | Create T3 App 15 | 16 | 17 | 18 |
19 |
20 |

21 | Create T3 App 22 |

23 |
24 | 29 |

First Steps →

30 |
31 | Just the basics - Everything you need to know to set up your 32 | database and authentication. 33 |
34 | 35 | 40 |

Documentation →

41 |
42 | Learn more about Create T3 App, the libraries it uses, and how 43 | to deploy it. 44 |
45 | 46 |
47 |
48 |

49 | {hello.data ? hello.data.greeting : "Loading tRPC query..."} 50 |

51 | 52 |
53 |
54 |
55 | 56 | ); 57 | }; 58 | 59 | export default Home; 60 | 61 | const AuthShowcase: React.FC = () => { 62 | const { data: sessionData } = useSession(); 63 | 64 | const { data: secretMessage } = api.example.getSecretMessage.useQuery( 65 | undefined, // no input 66 | { enabled: sessionData?.user !== undefined }, 67 | ); 68 | 69 | return ( 70 |
71 |

72 | {sessionData && Logged in as {sessionData.user?.name}} 73 | {secretMessage && - {secretMessage}} 74 |

75 | 81 |
82 | ); 83 | }; 84 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/server/api/root.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCRouter } from "@/server/api/trpc"; 2 | import { exampleRouter } from "@/server/api/routers/example"; 3 | 4 | /** 5 | * This is the primary router for your server. 6 | * 7 | * All routers added in /api/routers should be manually added here. 8 | */ 9 | export const appRouter = createTRPCRouter({ 10 | example: exampleRouter, 11 | }); 12 | 13 | // export type definition of API 14 | export type AppRouter = typeof appRouter; 15 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/server/api/routers/example.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | import { 4 | createTRPCRouter, 5 | publicProcedure, 6 | protectedProcedure, 7 | } from "@/server/api/trpc"; 8 | 9 | export const exampleRouter = createTRPCRouter({ 10 | hello: publicProcedure 11 | .input(z.object({ text: z.string() })) 12 | .query(({ input }) => { 13 | return { 14 | greeting: `Hello ${input.text}`, 15 | }; 16 | }), 17 | 18 | getAll: publicProcedure.query(({ ctx }) => { 19 | return ctx.prisma.example.findMany(); 20 | }), 21 | 22 | getSecretMessage: protectedProcedure.query(() => { 23 | return "you can now see this secret message!"; 24 | }), 25 | }); 26 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/server/api/trpc.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * YOU PROBABLY DON'T NEED TO EDIT THIS FILE, UNLESS: 3 | * 1. You want to modify request context (see Part 1). 4 | * 2. You want to create a new middleware or type of procedure (see Part 3). 5 | * 6 | * TL;DR - This is where all the tRPC server stuff is created and plugged in. The pieces you will 7 | * need to use are documented accordingly near the end. 8 | */ 9 | 10 | /** 11 | * 1. CONTEXT 12 | * 13 | * This section defines the "contexts" that are available in the backend API. 14 | * 15 | * These allow you to access things when processing a request, like the database, the session, etc. 16 | */ 17 | import { type CreateNextContextOptions } from "@trpc/server/adapters/next"; 18 | import { type Session } from "next-auth"; 19 | 20 | import { getServerAuthSession } from "@/server/auth"; 21 | import { prisma } from "../../../../../packages/prisma-orm"; 22 | 23 | type CreateContextOptions = { 24 | session: Session | null; 25 | }; 26 | 27 | /** 28 | * This helper generates the "internals" for a tRPC context. If you need to use it, you can export 29 | * it from here. 30 | * 31 | * Examples of things you may need it for: 32 | * - testing, so we don't have to mock Next.js' req/res 33 | * - tRPC's `createSSGHelpers`, where we don't have req/res 34 | * 35 | * @see https://create.t3.gg/en/usage/trpc#-servertrpccontextts 36 | */ 37 | const createInnerTRPCContext = (opts: CreateContextOptions) => { 38 | return { 39 | session: opts.session, 40 | prisma, 41 | }; 42 | }; 43 | 44 | /** 45 | * This is the actual context you will use in your router. It will be used to process every request 46 | * that goes through your tRPC endpoint. 47 | * 48 | * @see https://trpc.io/docs/context 49 | */ 50 | export const createTRPCContext = async (opts: CreateNextContextOptions) => { 51 | const { req, res } = opts; 52 | 53 | // Get the session from the server using the getServerSession wrapper function 54 | const session = await getServerAuthSession({ req, res }); 55 | 56 | return createInnerTRPCContext({ 57 | session, 58 | }); 59 | }; 60 | 61 | /** 62 | * 2. INITIALIZATION 63 | * 64 | * This is where the tRPC API is initialized, connecting the context and transformer. We also parse 65 | * ZodErrors so that you get typesafety on the frontend if your procedure fails due to validation 66 | * errors on the backend. 67 | */ 68 | import { initTRPC, TRPCError } from "@trpc/server"; 69 | import superjson from "superjson"; 70 | import { ZodError } from "zod"; 71 | 72 | const t = initTRPC.context().create({ 73 | transformer: superjson, 74 | errorFormatter({ shape, error }) { 75 | return { 76 | ...shape, 77 | data: { 78 | ...shape.data, 79 | zodError: 80 | error.cause instanceof ZodError ? error.cause.flatten() : null, 81 | }, 82 | }; 83 | }, 84 | }); 85 | 86 | /** 87 | * 3. ROUTER & PROCEDURE (THE IMPORTANT BIT) 88 | * 89 | * These are the pieces you use to build your tRPC API. You should import these a lot in the 90 | * "/src/server/api/routers" directory. 91 | */ 92 | 93 | /** 94 | * This is how you create new routers and sub-routers in your tRPC API. 95 | * 96 | * @see https://trpc.io/docs/router 97 | */ 98 | export const createTRPCRouter = t.router; 99 | 100 | /** 101 | * Public (unauthenticated) procedure 102 | * 103 | * This is the base piece you use to build new queries and mutations on your tRPC API. It does not 104 | * guarantee that a user querying is authorized, but you can still access user session data if they 105 | * are logged in. 106 | */ 107 | export const publicProcedure = t.procedure; 108 | 109 | /** Reusable middleware that enforces users are logged in before running the procedure. */ 110 | const enforceUserIsAuthed = t.middleware(({ ctx, next }) => { 111 | if (!ctx.session || !ctx.session.user) { 112 | throw new TRPCError({ code: "UNAUTHORIZED" }); 113 | } 114 | return next({ 115 | ctx: { 116 | // infers the `session` as non-nullable 117 | session: { ...ctx.session, user: ctx.session.user }, 118 | }, 119 | }); 120 | }); 121 | 122 | /** 123 | * Protected (authenticated) procedure 124 | * 125 | * If you want a query or mutation to ONLY be accessible to logged in users, use this. It verifies 126 | * the session is valid and guarantees `ctx.session.user` is not null. 127 | * 128 | * @see https://trpc.io/docs/procedures 129 | */ 130 | export const protectedProcedure = t.procedure.use(enforceUserIsAuthed); 131 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/server/auth.ts: -------------------------------------------------------------------------------- 1 | import { type GetServerSidePropsContext } from "next"; 2 | import { 3 | getServerSession, 4 | type NextAuthOptions, 5 | type DefaultSession, 6 | } from "next-auth"; 7 | import DiscordProvider from "next-auth/providers/discord"; 8 | import { PrismaAdapter } from "@next-auth/prisma-adapter"; 9 | import { env } from "@/env.mjs"; 10 | import { prisma } from "../../../../packages/prisma-orm"; 11 | 12 | /** 13 | * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session` 14 | * object and keep type safety. 15 | * 16 | * @see https://next-auth.js.org/getting-started/typescript#module-augmentation 17 | */ 18 | declare module "next-auth" { 19 | interface Session extends DefaultSession { 20 | user: { 21 | id: string; 22 | // ...other properties 23 | // role: UserRole; 24 | } & DefaultSession["user"]; 25 | } 26 | 27 | // interface User { 28 | // // ...other properties 29 | // // role: UserRole; 30 | // } 31 | } 32 | 33 | /** 34 | * Options for NextAuth.js used to configure adapters, providers, callbacks, etc. 35 | * 36 | * @see https://next-auth.js.org/configuration/options 37 | */ 38 | export const authOptions: NextAuthOptions = { 39 | callbacks: { 40 | session({ session, user }) { 41 | if (session.user) { 42 | session.user.id = user.id; 43 | // session.user.role = user.role; <-- put other properties on the session here 44 | } 45 | return session; 46 | }, 47 | }, 48 | adapter: PrismaAdapter(prisma), 49 | providers: [ 50 | DiscordProvider({ 51 | clientId: env.DISCORD_CLIENT_ID, 52 | clientSecret: env.DISCORD_CLIENT_SECRET, 53 | }), 54 | /** 55 | * ...add more providers here. 56 | * 57 | * Most other providers require a bit more work than the Discord provider. For example, the 58 | * GitHub provider requires you to add the `refresh_token_expires_in` field to the Account 59 | * model. Refer to the NextAuth.js docs for the provider you want to use. Example: 60 | * 61 | * @see https://next-auth.js.org/providers/github 62 | */ 63 | ], 64 | }; 65 | 66 | /** 67 | * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. 68 | * 69 | * @see https://next-auth.js.org/configuration/nextjs 70 | */ 71 | export const getServerAuthSession = (ctx: { 72 | req: GetServerSidePropsContext["req"]; 73 | res: GetServerSidePropsContext["res"]; 74 | }) => { 75 | return getServerSession(ctx.req, ctx.res, authOptions); 76 | }; 77 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /apps/my-t3-app/src/utils/api.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the client-side entrypoint for your tRPC API. It is used to create the `api` object which 3 | * contains the Next.js App-wrapper, as well as your type-safe React Query hooks. 4 | * 5 | * We also create a few inference helpers for input and output types. 6 | */ 7 | import { createTRPCProxyClient,httpBatchLink, loggerLink } from "@trpc/client"; 8 | import { createTRPCNext,CreateTRPCNext } from "@trpc/next"; 9 | import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server"; 10 | import superjson from "superjson"; 11 | import {NextPageContext} from 'next/types' 12 | 13 | 14 | import { type AppRouter } from "@/server/api/root"; 15 | 16 | const getBaseUrl = () => { 17 | if (typeof window !== "undefined") return ""; // browser should use relative url 18 | if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url 19 | return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost 20 | }; 21 | 22 | /** A set of type-safe react-query hooks for your tRPC API. */ 23 | 24 | export const api: CreateTRPCNext = 25 | createTRPCNext({ 26 | config() { 27 | return { 28 | /** 29 | * Transformer used for data de-serialization from the server. 30 | * 31 | * @see https://trpc.io/docs/data-transformers 32 | */ 33 | transformer: superjson, 34 | 35 | /** 36 | * Links used to determine request flow from client to server. 37 | * 38 | * @see https://trpc.io/docs/links 39 | */ 40 | links: [ 41 | loggerLink({ 42 | enabled: (opts) => 43 | process.env.NODE_ENV === "development" || 44 | (opts.direction === "down" && opts.result instanceof Error), 45 | }), 46 | httpBatchLink({ 47 | url: `${getBaseUrl()}/api/trpc`, 48 | }), 49 | ], 50 | }; 51 | }, 52 | 53 | /** 54 | * Whether tRPC should await queries when server rendering pages. 55 | * 56 | * @see https://trpc.io/docs/nextjs#ssr-boolean-default-false 57 | */ 58 | 59 | ssr: false, 60 | }) 61 | 62 | 63 | /** 64 | * Inference helper for inputs. 65 | * 66 | * @example type HelloInput = RouterInputs['example']['hello'] 67 | */ 68 | export type RouterInputs = inferRouterInputs; 69 | 70 | /** 71 | * Inference helper for outputs. 72 | * 73 | * @example type HelloOutput = RouterOutputs['example']['hello'] 74 | */ 75 | export type RouterOutputs = inferRouterOutputs; 76 | -------------------------------------------------------------------------------- /apps/my-t3-app/tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/tailwind.config') 2 | -------------------------------------------------------------------------------- /apps/my-t3-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/nextjs.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": ["./src/*"] 7 | } 8 | }, 9 | "include": [ 10 | ".eslintrc.cjs", 11 | "next-env.d.ts", 12 | "**/*.ts", 13 | "**/*.tsx", 14 | "**/*.cjs", 15 | "**/*.mjs" 16 | ], 17 | "exclude": ["node_modules"] 18 | } 19 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const path = require("path"); 3 | 4 | /** @type {import("eslint").Linter.Config} */ 5 | const config = { 6 | overrides: [ 7 | { 8 | extends: [ 9 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 10 | ], 11 | files: ["*.ts", "*.tsx"], 12 | parserOptions: { 13 | project: path.join(__dirname, "tsconfig.json"), 14 | }, 15 | }, 16 | ], 17 | parser: "@typescript-eslint/parser", 18 | parserOptions: { 19 | project: path.join(__dirname, "tsconfig.json"), 20 | }, 21 | plugins: ["@typescript-eslint"], 22 | extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], 23 | rules: { 24 | "@typescript-eslint/consistent-type-imports": [ 25 | "warn", 26 | { 27 | prefer: "type-imports", 28 | fixStyle: "inline-type-imports", 29 | }, 30 | ], 31 | "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], 32 | }, 33 | }; 34 | 35 | module.exports = config; 36 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/.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 | # next.js 12 | /.next/ 13 | /out/ 14 | next-env.d.ts 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | .pnpm-debug.log* 28 | 29 | # local env files 30 | # do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables 31 | .env 32 | .env*.local 33 | 34 | # vercel 35 | .vercel 36 | 37 | # typescript 38 | *.tsbuildinfo 39 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/.npmrc: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies=false -------------------------------------------------------------------------------- /apps/my-t3-drizzle/README.md: -------------------------------------------------------------------------------- 1 | # Create T3 App 2 | 3 | This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app` using [Drizzle-orm](https://github.com/drizzle-team/drizzle-orm). 4 | 5 | ## Get started 6 | 7 | 1. Copy and fill secrets 8 | 9 | ```bash 10 | pnpm i 11 | cp .env.example .env 12 | ``` 13 | 14 | 2. Push your schema changes 15 | 16 | ```bash 17 | pnpm db:push 18 | ``` 19 | 20 | 3. Start developing 21 | 22 | ```bash 23 | pnpm dev 24 | ``` 25 | 26 | ## What's next? How do I make an app with this? 27 | 28 | We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary. 29 | 30 | If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help. 31 | 32 | - [Next.js](https://nextjs.org) 33 | - [NextAuth.js](https://next-auth.js.org) 34 | - [Drizzle-orm](https://github.com/drizzle-team/drizzle-orm) 35 | - [Tailwind CSS](https://tailwindcss.com) 36 | - [tRPC](https://trpc.io) 37 | 38 | ## Learn More 39 | 40 | To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources: 41 | 42 | - [Documentation](https://create.t3.gg/) 43 | - [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials 44 | 45 | You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome! 46 | 47 | ## How do I deploy this? 48 | 49 | Follow our deployment guides for [Vercel](https://create.t3.gg/en/deployment/vercel), [Netlify](https://create.t3.gg/en/deployment/netlify) and [Docker](https://create.t3.gg/en/deployment/docker) for more information. 50 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | // drizzle.config.ts 2 | import type { Config } from "drizzle-kit"; 3 | import "dotenv/config"; 4 | 5 | export default { 6 | host: process.env.DB_HOST, 7 | user: process.env.DB_USERNAME, 8 | password: process.env.DB_PASSWORD, 9 | database: process.env.DB_NAME, 10 | schema: ["./src/db/auth.ts", "./src/db/schema.ts"], 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful 3 | * for Docker builds. 4 | */ 5 | await import("./src/env.mjs"); 6 | 7 | /** @type {import("next").NextConfig} */ 8 | const config = { 9 | reactStrictMode: true, 10 | 11 | /** 12 | * If you have `experimental: { appDir: true }` set, then you must comment the below `i18n` config 13 | * out. 14 | * 15 | * @see https://github.com/vercel/next.js/issues/41980 16 | */ 17 | i18n: { 18 | locales: ["en"], 19 | defaultLocale: "en", 20 | }, 21 | }; 22 | export default config; 23 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-t3-drizzle", 3 | "version": "0.1.1", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build", 7 | "dev": "next dev", 8 | "lint": "next lint", 9 | "start": "next start", 10 | "db:push": "drizzle-kit push:mysql --config drizzle.config.ts" 11 | }, 12 | "dependencies": { 13 | "@retconned/ui": "workspace:*", 14 | "@retconned/utils": "workspace:*", 15 | "@paralleldrive/cuid2": "^2.2.0", 16 | "@t3-oss/env-nextjs": "^0.2.1", 17 | "@tanstack/react-query": "^4.28.0", 18 | "@trpc/client": "^10.18.0", 19 | "@trpc/next": "^10.18.0", 20 | "@trpc/react-query": "^10.18.0", 21 | "@trpc/server": "^10.18.0", 22 | "dotenv": "^16.0.3", 23 | "drizzle-orm": "^0.25.4", 24 | "mysql2": "^3.2.0", 25 | "next": "^13.4.1", 26 | "next-auth": "^4.21.0", 27 | "react": "18.2.0", 28 | "react-dom": "18.2.0", 29 | "superjson": "1.12.2", 30 | "zod": "^3.21.4" 31 | }, 32 | "devDependencies": { 33 | "@retconned/config": "workspace:*", 34 | "@retconned/eslint-config-custom": "workspace:*", 35 | "@retconned/tsconfig": "workspace:*", 36 | "@retconned/drizzle": "workspace:*", 37 | "@types/eslint": "^8.21.3", 38 | "@types/node": "^18.15.5", 39 | "@types/prettier": "^2.7.2", 40 | "@types/react": "^18.0.28", 41 | "@types/react-dom": "^18.0.11", 42 | "@typescript-eslint/eslint-plugin": "^5.56.0", 43 | "@typescript-eslint/parser": "^5.56.0", 44 | "autoprefixer": "^10.4.14", 45 | "eslint": "^8.36.0", 46 | "eslint-config-next": "^13.4.1", 47 | "postcss": "^8.4.21", 48 | "prettier": "^2.8.6", 49 | "prettier-plugin-tailwindcss": "^0.2.6", 50 | "tailwindcss": "^3.3.0", 51 | "typescript": "^5.0.2" 52 | }, 53 | "ct3aMetadata": { 54 | "initVersion": "7.13.0" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require("@retconned/config/postcss.config") 2 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/prettier.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require("@retconned/config/prettier.config"); 2 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/public/favicon.ico: -------------------------------------------------------------------------------- 1 |  h6  (�00 h&�(  ���L���A���$������������5����������A����������������������b�������������������� 2 | �����������������������}���0����������b�����������������l����������_�������2����������_���X���\�������������������������R������m�����������������������L�������������������G���N������������������������������Q�������������A���O���������������������������������������|������( @ ������B���h���n���R������f�����������;��� ���������������������������������%��������������J����������������������������������������������O��������������J�������������������������f���_����������������������>��������������J������������������)��� ��������������������������������J������������������"������������������_��������������J���{����������=�������������������������J���{���5�����������������������������J��������������������������J�����������������������������J���i�������������������������J���%���������������3��������������J���4���9������U�����������������������������J���S�����������5���*���������������������������������J���������������������1���8������������������������J��� ������������������,�����������������J��� 3 | ������������������(��������������J��� �������������������$������<���<�������������������������!�������������������������V���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���a���+���������������������������������������������������������������������������������������������������������-�������������������������������������������������������������������������������������������������������������(�������������������������[���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���h���M��������������� 4 | (0` ������ ������"���%���$������������ ���J���J���J���;������ ���g��������������������������������B��� ���+������������������������b�����������������������������������������������������.������������������������������������������������������������������������������������;������.��������������������������������������������������������������������������������������������O������.���������������������������������������������������O���$������!���2������������������������������#���.����������������������:�����������������������j������!����������������������������.��������������������������������������������N�������������������������G���.����������������������)�������������������x������)�������������������������.����������������������y��������������� ����������������������&���.���������������������� 5 | ���{�������������!�������������������J���.���������������������� 6 | ���y���A����������������������_���.�����������������������������������������e���.�����������������������������������������]���.����������������������%�������������������G���.��������������������������������������������!���.����������������������5�������������������������.��������������������������������������������5���.����������������������������&������ ���,��������������������������.�������������������������C�����������8������ ���������������������������������.����������������������L�������������������"������y�����������������������8������.������������������������������������������������������������������������*���.����������������������$��������������������������.������u���������.�������������������������&�����������������������������������.���������������������������������������������������.����������������������*��������������������������&���.�������������������������-��������������������������������d���d���d���O��� 7 | ���%�����������������������������1��������������������������������4����������������������������� ������!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���!���������.�����������������������������U����������������������������������������������������������������������������������������������������������������������0���8�����������������������������a���������������������������������������������������������������������������������������������������������������������������������<�������������������������� ���a����������������������������������������������������������������������������������������������������������������������������������9�������������������������� ���X�������������������������������������������������������������������������������������������������������������������������������������<������������������1��� ���!���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#��� ��� ��������������������� -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/env.mjs: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | import { createEnv } from "@t3-oss/env-nextjs"; 3 | 4 | export const env = createEnv({ 5 | /** 6 | * Specify your server-side environment variables schema here. This way you can ensure the app 7 | * isn't built with invalid env vars. 8 | */ 9 | server: { 10 | DB_HOST: z.string().min(1), 11 | DB_USERNAME: z.string().min(1), 12 | DB_PASSWORD: z.string().min(1), 13 | DB_NAME: z.string().min(1), 14 | DATABASE_URL: z.string().url(), 15 | NODE_ENV: z.enum(["development", "test", "production"]), 16 | NEXTAUTH_SECRET: 17 | process.env.NODE_ENV === "production" 18 | ? z.string().min(1) 19 | : z.string().min(1).optional(), 20 | NEXTAUTH_URL: z.preprocess( 21 | // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL 22 | // Since NextAuth.js automatically uses the VERCEL_URL if present. 23 | (str) => process.env.VERCEL_URL ?? str, 24 | // VERCEL_URL doesn't include `https` so it cant be validated as a URL 25 | process.env.VERCEL ? z.string().min(1) : z.string().url() 26 | ), 27 | // Add `.min(1) on ID and SECRET if you want to make sure they're not empty 28 | DISCORD_CLIENT_ID: z.string(), 29 | DISCORD_CLIENT_SECRET: z.string(), 30 | }, 31 | 32 | /** 33 | * Specify your client-side environment variables schema here. This way you can ensure the app 34 | * isn't built with invalid env vars. To expose them to the client, prefix them with 35 | * `NEXT_PUBLIC_`. 36 | */ 37 | client: { 38 | // NEXT_PUBLIC_CLIENTVAR: z.string().min(1), 39 | }, 40 | 41 | /** 42 | * You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g. 43 | * middlewares) or client-side so we need to destruct manually. 44 | */ 45 | runtimeEnv: { 46 | DB_HOST: process.env.DB_HOST, 47 | DB_USERNAME: process.env.DB_USERNAME, 48 | DB_PASSWORD: process.env.DB_PASSWORD, 49 | DB_NAME: process.env.DB_NAME, 50 | DATABASE_URL: process.env.DATABASE_URL, 51 | NODE_ENV: process.env.NODE_ENV, 52 | NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, 53 | NEXTAUTH_URL: process.env.NEXTAUTH_URL, 54 | DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, 55 | DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, 56 | }, 57 | }); 58 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { type AppType } from "next/app"; 2 | import { type Session } from "next-auth"; 3 | import { SessionProvider } from "next-auth/react"; 4 | 5 | import { api } from "@/utils/api"; 6 | 7 | import "@/styles/globals.css"; 8 | 9 | const MyApp: AppType<{ session: Session | null }> = ({ 10 | Component, 11 | pageProps: { session, ...pageProps }, 12 | }) => { 13 | return ( 14 | 15 | 16 | 17 | ); 18 | }; 19 | 20 | export default api.withTRPC(MyApp); 21 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/pages/api/auth/[...nextauth].ts: -------------------------------------------------------------------------------- 1 | import NextAuth from "next-auth"; 2 | import { authOptions } from "@/server/auth"; 3 | 4 | export default NextAuth(authOptions); 5 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/pages/api/trpc/[trpc].ts: -------------------------------------------------------------------------------- 1 | import { createNextApiHandler } from "@trpc/server/adapters/next"; 2 | 3 | import { env } from "@/env.mjs"; 4 | import { createTRPCContext } from "@/server/api/trpc"; 5 | import { appRouter } from "@/server/api/root"; 6 | 7 | // export API handler 8 | export default createNextApiHandler({ 9 | router: appRouter, 10 | createContext: createTRPCContext, 11 | onError: 12 | env.NODE_ENV === "development" 13 | ? ({ path, error }) => { 14 | console.error( 15 | `❌ tRPC failed on ${path ?? ""}: ${error.message}`, 16 | ); 17 | } 18 | : undefined, 19 | }); 20 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { type NextPage } from "next"; 2 | import Head from "next/head"; 3 | import Link from "next/link"; 4 | import { signIn, signOut, useSession } from "next-auth/react"; 5 | 6 | import { api } from "@/utils/api"; 7 | 8 | const Home: NextPage = () => { 9 | const hello = api.example.hello.useQuery({ text: "from tRPC" }); 10 | const example = api.example.getExample.useQuery(); 11 | 12 | console.log("example:", example.data); 13 | return ( 14 | <> 15 | 16 | Create T3 App 17 | 18 | 19 | 20 | 21 |
22 |
23 |

24 | Create T3 App 25 |

26 |
27 | 32 |

First Steps →

33 |
34 | Just the basics - Everything you need to know to set up your 35 | database and authentication. 36 |
37 | 38 | 43 |

Documentation →

44 |
45 | Learn more about Create T3 App, the libraries it uses, and how 46 | to deploy it. 47 |
48 | 49 |
50 |
51 |

52 | {hello.data ? hello.data.greeting : "Loading tRPC query..."} 53 |

54 | 55 |
56 |
57 |
58 | 59 | ); 60 | }; 61 | 62 | export default Home; 63 | 64 | const AuthShowcase: React.FC = () => { 65 | const { data: sessionData } = useSession(); 66 | 67 | const { data: secretMessage } = api.example.getSecretMessage.useQuery( 68 | undefined, // no input 69 | { enabled: sessionData?.user !== undefined } 70 | ); 71 | 72 | return ( 73 |
74 |

75 | {sessionData && Logged in as {sessionData.user?.name}} 76 | {secretMessage && - {secretMessage}} 77 |

78 | 84 |
85 | ); 86 | }; 87 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/server/adapters/drizzleAdapter.ts: -------------------------------------------------------------------------------- 1 | import type { Adapter } from "next-auth/adapters" 2 | import { and, eq } from "drizzle-orm" 3 | import { type MySql2Database } from "drizzle-orm/mysql2" 4 | import { init } from "@paralleldrive/cuid2" 5 | import { 6 | accounts, 7 | sessions, 8 | users, 9 | verificationTokens, 10 | } from "@retconned/drizzle/schemas" 11 | 12 | const createId = init({ 13 | length: 24, 14 | }) 15 | 16 | export function DrizzleAdapter(db: MySql2Database): Adapter { 17 | return { 18 | async createUser(userData) { 19 | await db.insert(users).values({ 20 | id: "c" + createId(), 21 | email: userData.email, 22 | emailVerified: userData.emailVerified, 23 | name: userData.name, 24 | image: userData.image, 25 | }) 26 | const rows = await db 27 | .select() 28 | .from(users) 29 | .where(eq(users.email, userData.email)) 30 | .limit(1) 31 | const row = rows[0] 32 | if (!row) throw new Error("User not found") 33 | return row 34 | }, 35 | async getUser(id) { 36 | const rows = await db 37 | .select() 38 | .from(users) 39 | .where(eq(users.id, id)) 40 | .limit(1) 41 | const row = rows[0] 42 | return row ?? null 43 | }, 44 | async getUserByEmail(email) { 45 | const rows = await db 46 | .select() 47 | .from(users) 48 | .where(eq(users.email, email)) 49 | .limit(1) 50 | const row = rows[0] 51 | return row ?? null 52 | }, 53 | async getUserByAccount({ providerAccountId, provider }) { 54 | const rows = await db 55 | .select() 56 | .from(users) 57 | .innerJoin(accounts, eq(users.id, accounts.userId)) 58 | .where( 59 | and( 60 | eq(accounts.providerAccountId, providerAccountId), 61 | eq(accounts.provider, provider), 62 | ), 63 | ) 64 | .limit(1) 65 | const row = rows[0] 66 | return row?.users ?? null 67 | }, 68 | async updateUser({ id, ...userData }) { 69 | if (!id) throw new Error("User not found") 70 | await db.update(users).set(userData).where(eq(users.id, id)) 71 | const rows = await db 72 | .select() 73 | .from(users) 74 | .where(eq(users.id, id)) 75 | .limit(1) 76 | const row = rows[0] 77 | if (!row) throw new Error("User not found") 78 | return row 79 | }, 80 | async deleteUser(userId) { 81 | await db.delete(users).where(eq(users.id, userId)) 82 | }, 83 | async linkAccount(account) { 84 | await db.insert(accounts).values({ 85 | id: "c" + createId(), 86 | provider: account.provider, 87 | providerAccountId: account.providerAccountId, 88 | type: account.type, 89 | userId: account.userId, 90 | // OpenIDTokenEndpointResponse properties 91 | access_token: account.access_token, 92 | expires_in: account.expires_in as number, 93 | id_token: account.id_token, 94 | refresh_token: account.refresh_token, 95 | refresh_token_expires_in: account.refresh_token_expires_in as number, // TODO: why doesn't the account type have this property? 96 | scope: account.scope, 97 | token_type: account.token_type, 98 | }) 99 | }, 100 | async unlinkAccount({ providerAccountId, provider }) { 101 | await db 102 | .delete(accounts) 103 | .where( 104 | and( 105 | eq(accounts.providerAccountId, providerAccountId), 106 | eq(accounts.provider, provider), 107 | ), 108 | ) 109 | }, 110 | async createSession(data) { 111 | await db.insert(sessions).values({ 112 | id: "c" + createId(), 113 | expires: data.expires, 114 | sessionToken: data.sessionToken, 115 | userId: data.userId, 116 | }) 117 | const rows = await db 118 | .select() 119 | .from(sessions) 120 | .where(eq(sessions.sessionToken, data.sessionToken)) 121 | .limit(1) 122 | const row = rows[0] 123 | if (!row) throw new Error("User not found") 124 | return row 125 | }, 126 | async getSessionAndUser(sessionToken) { 127 | const rows = await db 128 | .select({ 129 | user: users, 130 | session: { 131 | id: sessions.id, 132 | userId: sessions.userId, 133 | sessionToken: sessions.sessionToken, 134 | expires: sessions.expires, 135 | }, 136 | }) 137 | .from(sessions) 138 | .innerJoin(users, eq(users.id, sessions.userId)) 139 | .where(eq(sessions.sessionToken, sessionToken)) 140 | .limit(1) 141 | const row = rows[0] 142 | if (!row) return null 143 | const { user, session } = row 144 | return { 145 | user, 146 | session: { 147 | id: session.id, 148 | userId: session.userId, 149 | sessionToken: session.sessionToken, 150 | expires: session.expires, 151 | }, 152 | } 153 | }, 154 | async updateSession(session) { 155 | await db 156 | .update(sessions) 157 | .set(session) 158 | .where(eq(sessions.sessionToken, session.sessionToken)) 159 | const rows = await db 160 | .select() 161 | .from(sessions) 162 | .where(eq(sessions.sessionToken, session.sessionToken)) 163 | .limit(1) 164 | const row = rows[0] 165 | if (!row) throw new Error("Coding bug: updated session not found") 166 | return row 167 | }, 168 | async deleteSession(sessionToken) { 169 | await db.delete(sessions).where(eq(sessions.sessionToken, sessionToken)) 170 | }, 171 | async createVerificationToken(verificationToken) { 172 | await db.insert(verificationTokens).values({ 173 | expires: verificationToken.expires, 174 | identifier: verificationToken.identifier, 175 | token: verificationToken.token, 176 | }) 177 | const rows = await db 178 | .select() 179 | .from(verificationTokens) 180 | .where(eq(verificationTokens.token, verificationToken.token)) 181 | .limit(1) 182 | const row = rows[0] 183 | if (!row) 184 | throw new Error("Coding bug: inserted verification token not found") 185 | return row 186 | }, 187 | async useVerificationToken({ identifier, token }) { 188 | // First get the token while it still exists. TODO: need to add identifier to where clause? 189 | const rows = await db 190 | .select() 191 | .from(verificationTokens) 192 | .where(eq(verificationTokens.token, token)) 193 | .limit(1) 194 | const row = rows[0] 195 | if (!row) return null 196 | // Then delete it. 197 | await db 198 | .delete(verificationTokens) 199 | .where( 200 | and( 201 | eq(verificationTokens.token, token), 202 | eq(verificationTokens.identifier, identifier), 203 | ), 204 | ) 205 | // Then return it. 206 | return row 207 | }, 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/server/api/root.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCRouter } from "@/server/api/trpc"; 2 | import { exampleRouter } from "@/server/api/routers/example"; 3 | 4 | /** 5 | * This is the primary router for your server. 6 | * 7 | * All routers added in /api/routers should be manually added here. 8 | */ 9 | export const appRouter = createTRPCRouter({ 10 | example: exampleRouter, 11 | }); 12 | 13 | // export type definition of API 14 | export type AppRouter = typeof appRouter; 15 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/server/api/routers/example.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod" 2 | 3 | import { 4 | createTRPCRouter, 5 | publicProcedure, 6 | protectedProcedure, 7 | } from "@/server/api/trpc" 8 | 9 | import { example } from "@retconned/drizzle/schemas" 10 | 11 | export const exampleRouter = createTRPCRouter({ 12 | hello: publicProcedure 13 | .input(z.object({ text: z.string() })) 14 | .query(({ input }) => { 15 | return { 16 | greeting: `Hello ${input.text}`, 17 | } 18 | }), 19 | 20 | getExample: publicProcedure.query(({ ctx }) => { 21 | return ctx.db.select().from(example) 22 | }), 23 | 24 | getSecretMessage: protectedProcedure.query(() => { 25 | return "you can now see this secret message!" 26 | }), 27 | }) 28 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/server/api/trpc.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * YOU PROBABLY DON'T NEED TO EDIT THIS FILE, UNLESS: 3 | * 1. You want to modify request context (see Part 1). 4 | * 2. You want to create a new middleware or type of procedure (see Part 3). 5 | * 6 | * TL;DR - This is where all the tRPC server stuff is created and plugged in. The pieces you will 7 | * need to use are documented accordingly near the end. 8 | */ 9 | 10 | /** 11 | * 1. CONTEXT 12 | * 13 | * This section defines the "contexts" that are available in the backend API. 14 | * 15 | * These allow you to access things when processing a request, like the database, the session, etc. 16 | */ 17 | import { type CreateNextContextOptions } from "@trpc/server/adapters/next"; 18 | import { type Session } from "next-auth"; 19 | 20 | import { getServerAuthSession } from "@/server/auth"; 21 | import { db } from "@retconned/drizzle"; 22 | 23 | 24 | type CreateContextOptions = { 25 | session: Session | null; 26 | }; 27 | 28 | /** 29 | * This helper generates the "internals" for a tRPC context. If you need to use it, you can export 30 | * it from here. 31 | * 32 | * Examples of things you may need it for: 33 | * - testing, so we don't have to mock Next.js' req/res 34 | * - tRPC's `createSSGHelpers`, where we don't have req/res 35 | * 36 | * @see https://create.t3.gg/en/usage/trpc#-serverapitrpcts 37 | */ 38 | const createInnerTRPCContext = (opts: CreateContextOptions) => { 39 | return { 40 | session: opts.session, 41 | db, 42 | }; 43 | }; 44 | 45 | /** 46 | * This is the actual context you will use in your router. It will be used to process every request 47 | * that goes through your tRPC endpoint. 48 | * 49 | * @see https://trpc.io/docs/context 50 | */ 51 | export const createTRPCContext = async (opts: CreateNextContextOptions) => { 52 | const { req, res } = opts; 53 | 54 | // Get the session from the server using the getServerSession wrapper function 55 | const session = await getServerAuthSession({ req, res }); 56 | 57 | return createInnerTRPCContext({ 58 | session, 59 | }); 60 | }; 61 | 62 | /** 63 | * 2. INITIALIZATION 64 | * 65 | * This is where the tRPC API is initialized, connecting the context and transformer. We also parse 66 | * ZodErrors so that you get typesafety on the frontend if your procedure fails due to validation 67 | * errors on the backend. 68 | */ 69 | import { initTRPC, TRPCError } from "@trpc/server"; 70 | import superjson from "superjson"; 71 | import { ZodError } from "zod"; 72 | 73 | const t = initTRPC.context().create({ 74 | transformer: superjson, 75 | errorFormatter({ shape, error }) { 76 | return { 77 | ...shape, 78 | data: { 79 | ...shape.data, 80 | zodError: 81 | error.cause instanceof ZodError ? error.cause.flatten() : null, 82 | }, 83 | }; 84 | }, 85 | }); 86 | 87 | /** 88 | * 3. ROUTER & PROCEDURE (THE IMPORTANT BIT) 89 | * 90 | * These are the pieces you use to build your tRPC API. You should import these a lot in the 91 | * "/src/server/api/routers" directory. 92 | */ 93 | 94 | /** 95 | * This is how you create new routers and sub-routers in your tRPC API. 96 | * 97 | * @see https://trpc.io/docs/router 98 | */ 99 | export const createTRPCRouter = t.router; 100 | 101 | /** 102 | * Public (unauthenticated) procedure 103 | * 104 | * This is the base piece you use to build new queries and mutations on your tRPC API. It does not 105 | * guarantee that a user querying is authorized, but you can still access user session data if they 106 | * are logged in. 107 | */ 108 | export const publicProcedure = t.procedure; 109 | 110 | /** Reusable middleware that enforces users are logged in before running the procedure. */ 111 | const enforceUserIsAuthed = t.middleware(({ ctx, next }) => { 112 | if (!ctx.session || !ctx.session.user) { 113 | throw new TRPCError({ code: "UNAUTHORIZED" }); 114 | } 115 | return next({ 116 | ctx: { 117 | // infers the `session` as non-nullable 118 | session: { ...ctx.session, user: ctx.session.user }, 119 | }, 120 | }); 121 | }); 122 | 123 | /** 124 | * Protected (authenticated) procedure 125 | * 126 | * If you want a query or mutation to ONLY be accessible to logged in users, use this. It verifies 127 | * the session is valid and guarantees `ctx.session.user` is not null. 128 | * 129 | * @see https://trpc.io/docs/procedures 130 | */ 131 | export const protectedProcedure = t.procedure.use(enforceUserIsAuthed); 132 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/server/auth.ts: -------------------------------------------------------------------------------- 1 | import { type GetServerSidePropsContext } from "next"; 2 | import { 3 | getServerSession, 4 | type NextAuthOptions, 5 | type DefaultSession, 6 | } from "next-auth"; 7 | import DiscordProvider from "next-auth/providers/discord"; 8 | import { env } from "@/env.mjs"; 9 | import { db } from "@retconned/drizzle"; 10 | import { DrizzleAdapter } from "./adapters/drizzleAdapter"; 11 | 12 | /** 13 | * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session` 14 | * object and keep type safety. 15 | * 16 | * @see https://next-auth.js.org/getting-started/typescript#module-augmentation 17 | */ 18 | declare module "next-auth" { 19 | interface Session extends DefaultSession { 20 | user: { 21 | id: string; 22 | // ...other properties 23 | // role: UserRole; 24 | } & DefaultSession["user"]; 25 | } 26 | 27 | // interface User { 28 | // // ...other properties 29 | // // role: UserRole; 30 | // } 31 | } 32 | 33 | /** 34 | * Options for NextAuth.js used to configure adapters, providers, callbacks, etc. 35 | * 36 | * @see https://next-auth.js.org/configuration/options 37 | */ 38 | export const authOptions: NextAuthOptions = { 39 | callbacks: { 40 | session: ({ session, user }) => ({ 41 | ...session, 42 | user: { 43 | ...session.user, 44 | id: user.id, 45 | }, 46 | }), 47 | }, 48 | adapter: DrizzleAdapter(db), 49 | theme: { colorScheme: "dark" }, 50 | providers: [ 51 | DiscordProvider({ 52 | clientId: env.DISCORD_CLIENT_ID, 53 | clientSecret: env.DISCORD_CLIENT_SECRET, 54 | }), 55 | /** 56 | * ...add more providers here. 57 | * 58 | * Most other providers require a bit more work than the Discord provider. For example, the 59 | * GitHub provider requires you to add the `refresh_token_expires_in` field to the Account 60 | * model. Refer to the NextAuth.js docs for the provider you want to use. Example: 61 | * 62 | * @see https://next-auth.js.org/providers/github 63 | */ 64 | ], 65 | }; 66 | 67 | /** 68 | * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. 69 | * 70 | * @see https://next-auth.js.org/configuration/nextjs 71 | */ 72 | export const getServerAuthSession = (ctx: { 73 | req: GetServerSidePropsContext["req"]; 74 | res: GetServerSidePropsContext["res"]; 75 | }) => { 76 | return getServerSession(ctx.req, ctx.res, authOptions); 77 | }; 78 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/src/utils/api.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the client-side entrypoint for your tRPC API. It is used to create the `api` object which 3 | * contains the Next.js App-wrapper, as well as your type-safe React Query hooks. 4 | * 5 | * We also create a few inference helpers for input and output types. 6 | */ 7 | import { httpBatchLink, loggerLink } from "@trpc/client"; 8 | import { createTRPCNext } from "@trpc/next"; 9 | import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server"; 10 | import superjson from "superjson"; 11 | 12 | import { type AppRouter } from "@/server/api/root"; 13 | 14 | const getBaseUrl = () => { 15 | if (typeof window !== "undefined") return ""; // browser should use relative url 16 | if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url 17 | return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost 18 | }; 19 | 20 | /** A set of type-safe react-query hooks for your tRPC API. */ 21 | export const api = createTRPCNext({ 22 | config() { 23 | return { 24 | /** 25 | * Transformer used for data de-serialization from the server. 26 | * 27 | * @see https://trpc.io/docs/data-transformers 28 | */ 29 | transformer: superjson, 30 | 31 | /** 32 | * Links used to determine request flow from client to server. 33 | * 34 | * @see https://trpc.io/docs/links 35 | */ 36 | links: [ 37 | loggerLink({ 38 | enabled: (opts) => 39 | process.env.NODE_ENV === "development" || 40 | (opts.direction === "down" && opts.result instanceof Error), 41 | }), 42 | httpBatchLink({ 43 | url: `${getBaseUrl()}/api/trpc`, 44 | }), 45 | ], 46 | }; 47 | }, 48 | /** 49 | * Whether tRPC should await queries when server rendering pages. 50 | * 51 | * @see https://trpc.io/docs/nextjs#ssr-boolean-default-false 52 | */ 53 | ssr: false, 54 | }); 55 | 56 | /** 57 | * Inference helper for inputs. 58 | * 59 | * @example type HelloInput = RouterInputs['example']['hello'] 60 | */ 61 | export type RouterInputs = inferRouterInputs; 62 | 63 | /** 64 | * Inference helper for outputs. 65 | * 66 | * @example type HelloOutput = RouterOutputs['example']['hello'] 67 | */ 68 | export type RouterOutputs = inferRouterOutputs; 69 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import { type Config } from "tailwindcss"; 2 | 3 | export default { 4 | content: ["./src/**/*.{js,ts,jsx,tsx}"], 5 | theme: { 6 | extend: {}, 7 | }, 8 | plugins: [], 9 | } satisfies Config; 10 | -------------------------------------------------------------------------------- /apps/my-t3-drizzle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/nextjs.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": ["./src/*"] 7 | } 8 | }, 9 | "include": [ 10 | ".eslintrc.cjs", 11 | "next-env.d.ts", 12 | "**/*.ts", 13 | "**/*.tsx", 14 | "**/*.cjs", 15 | "**/*.mjs" 16 | ], 17 | "exclude": ["node_modules"] 18 | } 19 | -------------------------------------------------------------------------------- /apps/web/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: ["@retconned/eslint-config-custom"], 4 | } 5 | -------------------------------------------------------------------------------- /apps/web/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | ``` 14 | 15 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 16 | 17 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 18 | 19 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. 20 | 21 | ## Learn More 22 | 23 | To learn more about Next.js, take a look at the following resources: 24 | 25 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 26 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 27 | 28 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 29 | 30 | ## Deploy on Vercel 31 | 32 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 33 | 34 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 35 | -------------------------------------------------------------------------------- /apps/web/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /apps/web/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | transpilePackages: ["@retconned/ui"], 4 | experimental: { 5 | serverActions: true, 6 | }, 7 | } 8 | 9 | module.exports = nextConfig 10 | -------------------------------------------------------------------------------- /apps/web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev --port 3002", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint", 10 | "clean": "rm -rf .next && rm -rf node_modules && rm -rf .turbo" 11 | }, 12 | "dependencies": { 13 | "@retconned/ui": "workspace:*", 14 | "@retconned/utils": "workspace:*", 15 | "@types/node": "20.1.0", 16 | "@types/react": "18.2.5", 17 | "@types/react-dom": "18.2.4", 18 | "autoprefixer": "10.4.14", 19 | "eslint": "8.40.0", 20 | "eslint-config-next": "13.4.1", 21 | "next": "13.4.1", 22 | "postcss": "8.4.23", 23 | "react": "18.2.0", 24 | "react-dom": "18.2.0", 25 | "tailwindcss": "3.3.2", 26 | "typescript": "5.0.4" 27 | }, 28 | "devDependencies": { 29 | "@retconned/config": "workspace:*", 30 | "@retconned/eslint-config-custom": "workspace:*", 31 | "@retconned/tsconfig": "workspace:*", 32 | "@retconned/prisma-orm": "workspace:*" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apps/web/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/postcss.config') 2 | -------------------------------------------------------------------------------- /apps/web/prettier.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require("@retconned/config/prettier.config"); 2 | -------------------------------------------------------------------------------- /apps/web/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /apps/web/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /apps/web/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retconned/pnpm-turborepo-boilerplate/73583b423a386d164a88de711ed5d5136a10dbae/apps/web/src/app/favicon.ico -------------------------------------------------------------------------------- /apps/web/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --foreground-rgb: 0, 0, 0; 7 | --background-start-rgb: 214, 219, 220; 8 | --background-end-rgb: 255, 255, 255; 9 | } 10 | 11 | @media (prefers-color-scheme: dark) { 12 | :root { 13 | --foreground-rgb: 255, 255, 255; 14 | --background-start-rgb: 0, 0, 0; 15 | --background-end-rgb: 0, 0, 0; 16 | } 17 | } 18 | 19 | body { 20 | color: rgb(var(--foreground-rgb)); 21 | background: linear-gradient( 22 | to bottom, 23 | transparent, 24 | rgb(var(--background-end-rgb)) 25 | ) 26 | rgb(var(--background-start-rgb)); 27 | } 28 | -------------------------------------------------------------------------------- /apps/web/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import { Inter } from 'next/font/google' 3 | 4 | const inter = Inter({ subsets: ['latin'] }) 5 | 6 | export const metadata = { 7 | title: 'Create Next App', 8 | description: 'Generated by create next app', 9 | } 10 | 11 | export default function RootLayout({ 12 | children, 13 | }: { 14 | children: React.ReactNode 15 | }) { 16 | return ( 17 | 18 | {children} 19 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from "@retconned/ui" 2 | import Image from "next/image" 3 | 4 | export default function Home() { 5 | return ( 6 |
7 |
8 |

9 | Get started by editing  10 | src/app/page.tsx 11 |

12 | 29 |
30 | 31 |
32 | Next.js Logo 40 |
41 | 44 | 109 |
110 | ) 111 | } 112 | -------------------------------------------------------------------------------- /apps/web/tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/tailwind.config') 2 | -------------------------------------------------------------------------------- /apps/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/nextjs.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": ["./src/*"], 7 | "@/images/*": ["./public/images/*"], 8 | "@/styles/*": ["./styles/*"] 9 | }, 10 | "plugins": [ 11 | { 12 | "name": "next" 13 | } 14 | ] 15 | }, 16 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 17 | "exclude": ["node_modules"] 18 | } 19 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/commitlint.config') 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "turborepo-base", 3 | "version": "0.1.1", 4 | "private": true, 5 | "author": "retconned ", 6 | "workspaces": [ 7 | "apps/*", 8 | "packages/*" 9 | ], 10 | "scripts": { 11 | "build": "pnpm with-env turbo run build --cache-dir=\"./.turbo_cache\"", 12 | "dev": "pnpm with-env turbo run dev --parallel", 13 | "lint": "turbo run lint", 14 | "test": "turbo run test", 15 | "deploy": "turbo run deploy", 16 | "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", 17 | "clean": "turbo run clean && rm -rf node_modules", 18 | "lint:staged": "lint-staged", 19 | "prisma:generate": "pnpm with-env --filter @retconned/prisma-orm db:generate", 20 | "prisma:push": "pnpm with-env turbo db:generate db:push", 21 | "drizzle:push": "pnpm with-env turbo --filter @retconned/drizzle db:push", 22 | "check:prettier:staged": "pretty-quick --staged", 23 | "check:commit:msg:staged": "commitlint --edit \"$1\"", 24 | "with-env": "dotenv -e .env --" 25 | }, 26 | "devDependencies": { 27 | "@commitlint/cli": "^17.4.2", 28 | "@retconned/config": "workspace:*", 29 | "@retconned/eslint-config-custom": "workspace:*", 30 | "@types/node": "^17.0.12", 31 | "dotenv-cli": "^7.1.0", 32 | "husky": "^8.0.3", 33 | "lint-staged": "^13.1.0", 34 | "pretty-quick": "^3.1.3", 35 | "turbo": "^1.9.3" 36 | }, 37 | "engines": { 38 | "node": ">=18.14.0" 39 | }, 40 | "packageManager": "pnpm@7.28.0" 41 | } 42 | -------------------------------------------------------------------------------- /packages/config/commitlint.config.js: -------------------------------------------------------------------------------- 1 | // build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) 2 | // ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) 3 | // docs: Documentation only changes 4 | // feat: A new feature 5 | // fix: A bug fix 6 | // perf: A code change that improves performance 7 | // refactor: A code change that neither fixes a bug nor adds a feature 8 | // style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) 9 | // test: Adding missing tests or correcting existing tests 10 | // typo: typo fixes 11 | // temp: temporary code push (not recommneded only use in dire situations) 12 | 13 | module.exports = { 14 | extends: ["@commitlint/config-conventional"], 15 | rules: { 16 | "body-leading-blank": [1, "always"], 17 | "body-max-line-length": [2, "always", 100], 18 | "footer-leading-blank": [1, "always"], 19 | "footer-max-line-length": [2, "always", 100], 20 | "header-max-length": [2, "always", 100], 21 | "scope-case": [2, "always", "lower-case"], 22 | "subject-case": [ 23 | 2, 24 | "never", 25 | ["sentence-case", "start-case", "pascal-case", "upper-case"], 26 | ], 27 | "subject-empty": [2, "never"], 28 | "subject-full-stop": [2, "never", "."], 29 | "type-case": [2, "always", "lower-case"], 30 | "type-empty": [2, "never"], 31 | "type-enum": [ 32 | 2, 33 | "always", 34 | [ 35 | "build", 36 | "chore", 37 | "ci", 38 | "docs", 39 | "feat", 40 | "fix", 41 | "perf", 42 | "refactor", 43 | "revert", 44 | "style", 45 | "test", 46 | "translation", 47 | "security", 48 | "changeset", 49 | "typo", 50 | "temp", 51 | ], 52 | ], 53 | }, 54 | } 55 | -------------------------------------------------------------------------------- /packages/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/config", 3 | "version": "0.0.0", 4 | "author": "retconned ", 5 | "keywords": [ 6 | "config", 7 | "configuration" 8 | ], 9 | "main": "index.js", 10 | "private": true, 11 | "files": [ 12 | "postcss.config.js", 13 | "tailwind.config.js", 14 | "prettier.config.js", 15 | "commitlint.config.js" 16 | ], 17 | "devDependencies": { 18 | "@commitlint/config-conventional": "^17.4.2", 19 | "prettier": "^2.8.3", 20 | "prettier-plugin-tailwindcss": "^0.2.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/config/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/config/prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | semi: false, 3 | tabWidth: 2, 4 | bracketSpacing: true, 5 | bracketSameLine: true, 6 | arrowParens: "always", 7 | trailingComma: "all", 8 | jsxSingleQuote: true, 9 | pluginSearchDirs: false, 10 | plugins: [require("prettier-plugin-tailwindcss")], 11 | } 12 | -------------------------------------------------------------------------------- /packages/config/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | ...require("../ui/tailwind.config"), 4 | darkMode: ["class", '[data-theme="dark"]'], 5 | content: [ 6 | // './app/**/*.{js,ts,jsx,tsx}', 7 | // './pages/**/*.{js,ts,jsx,tsx}', 8 | // './components/**/*.{js,ts,jsx,tsx}', 9 | //* library transpiliation route *// 10 | "../../packages/ui/src/**/*.{js,ts,jsx,tsx}", 11 | //* if you aren't opt in for src folder structure in your projects, comment the following line & uncomment/add the paths as required *// 12 | "./src/**/*.{js,ts,jsx,tsx,mdx}", 13 | ], 14 | theme: { 15 | extend: { 16 | keyframes: { 17 | "accordion-down": { 18 | from: { height: 0 }, 19 | to: { height: "var(--radix-accordion-content-height)" }, 20 | }, 21 | "accordion-up": { 22 | from: { height: "var(--radix-accordion-content-height)" }, 23 | to: { height: 0 }, 24 | }, 25 | }, 26 | animation: { 27 | "accordion-down": "accordion-down 0.2s ease-out", 28 | "accordion-up": "accordion-up 0.2s ease-out", 29 | }, 30 | }, 31 | }, 32 | plugins: [], 33 | } 34 | -------------------------------------------------------------------------------- /packages/drizzle/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const path = require("path") 3 | 4 | /** @type {import("eslint").Linter.Config} */ 5 | const config = { 6 | overrides: [ 7 | { 8 | extends: [ 9 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 10 | ], 11 | files: ["*.ts", "*.tsx"], 12 | parserOptions: { 13 | project: path.join(__dirname, "tsconfig.json"), 14 | }, 15 | }, 16 | ], 17 | parser: "@typescript-eslint/parser", 18 | parserOptions: { 19 | project: path.join(__dirname, "tsconfig.json"), 20 | }, 21 | plugins: ["@typescript-eslint"], 22 | extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], 23 | rules: { 24 | "@typescript-eslint/consistent-type-imports": [ 25 | "warn", 26 | { 27 | prefer: "type-imports", 28 | fixStyle: "inline-type-imports", 29 | }, 30 | ], 31 | "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], 32 | }, 33 | } 34 | 35 | module.exports = config 36 | -------------------------------------------------------------------------------- /packages/drizzle/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | // drizzle.config.ts 2 | import type { Config } from "drizzle-kit" 3 | import "dotenv/config" 4 | 5 | export default { 6 | host: process.env.DB_HOST, 7 | user: process.env.DB_USERNAME, 8 | password: process.env.DB_PASSWORD, 9 | database: process.env.DB_NAME, 10 | schema: ["./schemas/auth.ts", "./schemas/schema.ts"], 11 | } satisfies Config 12 | -------------------------------------------------------------------------------- /packages/drizzle/index.ts: -------------------------------------------------------------------------------- 1 | import { config } from "dotenv" 2 | import { drizzle } from "drizzle-orm/mysql2" 3 | import mysql, { type Pool } from "mysql2/promise" 4 | 5 | const globalForMySQL = globalThis as unknown as { poolConnection: Pool } 6 | 7 | const poolConnection = 8 | globalForMySQL.poolConnection || 9 | mysql.createPool({ 10 | host: process.env.DB_HOST, 11 | user: process.env.DB_USERNAME, 12 | password: process.env.DB_PASSWORD, 13 | database: process.env.DB_NAME, 14 | }) 15 | 16 | if (process.env.NODE_ENV !== "production") 17 | globalForMySQL.poolConnection = poolConnection 18 | 19 | export const db = drizzle(poolConnection) 20 | -------------------------------------------------------------------------------- /packages/drizzle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/drizzle", 3 | "main": "./index.ts", 4 | "types": "./index.ts", 5 | "author": "retconned ", 6 | "version": "0.0.0", 7 | "private": true, 8 | "dependencies": { 9 | "mysql2": "^2.3.3" 10 | }, 11 | "scripts": { 12 | "db:push": "drizzle-kit push:mysql" 13 | }, 14 | "devDependencies": { 15 | "@types/node": "^18.15.5", 16 | "dotenv": "^16.0.3", 17 | "drizzle-kit": "0.17.6-76e73f3", 18 | "drizzle-orm": "0.25.4", 19 | "@retconned/config": "workspace:*", 20 | "@retconned/eslint-config-custom": "workspace:*", 21 | "@retconned/tsconfig": "workspace:*", 22 | "typescript": "^5.0.2" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/drizzle/prettier.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = require("@retconned/config/prettier.config") 2 | -------------------------------------------------------------------------------- /packages/drizzle/schemas/auth.ts: -------------------------------------------------------------------------------- 1 | import { 2 | datetime, 3 | index, 4 | int, 5 | mysqlTable, 6 | text, 7 | timestamp, 8 | uniqueIndex, 9 | varchar, 10 | } from "drizzle-orm/mysql-core" 11 | 12 | export const accounts = mysqlTable( 13 | "accounts", 14 | { 15 | id: varchar("id", { length: 191 }).primaryKey().notNull(), 16 | userId: varchar("userId", { length: 191 }).notNull(), 17 | type: varchar("type", { length: 191 }).notNull(), 18 | provider: varchar("provider", { length: 191 }).notNull(), 19 | providerAccountId: varchar("providerAccountId", { length: 191 }).notNull(), 20 | access_token: text("access_token"), 21 | expires_in: int("expires_in"), 22 | id_token: text("id_token"), 23 | refresh_token: text("refresh_token"), 24 | refresh_token_expires_in: int("refresh_token_expires_in"), 25 | scope: varchar("scope", { length: 191 }), 26 | token_type: varchar("token_type", { length: 191 }), 27 | createdAt: timestamp("createdAt").defaultNow().onUpdateNow().notNull(), 28 | updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(), 29 | }, 30 | (account) => ({ 31 | providerProviderAccountIdIndex: uniqueIndex( 32 | "accounts__provider__providerAccountId__idx", 33 | ).on(account.provider, account.providerAccountId), 34 | userIdIndex: index("accounts__userId__idx").on(account.userId), 35 | }), 36 | ) 37 | 38 | export const sessions = mysqlTable( 39 | "sessions", 40 | { 41 | id: varchar("id", { length: 191 }).primaryKey().notNull(), 42 | sessionToken: varchar("sessionToken", { length: 191 }).notNull(), 43 | userId: varchar("userId", { length: 191 }).notNull(), 44 | expires: datetime("expires").notNull(), 45 | created_at: timestamp("created_at").notNull().defaultNow().onUpdateNow(), 46 | updated_at: timestamp("updated_at").notNull().defaultNow().onUpdateNow(), 47 | }, 48 | (session) => ({ 49 | sessionTokenIndex: uniqueIndex("sessions__sessionToken__idx").on( 50 | session.sessionToken, 51 | ), 52 | userIdIndex: index("sessions__userId__idx").on(session.userId), 53 | }), 54 | ) 55 | 56 | export const users = mysqlTable( 57 | "users", 58 | { 59 | id: varchar("id", { length: 191 }).primaryKey().notNull(), 60 | name: varchar("name", { length: 191 }), 61 | email: varchar("email", { length: 191 }).notNull(), 62 | emailVerified: timestamp("emailVerified"), 63 | image: varchar("image", { length: 191 }), 64 | created_at: timestamp("created_at").notNull().defaultNow().onUpdateNow(), 65 | updated_at: timestamp("updated_at").notNull().defaultNow().onUpdateNow(), 66 | }, 67 | (user) => ({ 68 | emailIndex: uniqueIndex("users__email__idx").on(user.email), 69 | }), 70 | ) 71 | 72 | export const verificationTokens = mysqlTable( 73 | "verification_tokens", 74 | { 75 | identifier: varchar("identifier", { length: 191 }).primaryKey().notNull(), 76 | token: varchar("token", { length: 191 }).notNull(), 77 | expires: datetime("expires").notNull(), 78 | created_at: timestamp("created_at").notNull().defaultNow().onUpdateNow(), 79 | updated_at: timestamp("updated_at").notNull().defaultNow().onUpdateNow(), 80 | }, 81 | (verificationToken) => ({ 82 | tokenIndex: uniqueIndex("verification_tokens__token__idx").on( 83 | verificationToken.token, 84 | ), 85 | }), 86 | ) 87 | 88 | export const posts = mysqlTable( 89 | "posts", 90 | { 91 | id: varchar("id", { length: 191 }).primaryKey().notNull(), 92 | user_id: varchar("user_id", { length: 191 }).notNull(), 93 | slug: varchar("slug", { length: 191 }).notNull(), 94 | title: text("title").notNull(), 95 | text: text("text").notNull(), 96 | created_at: timestamp("created_at").notNull().defaultNow().onUpdateNow(), 97 | updated_at: timestamp("updated_at").notNull().defaultNow().onUpdateNow(), 98 | }, 99 | (post) => ({ 100 | userIdIndex: uniqueIndex("posts__user_id__idx").on(post.user_id), 101 | }), 102 | ) 103 | -------------------------------------------------------------------------------- /packages/drizzle/schemas/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./auth" 2 | export * from "./schema" 3 | -------------------------------------------------------------------------------- /packages/drizzle/schemas/schema.ts: -------------------------------------------------------------------------------- 1 | import { mysqlTable, timestamp, varchar } from "drizzle-orm/mysql-core" 2 | import { text } from "drizzle-orm/mysql-core" 3 | import { int } from "drizzle-orm/mysql-core" 4 | 5 | export const example = mysqlTable("example", { 6 | id: varchar("id", { length: 191 }).primaryKey().notNull(), 7 | created_at: timestamp("created_at").notNull().defaultNow().onUpdateNow(), 8 | updated_at: timestamp("updated_at").notNull().defaultNow().onUpdateNow(), 9 | }) 10 | 11 | export const usersExample = mysqlTable("users", { 12 | id: int("id").autoincrement().primaryKey(), 13 | name: text("name").notNull(), 14 | age: int("age"), 15 | occupation: text("occupation"), 16 | }) 17 | -------------------------------------------------------------------------------- /packages/drizzle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/react-library.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/eslint-config-custom/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('eslint').Linter.Config} 3 | */ 4 | module.exports = { 5 | extends: ["next/core-web-vitals", "turbo", "prettier"], 6 | rules: { 7 | "@next/next/no-html-link-for-pages": "off", 8 | "react/jsx-key": "off", 9 | }, 10 | ignorePatterns: ["node_modules", "dist"], 11 | parserOptions: { 12 | babelOptions: { 13 | presets: [require.resolve("next/babel")], 14 | }, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /packages/eslint-config-custom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/eslint-config-custom", 3 | "version": "0.0.0", 4 | "description": "Eslint configurations shared between all apps adn packages", 5 | "author": "retconned ", 6 | "keywords": [ 7 | "eslint" 8 | ], 9 | "main": "index.js", 10 | "license": "MIT", 11 | "private": true, 12 | "dependencies": { 13 | "eslint-config-next": "13.0.0", 14 | "eslint-config-prettier": "^8.3.0", 15 | "eslint-plugin-react": "7.31.8", 16 | "eslint-config-turbo": "latest" 17 | }, 18 | "publishConfig": { 19 | "access": "public" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/prisma-orm/index.ts: -------------------------------------------------------------------------------- 1 | // import { PrismaClient } from "@prisma/client"; 2 | import { PrismaClient } from "@prisma/client" 3 | 4 | export * from "@prisma/client" 5 | 6 | const globalForPrisma = globalThis as unknown as { prisma: PrismaClient } 7 | 8 | export const prisma = 9 | globalForPrisma.prisma || 10 | new PrismaClient({ 11 | log: 12 | process.env.NODE_ENV === "development" 13 | ? ["query", "error", "warn"] 14 | : ["error"], 15 | }) 16 | 17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma 18 | -------------------------------------------------------------------------------- /packages/prisma-orm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/prisma-orm", 3 | "main": "./index.ts", 4 | "types": "./index.ts", 5 | "author": "retconned ", 6 | "version": "0.0.0", 7 | "private": true, 8 | "dependencies": { 9 | "@prisma/client": "4.11.0" 10 | }, 11 | "scripts": { 12 | "db:generate": "prisma generate", 13 | "db:push": "prisma db push --skip-generate" 14 | }, 15 | "devDependencies": { 16 | "prisma": "4.11.0", 17 | "@retconned/eslint-config-custom": "workspace:*", 18 | "@retconned/tsconfig": "workspace:*" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/prisma-orm/prisma/schema.prisma: -------------------------------------------------------------------------------- 1 | // This is your Prisma schema file, 2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema 3 | 4 | generator client { 5 | provider = "prisma-client-js" 6 | } 7 | 8 | datasource db { 9 | provider = "postgresql" 10 | url = env("DATABASE_URL") 11 | } 12 | 13 | model Example { 14 | id String @id @default(cuid()) 15 | createdAt DateTime @default(now()) 16 | updatedAt DateTime @updatedAt 17 | } 18 | 19 | // Necessary for Next auth 20 | model Account { 21 | id String @id @default(cuid()) 22 | userId String 23 | type String 24 | provider String 25 | providerAccountId String 26 | refresh_token String? // @db.Text 27 | access_token String? // @db.Text 28 | expires_at Int? 29 | token_type String? 30 | scope String? 31 | id_token String? // @db.Text 32 | session_state String? 33 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) 34 | 35 | @@unique([provider, providerAccountId]) 36 | } 37 | 38 | model Session { 39 | id String @id @default(cuid()) 40 | sessionToken String @unique 41 | userId String 42 | expires DateTime 43 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) 44 | } 45 | 46 | model User { 47 | id String @id @default(cuid()) 48 | name String? 49 | email String? @unique 50 | emailVerified DateTime? 51 | image String? 52 | accounts Account[] 53 | sessions Session[] 54 | } 55 | 56 | model VerificationToken { 57 | identifier String 58 | token String @unique 59 | expires DateTime 60 | 61 | @@unique([identifier, token]) 62 | } 63 | -------------------------------------------------------------------------------- /packages/prisma-orm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/react-library.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/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": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/tsconfig/nextjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Next.js", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "target": "es5", 7 | "lib": [ 8 | "dom", 9 | "dom.iterable", 10 | "esnext" 11 | ], 12 | "allowJs": true, 13 | "skipLibCheck": true, 14 | "strict": true, 15 | "forceConsistentCasingInFileNames": true, 16 | "noEmit": true, 17 | "incremental": true, 18 | "esModuleInterop": true, 19 | "module": "esnext", 20 | "resolveJsonModule": true, 21 | "isolatedModules": true, 22 | "jsx": "preserve", 23 | "plugins": [ 24 | { 25 | "name": "next" 26 | } 27 | ] 28 | }, 29 | "include": [ 30 | "src", 31 | "next-env.d.ts" 32 | ], 33 | "exclude": [ 34 | "node_modules" 35 | ] 36 | } -------------------------------------------------------------------------------- /packages/tsconfig/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/tsconfig", 3 | "version": "0.0.0", 4 | "description": "Typescript configurations shared between all workspaces", 5 | "author": "retconned ", 6 | "keywords": [ 7 | "config", 8 | "configuration" 9 | ], 10 | "main": "index.js", 11 | "license": "MIT", 12 | "private": true, 13 | "files": [ 14 | "base.json", 15 | "nextjs.json", 16 | "react-library.json" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /packages/tsconfig/react-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React Library", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "jsx": "react-jsx", 7 | "lib": ["DOM", "ES2015"], 8 | "module": "ESNext", 9 | "target": "es6" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/ui", 3 | "version": "0.0.0", 4 | "author": "retconned ", 5 | "main": "./src/index.tsx", 6 | "types": "./src/index.tsx", 7 | "scripts": { 8 | "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo", 9 | "lint": "TIMING=1 eslint *.ts*", 10 | "test": "echo no test required" 11 | }, 12 | "devDependencies": { 13 | "@retconned/config": "workspace:*", 14 | "@retconned/eslint-config-custom": "workspace:*", 15 | "@retconned/utils": "workspace:*", 16 | "@retconned/tsconfig": "workspace:*", 17 | "@tailwindcss/forms": "^0.5.3", 18 | "@types/react": "^18.0.27", 19 | "@types/react-dom": "^18.0.10", 20 | "class-variance-authority": "^0.6.0", 21 | "clsx": "^1.2.1", 22 | "eslint": "^7.32.0", 23 | "lucide-react": "^0.118.0", 24 | "react": "^18.2.0", 25 | "tailwindcss": "^3.2.4", 26 | "tailwindcss-animate": "^1.0.5", 27 | "typescript": "^4.9.4", 28 | "@radix-ui/react-accordion": "^1.1.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/ui/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/postcss.config') 2 | -------------------------------------------------------------------------------- /packages/ui/prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/prettier.config') 2 | -------------------------------------------------------------------------------- /packages/ui/src/components/accordion.tsx: -------------------------------------------------------------------------------- 1 | import * as AccordionPrimitive from "@radix-ui/react-accordion" 2 | import { ChevronDown } from "lucide-react" 3 | import * as React from "react" 4 | 5 | import { cn } from "@retconned/utils" 6 | 7 | const Accordion = AccordionPrimitive.Root 8 | 9 | const AccordionItem = React.forwardRef< 10 | React.ElementRef, 11 | React.ComponentPropsWithoutRef 12 | >(({ className, ...props }, ref) => ( 13 | 21 | )) 22 | AccordionItem.displayName = "AccordionItem" 23 | 24 | const AccordionTrigger = React.forwardRef< 25 | React.ElementRef, 26 | React.ComponentPropsWithoutRef 27 | >(({ className, children, ...props }, ref) => ( 28 | 29 | svg]:rotate-180", 33 | className, 34 | )} 35 | {...props}> 36 | {children} 37 | 38 | 39 | 40 | )) 41 | AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName 42 | 43 | const AccordionContent = React.forwardRef< 44 | React.ElementRef, 45 | React.ComponentPropsWithoutRef 46 | >(({ className, children, ...props }, ref) => ( 47 | 54 |
{children}
55 |
56 | )) 57 | AccordionContent.displayName = AccordionPrimitive.Content.displayName 58 | 59 | export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } 60 | -------------------------------------------------------------------------------- /packages/ui/src/components/button.tsx: -------------------------------------------------------------------------------- 1 | // button.tsx 2 | import { cva, type VariantProps } from "class-variance-authority" 3 | import React from "react" 4 | 5 | const button = cva( 6 | "select-none rounded-md px-2 py-2 text-center font-medium duration-150", 7 | { 8 | variants: { 9 | intent: { 10 | fill: "w-fit text-sm bg-blue-400 text-neutral-900 hover:bg-blue-500", 11 | outline: 12 | "w-fit border border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white", 13 | "solid-grey": 14 | "w-28 bg-neutral-800 border border-neutral-700 text-sm text-neutral-200 hover:bg-neutral-400/40", 15 | navigation: 16 | "flex items-center justify-start space-x-2 rounded-md px-3.5 py-2.5 hover:bg-neutral-700", 17 | transparent: "text-neutral-100 w-fit hover:text-neutral-200 ", 18 | }, 19 | }, 20 | compoundVariants: [{ intent: "fill", className: "uppercase" }], 21 | defaultVariants: { 22 | intent: "fill", 23 | }, 24 | }, 25 | ) 26 | 27 | interface ButtonProps 28 | extends React.ButtonHTMLAttributes, 29 | VariantProps { 30 | text: string 31 | } 32 | 33 | export const Button: React.FC = ({ 34 | className, 35 | intent, 36 | ...props 37 | }) => ( 38 | 41 | ) 42 | -------------------------------------------------------------------------------- /packages/ui/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accordion" 2 | export * from "./button" 3 | -------------------------------------------------------------------------------- /packages/ui/src/index.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | export * from "./components" 4 | export * from "./layout" 5 | -------------------------------------------------------------------------------- /packages/ui/src/layout/gradient.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react' 2 | 3 | interface GradientProps { 4 | fillColor?: string 5 | stopColor?: string 6 | stopColor2?: string 7 | rotateDegrees?: string 8 | position?: 'top' | 'bottom' 9 | childPosition?: string 10 | } 11 | 12 | const Gradient: FC = ({ 13 | fillColor = 'ee0717bf', 14 | stopColor = '4034ee', 15 | stopColor2 = '339c46', 16 | rotateDegrees = '30', 17 | position = 'top', 18 | childPosition = 'calc(100%-180rem)' 19 | }) => { 20 | const positionVariant = { 21 | top: 'top-[-10rem]', 22 | bottom: 'top-[calc(100%-14rem)]' 23 | // sm:left-[calc(50% - 30rem)] sm:h-[42.375rem] 24 | } 25 | 26 | const rotate = `rotate-[${rotateDegrees}deg]` 27 | 28 | return ( 29 | <> 30 |
32 | 36 | 41 | 42 | 49 | 50 | 51 | 52 | 53 | 54 |
55 | 56 | ) 57 | } 58 | 59 | export default Gradient 60 | -------------------------------------------------------------------------------- /packages/ui/src/layout/index.ts: -------------------------------------------------------------------------------- 1 | export * from './page-head' 2 | -------------------------------------------------------------------------------- /packages/ui/src/layout/page-head.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react' 2 | 3 | interface PageHeadProps { 4 | title: string 5 | description: string 6 | imagePathname?: string 7 | pathname?: string 8 | url?: string 9 | socialImageUrl?: string 10 | domain?: string 11 | twitter?: string 12 | isPWA?: boolean 13 | } 14 | 15 | export const PageHead: FC = ({ 16 | title, 17 | description, 18 | imagePathname, 19 | pathname, 20 | url, 21 | socialImageUrl, 22 | domain, 23 | twitter, 24 | isPWA = false 25 | }) => { 26 | const path_url = pathname ? `${url}${pathname}` : url 27 | const imageUrl = imagePathname ? `${url}${imagePathname}` : socialImageUrl 28 | 29 | return ( 30 | <> 31 | {title} 32 | 33 | 34 | 35 | {isPWA && } 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {description && ( 48 | <> 49 | 50 | 51 | 52 | 53 | )} 54 | 55 | {imageUrl ? ( 56 | <> 57 | 58 | 59 | 60 | 61 | ) : ( 62 | 63 | )} 64 | 65 | {path_url && ( 66 | <> 67 | 68 | 69 | 70 | 71 | )} 72 | 73 | 74 | 75 | 76 | ) 77 | } 78 | 79 | export default PageHead 80 | -------------------------------------------------------------------------------- /packages/ui/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: ['./src/**/*.{js,ts,jsx,tsx}'], 3 | theme: { 4 | extend: {} 5 | }, 6 | plugins: [] 7 | } 8 | -------------------------------------------------------------------------------- /packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/react-library.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": ["./*"] 7 | } 8 | }, 9 | "include": ["."], 10 | "exclude": ["dist", "build", "node_modules"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/utils/cn.ts: -------------------------------------------------------------------------------- 1 | import type { ClassValue } from "clsx" 2 | import { clsx } from "clsx" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return clsx(inputs) 6 | } 7 | -------------------------------------------------------------------------------- /packages/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./cn" 2 | -------------------------------------------------------------------------------- /packages/utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@retconned/utils", 3 | "author": "retconned ", 4 | "main": "./index.ts", 5 | "types": "./index.ts", 6 | "version": "0.0.0", 7 | "private": true, 8 | "devDependencies": { 9 | "@retconned/eslint-config-custom": "workspace:*", 10 | "@retconned/tsconfig": "workspace:*", 11 | "class-variance-authority": "^0.4.0", 12 | "clsx": "^1.2.1", 13 | "eslint": "^7.32.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@retconned/tsconfig/base.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": ["./*"] 7 | } 8 | }, 9 | "include": ["."], 10 | "exclude": ["dist", "build", "node_modules"] 11 | } 12 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "apps/*" 3 | - "packages/*" 4 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@retconned/config/prettier.config') 2 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalDependencies": ["**/.env.*local"], 4 | "pipeline": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": [".next/**", "dist/**"] 8 | }, 9 | "lint": { 10 | "inputs": [ 11 | "**/*.tsx", 12 | "**/*.ts", 13 | "**/*.css", 14 | "**/*.scss", 15 | "**/*.md", 16 | "**/*.json", 17 | "test/**/*.ts", 18 | "test/**/*.tsx" 19 | ] 20 | }, 21 | "test": { 22 | "dependsOn": ["lint", "^build"], 23 | "inputs": ["**/*.tsx", "**/*.ts", "test/**/*.ts", "test/**/*.tsx"], 24 | "outputs": [] 25 | }, 26 | "clean": { 27 | "dependsOn": ["^clean"] 28 | }, 29 | "dev": { 30 | "cache": false, 31 | "persistent": true 32 | }, 33 | "deploy": { 34 | "dependsOn": ["build", "test", "lint"] 35 | }, 36 | "db:generate": { 37 | "cache": false 38 | }, 39 | "db:push": { 40 | "cache": false 41 | } 42 | }, 43 | "globalEnv": ["NODE_ENV", "PORT", "VERCEL_URL"] 44 | } 45 | --------------------------------------------------------------------------------