From f096fa6dd239fa7512c115e98b9e4721ccf90e6b Mon Sep 17 00:00:00 2001 From: Turbobot Date: Wed, 11 Jun 2025 13:14:31 -0700 Subject: [PATCH 01/14] feat(create-turbo): apply pnpm-eslint transform --- .env.example | 18 + .github/DISCUSSION_TEMPLATE/ideas.yml | 21 + .github/FUNDING.yml | 3 + .github/ISSUE_TEMPLATE/bug_report.yml | 37 + .github/ISSUE_TEMPLATE/config.yml | 7 + .github/renovate.json | 16 + .github/workflows/ci.yml | 57 + .gitignore | 59 +- .infisical.json | 5 - .npmrc | 2 + .nvmrc | 1 + .vscode/extensions.json | 9 + .vscode/launch.json | 17 + LICENSE | 21 + README.md | 262 +- SPECIFICATION.md | 129 - apps/expo/.expo-shared/assets.json | 4 + apps/expo/.prettierignore | 1 + apps/expo/app.config.ts | 58 + apps/expo/assets/icon-dark.png | Bin 0 -> 19633 bytes apps/expo/assets/icon-light.png | Bin 0 -> 19133 bytes apps/expo/babel.config.js | 11 + apps/expo/eas.json | 33 + apps/expo/eslint.config.mjs | 11 + apps/expo/index.ts | 1 + apps/expo/metro.config.js | 29 + apps/expo/nativewind-env.d.ts | 3 + apps/expo/package.json | 63 + apps/expo/src/app/_layout.tsx | 34 + apps/expo/src/app/index.tsx | 171 + apps/expo/src/app/post/[id].tsx | 25 + apps/expo/src/styles.css | 50 + apps/expo/src/utils/api.tsx | 50 + apps/expo/src/utils/auth.ts | 18 + apps/expo/src/utils/base-url.ts | 26 + apps/expo/src/utils/session-store.ts | 6 + apps/expo/tailwind.config.ts | 10 + apps/expo/tsconfig.json | 21 + apps/expo/turbo.json | 10 + apps/nextjs/README.md | 28 + apps/nextjs/eslint.config.js | 14 + apps/nextjs/next.config.js | 24 + apps/nextjs/package.json | 49 + apps/nextjs/postcss.config.cjs | 5 + apps/nextjs/public/favicon.ico | Bin 0 -> 103027 bytes apps/nextjs/public/t3-icon.svg | 13 + .../src/app/_components/auth-showcase.tsx | 58 + apps/nextjs/src/app/_components/posts.tsx | 181 + .../nextjs/src/app/api/auth/[...all]/route.ts | 4 + apps/nextjs/src/app/api/trpc/[trpc]/route.ts | 46 + apps/nextjs/src/app/globals.css | 50 + apps/nextjs/src/app/layout.tsx | 71 + apps/nextjs/src/app/page.tsx | 41 + apps/nextjs/src/auth/client.ts | 3 + apps/nextjs/src/auth/server.ts | 27 + apps/nextjs/src/env.ts | 39 + apps/nextjs/src/trpc/query-client.ts | 33 + apps/nextjs/src/trpc/react.tsx | 70 + apps/nextjs/src/trpc/server.tsx | 54 + apps/nextjs/tailwind.config.ts | 19 + apps/nextjs/tsconfig.json | 15 + apps/nextjs/turbo.json | 13 + apps/web/.gitignore | 36 - apps/web/README.md | 36 - apps/web/app/api/job/[id]/route.ts | 43 - apps/web/app/components/VideoForm.tsx | 59 - apps/web/app/favicon.ico | Bin 25931 -> 0 bytes apps/web/app/fonts/GeistMonoVF.woff | Bin 67864 -> 0 bytes apps/web/app/fonts/GeistVF.woff | Bin 66268 -> 0 bytes apps/web/app/globals.css | 50 - apps/web/app/jobs/[id]/page.module.css | 66 - apps/web/app/jobs/[id]/page.tsx | 49 - apps/web/app/layout.tsx | 31 - apps/web/app/page.module.css | 272 - apps/web/app/page.tsx | 65 - apps/web/eslint.config.js | 4 - apps/web/lib/bullmq.ts | 6 - apps/web/next.config.js | 4 - apps/web/package.json | 34 - apps/web/tsconfig.json | 18 - apps/worker/package.json | 47 - apps/worker/src/app.ts | 121 - apps/worker/src/index.ts | 11 - apps/worker/src/lib/bullmq.ts | 5 - apps/worker/src/lib/elevenlabs.ts | 8 - apps/worker/src/remotion/Root.tsx | 60 - apps/worker/src/remotion/Video.tsx | 221 - apps/worker/src/remotion/index.ts | 4 - apps/worker/src/utils/generate-script.ts | 69 - apps/worker/src/utils/generate-speech.ts | 79 - apps/worker/src/utils/generate-transcript.ts | 120 - apps/worker/src/utils/generate-video.ts | 78 - apps/worker/src/utils/upload-video.ts | 16 - apps/worker/tsconfig.json | 19 - package.json | 39 +- packages/api/eslint.config.js | 9 + packages/api/package.json | 38 + packages/api/src/index.ts | 33 + packages/api/src/root.ts | 11 + packages/api/src/router/auth.ts | 12 + packages/api/src/router/post.ts | 34 + packages/api/src/trpc.ts | 134 + packages/api/tsconfig.json | 5 + packages/auth/env.ts | 19 + packages/auth/eslint.config.js | 10 + packages/auth/package.json | 40 + packages/auth/src/index.ts | 47 + packages/auth/tsconfig.json | 5 + packages/db/drizzle.config.ts | 14 + packages/db/eslint.config.js | 9 + packages/db/package.json | 49 + packages/db/src/auth-schema.ts | 53 + packages/db/src/client.ts | 10 + packages/db/src/index.ts | 2 + packages/db/src/schema.ts | 25 + packages/db/tsconfig.json | 5 + packages/eslint-config/README.md | 3 - packages/eslint-config/base.js | 32 - packages/eslint-config/next.js | 49 - packages/eslint-config/package.json | 24 - packages/eslint-config/react-internal.js | 39 - packages/typescript-config/base.json | 19 - packages/typescript-config/nextjs.json | 12 - packages/typescript-config/package.json | 9 - packages/typescript-config/react-library.json | 7 - packages/ui/components.json | 17 + packages/ui/eslint.config.js | 11 + packages/ui/eslint.config.mjs | 4 - packages/ui/package.json | 60 +- packages/ui/src/button.tsx | 66 +- packages/ui/src/card.tsx | 27 - packages/ui/src/code.tsx | 11 - packages/ui/src/dropdown-menu.tsx | 184 + packages/ui/src/form.tsx | 171 + packages/ui/src/index.ts | 6 + packages/ui/src/input.tsx | 15 + packages/ui/src/label.tsx | 19 + packages/ui/src/theme.tsx | 41 + packages/ui/src/toast.tsx | 30 + packages/ui/tsconfig.json | 8 +- packages/ui/turbo/generators/config.ts | 30 - .../turbo/generators/templates/component.hbs | 8 - packages/validators/eslint.config.js | 9 + packages/validators/package.json | 33 + packages/validators/src/index.ts | 8 + packages/validators/tsconfig.json | 5 + pnpm-lock.yaml | 14858 ++++++++++++---- pnpm-workspace.yaml | 23 +- tooling/eslint/base.js | 91 + tooling/eslint/nextjs.js | 17 + tooling/eslint/package.json | 34 + tooling/eslint/react.js | 22 + tooling/eslint/tsconfig.json | 5 + tooling/eslint/types.d.ts | 34 + tooling/github/package.json | 3 + tooling/github/setup/action.yml | 17 + tooling/prettier/index.js | 50 + tooling/prettier/package.json | 25 + tooling/prettier/tsconfig.json | 5 + tooling/tailwind/base.ts | 48 + tooling/tailwind/eslint.config.js | 6 + tooling/tailwind/native.ts | 9 + tooling/tailwind/package.json | 32 + tooling/tailwind/tsconfig.json | 5 + tooling/tailwind/web.ts | 40 + tooling/typescript/base.json | 30 + tooling/typescript/internal-package.json | 12 + tooling/typescript/package.json | 8 + turbo.json | 59 +- turbo/generators/config.ts | 95 + .../generators/templates/eslint.config.js.hbs | 9 + turbo/generators/templates/package.json.hbs | 27 + turbo/generators/templates/tsconfig.json.hbs | 6 + 173 files changed, 15212 insertions(+), 5705 deletions(-) create mode 100644 .env.example create mode 100644 .github/DISCUSSION_TEMPLATE/ideas.yml create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/renovate.json create mode 100644 .github/workflows/ci.yml delete mode 100644 .infisical.json create mode 100644 .nvmrc create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 LICENSE delete mode 100644 SPECIFICATION.md create mode 100644 apps/expo/.expo-shared/assets.json create mode 100644 apps/expo/.prettierignore create mode 100644 apps/expo/app.config.ts create mode 100644 apps/expo/assets/icon-dark.png create mode 100644 apps/expo/assets/icon-light.png create mode 100644 apps/expo/babel.config.js create mode 100644 apps/expo/eas.json create mode 100644 apps/expo/eslint.config.mjs create mode 100644 apps/expo/index.ts create mode 100644 apps/expo/metro.config.js create mode 100644 apps/expo/nativewind-env.d.ts create mode 100644 apps/expo/package.json create mode 100644 apps/expo/src/app/_layout.tsx create mode 100644 apps/expo/src/app/index.tsx create mode 100644 apps/expo/src/app/post/[id].tsx create mode 100644 apps/expo/src/styles.css create mode 100644 apps/expo/src/utils/api.tsx create mode 100644 apps/expo/src/utils/auth.ts create mode 100644 apps/expo/src/utils/base-url.ts create mode 100644 apps/expo/src/utils/session-store.ts create mode 100644 apps/expo/tailwind.config.ts create mode 100644 apps/expo/tsconfig.json create mode 100644 apps/expo/turbo.json create mode 100644 apps/nextjs/README.md create mode 100644 apps/nextjs/eslint.config.js create mode 100644 apps/nextjs/next.config.js create mode 100644 apps/nextjs/package.json create mode 100644 apps/nextjs/postcss.config.cjs create mode 100644 apps/nextjs/public/favicon.ico create mode 100644 apps/nextjs/public/t3-icon.svg create mode 100644 apps/nextjs/src/app/_components/auth-showcase.tsx create mode 100644 apps/nextjs/src/app/_components/posts.tsx create mode 100644 apps/nextjs/src/app/api/auth/[...all]/route.ts create mode 100644 apps/nextjs/src/app/api/trpc/[trpc]/route.ts create mode 100644 apps/nextjs/src/app/globals.css create mode 100644 apps/nextjs/src/app/layout.tsx create mode 100644 apps/nextjs/src/app/page.tsx create mode 100644 apps/nextjs/src/auth/client.ts create mode 100644 apps/nextjs/src/auth/server.ts create mode 100644 apps/nextjs/src/env.ts create mode 100644 apps/nextjs/src/trpc/query-client.ts create mode 100644 apps/nextjs/src/trpc/react.tsx create mode 100644 apps/nextjs/src/trpc/server.tsx create mode 100644 apps/nextjs/tailwind.config.ts create mode 100644 apps/nextjs/tsconfig.json create mode 100644 apps/nextjs/turbo.json delete mode 100644 apps/web/.gitignore delete mode 100644 apps/web/README.md delete mode 100644 apps/web/app/api/job/[id]/route.ts delete mode 100644 apps/web/app/components/VideoForm.tsx delete mode 100644 apps/web/app/favicon.ico delete mode 100644 apps/web/app/fonts/GeistMonoVF.woff delete mode 100644 apps/web/app/fonts/GeistVF.woff delete mode 100644 apps/web/app/globals.css delete mode 100644 apps/web/app/jobs/[id]/page.module.css delete mode 100644 apps/web/app/jobs/[id]/page.tsx delete mode 100644 apps/web/app/layout.tsx delete mode 100644 apps/web/app/page.module.css delete mode 100644 apps/web/app/page.tsx delete mode 100644 apps/web/eslint.config.js delete mode 100644 apps/web/lib/bullmq.ts delete mode 100644 apps/web/next.config.js delete mode 100644 apps/web/package.json delete mode 100644 apps/web/tsconfig.json delete mode 100644 apps/worker/package.json delete mode 100644 apps/worker/src/app.ts delete mode 100644 apps/worker/src/index.ts delete mode 100644 apps/worker/src/lib/bullmq.ts delete mode 100644 apps/worker/src/lib/elevenlabs.ts delete mode 100644 apps/worker/src/remotion/Root.tsx delete mode 100644 apps/worker/src/remotion/Video.tsx delete mode 100644 apps/worker/src/remotion/index.ts delete mode 100644 apps/worker/src/utils/generate-script.ts delete mode 100644 apps/worker/src/utils/generate-speech.ts delete mode 100644 apps/worker/src/utils/generate-transcript.ts delete mode 100644 apps/worker/src/utils/generate-video.ts delete mode 100644 apps/worker/src/utils/upload-video.ts delete mode 100644 apps/worker/tsconfig.json create mode 100644 packages/api/eslint.config.js create mode 100644 packages/api/package.json create mode 100644 packages/api/src/index.ts create mode 100644 packages/api/src/root.ts create mode 100644 packages/api/src/router/auth.ts create mode 100644 packages/api/src/router/post.ts create mode 100644 packages/api/src/trpc.ts create mode 100644 packages/api/tsconfig.json create mode 100644 packages/auth/env.ts create mode 100644 packages/auth/eslint.config.js create mode 100644 packages/auth/package.json create mode 100644 packages/auth/src/index.ts create mode 100644 packages/auth/tsconfig.json create mode 100644 packages/db/drizzle.config.ts create mode 100644 packages/db/eslint.config.js create mode 100644 packages/db/package.json create mode 100644 packages/db/src/auth-schema.ts create mode 100644 packages/db/src/client.ts create mode 100644 packages/db/src/index.ts create mode 100644 packages/db/src/schema.ts create mode 100644 packages/db/tsconfig.json delete mode 100644 packages/eslint-config/README.md delete mode 100644 packages/eslint-config/base.js delete mode 100644 packages/eslint-config/next.js delete mode 100644 packages/eslint-config/package.json delete mode 100644 packages/eslint-config/react-internal.js delete mode 100644 packages/typescript-config/base.json delete mode 100644 packages/typescript-config/nextjs.json delete mode 100644 packages/typescript-config/package.json delete mode 100644 packages/typescript-config/react-library.json create mode 100644 packages/ui/components.json create mode 100644 packages/ui/eslint.config.js delete mode 100644 packages/ui/eslint.config.mjs delete mode 100644 packages/ui/src/card.tsx delete mode 100644 packages/ui/src/code.tsx create mode 100644 packages/ui/src/dropdown-menu.tsx create mode 100644 packages/ui/src/form.tsx create mode 100644 packages/ui/src/index.ts create mode 100644 packages/ui/src/input.tsx create mode 100644 packages/ui/src/label.tsx create mode 100644 packages/ui/src/theme.tsx create mode 100644 packages/ui/src/toast.tsx delete mode 100644 packages/ui/turbo/generators/config.ts delete mode 100644 packages/ui/turbo/generators/templates/component.hbs create mode 100644 packages/validators/eslint.config.js create mode 100644 packages/validators/package.json create mode 100644 packages/validators/src/index.ts create mode 100644 packages/validators/tsconfig.json create mode 100644 tooling/eslint/base.js create mode 100644 tooling/eslint/nextjs.js create mode 100644 tooling/eslint/package.json create mode 100644 tooling/eslint/react.js create mode 100644 tooling/eslint/tsconfig.json create mode 100644 tooling/eslint/types.d.ts create mode 100644 tooling/github/package.json create mode 100644 tooling/github/setup/action.yml create mode 100644 tooling/prettier/index.js create mode 100644 tooling/prettier/package.json create mode 100644 tooling/prettier/tsconfig.json create mode 100644 tooling/tailwind/base.ts create mode 100644 tooling/tailwind/eslint.config.js create mode 100644 tooling/tailwind/native.ts create mode 100644 tooling/tailwind/package.json create mode 100644 tooling/tailwind/tsconfig.json create mode 100644 tooling/tailwind/web.ts create mode 100644 tooling/typescript/base.json create mode 100644 tooling/typescript/internal-package.json create mode 100644 tooling/typescript/package.json create mode 100644 turbo/generators/config.ts create mode 100644 turbo/generators/templates/eslint.config.js.hbs create mode 100644 turbo/generators/templates/package.json.hbs create mode 100644 turbo/generators/templates/tsconfig.json.hbs diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..00fcafb --- /dev/null +++ b/.env.example @@ -0,0 +1,18 @@ +# Since .env is gitignored, you can use .env.example to build a new `.env` file when you clone the repo. +# Keep this file up-to-date when you add new variables to \`.env\`. + +# This file will be committed to version control, so make sure not to have any secrets in it. +# If you are cloning this repo, create a copy of this file named `.env` and populate it with your secrets. + +# The database URL is used to connect to your Supabase database. +POSTGRES_URL="postgres://postgres.[USERNAME]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?workaround=supabase-pooler.vercel" + + +# You can generate the secret via 'openssl rand -base64 32' on Unix +# @see https://www.better-auth.com/docs/installation +AUTH_SECRET='supersecret' + +# Preconfigured Discord OAuth provider, works out-of-the-box +# @see https://www.better-auth.com/docs/authentication/discord +AUTH_DISCORD_ID='' +AUTH_DISCORD_SECRET='' \ No newline at end of file diff --git a/.github/DISCUSSION_TEMPLATE/ideas.yml b/.github/DISCUSSION_TEMPLATE/ideas.yml new file mode 100644 index 0000000..c15eba2 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/ideas.yml @@ -0,0 +1,21 @@ +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to file a feature request. Please fill out this form as completely as possible. + - type: textarea + attributes: + label: Describe the feature you'd like to request + description: Please describe the feature as clear and concise as possible. Remember to add context as to why you believe this feature is needed. + validations: + required: true + - type: textarea + attributes: + label: Describe the solution you'd like to see + description: Please describe the solution you would like to see. Adding example usage is a good way to provide context. + validations: + required: true + - type: textarea + attributes: + label: Additional information + description: Add any other information related to the feature here. If your feature request is related to any issues or discussions, link them here. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..043f0f9 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: juliusmarminge diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..54199a8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,37 @@ +name: 🐞 Bug Report +description: Create a bug report to help us improve +title: "bug: " +labels: ["πŸžβ” unconfirmed bug"] +body: + - type: textarea + attributes: + label: Provide environment information + description: | + Run this command in your project root and paste the results in a code block: + ```bash + npx envinfo --system --binaries + ``` + validations: + required: true + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of the bug, as well as what you expected to happen when encountering it. + validations: + required: true + - type: input + attributes: + label: Link to reproduction + description: Please provide a link to a reproduction of the bug. Issues without a reproduction repo may be ignored. + validations: + required: true + - type: textarea + attributes: + label: To reproduce + description: Describe how to reproduce your bug. Steps, code snippets, reproduction repos etc. + validations: + required: true + - type: textarea + attributes: + label: Additional information + description: Add any other information related to the bug here, screenshots if applicable. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..1b73188 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +contact_links: + - name: Ask a question + url: https://github.com/t3-oss/create-t3-turbo/discussions + about: Ask questions and discuss with other community members + - name: Feature request + url: https://github.com/t3-oss/create-t3-turbo/discussions/new?category=ideas + about: Feature requests should be opened as discussions diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..4144940 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:base"], + "packageRules": [ + { + "matchPackagePatterns": ["^@acme/"], + "enabled": false + } + ], + "updateInternalDeps": true, + "rangeStrategy": "bump", + "automerge": true, + "npm": { + "fileMatch": ["(^|/)package\\.json$", "(^|/)package\\.json\\.hbs$"] + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8500662 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + pull_request: + branches: ["*"] + push: + branches: ["main"] + merge_group: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +# You can leverage Vercel Remote Caching with Turbo to speed up your builds +# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds +env: + FORCE_COLOR: 3 + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Copy env + shell: bash + run: cp .env.example .env + + - name: Lint + run: pnpm lint && pnpm lint:ws + + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Format + run: pnpm format + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Typecheck + run: pnpm typecheck diff --git a/.gitignore b/.gitignore index 0879900..201ea51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,43 +1,52 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. -# Dependencies +# dependencies node_modules .pnp .pnp.js -# Local env files -.env -.env.local -.env.development.local -.env.test.local -.env.production.local - -# Testing +# testing coverage -# Turbo -.turbo - -# Vercel -.vercel - -# Build Outputs +# next.js .next/ out/ +next-env.d.ts + +# nitro +.nitro/ +.output/ + +# expo +.expo/ +expo-env.d.ts +apps/expo/.gitignore +apps/expo/ios +apps/expo/android + +# production build -dist +# misc +.DS_Store +*.pem -# Debug +# debug npm-debug.log* yarn-debug.log* yarn-error.log* +.pnpm-debug.log* -# Misc -.DS_Store -*.pem +# local env files +.env +.env*.local -# Worker artifacts -apps/worker/temp -apps/worker/out -apps/worker/public \ No newline at end of file +# vercel +.vercel + +# typescript +dist/ +.cache + +# turbo +.turbo diff --git a/.infisical.json b/.infisical.json deleted file mode 100644 index 9b388c8..0000000 --- a/.infisical.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "workspaceId": "3d93ffc6-9c9f-4588-9d5a-1f787ae20036", - "defaultEnvironment": "", - "gitBranchToEnvironmentMapping": null -} \ No newline at end of file diff --git a/.npmrc b/.npmrc index e69de29..4aabef0 100644 --- a/.npmrc +++ b/.npmrc @@ -0,0 +1,2 @@ +node-linker=hoisted +link-workspace-packages=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..744ca17 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.14 diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..3606d87 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "dbaeumer.vscode-eslint", + "expo.vscode-expo-tools", + "esbenp.prettier-vscode", + "yoavbls.pretty-ts-errors", + "bradlc.vscode-tailwindcss" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..04f7850 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Next.js", + "type": "node-terminal", + "request": "launch", + "command": "pnpm dev", + "cwd": "${workspaceFolder}/apps/nextjs", + "skipFiles": ["/**"], + "sourceMaps": true, + "sourceMapPathOverrides": { + "/turbopack/[project]/*": "${webRoot}/*" //https://github.com/vercel/next.js/issues/62008 + } + } + ] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..435503e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Julius Marminge + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e51a525..b3250e8 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,259 @@ -# VidGen +# create-t3-turbo -## Parameterization Requirements +> [!NOTE] +> +> create-t3-turbo now uses better-auth for authentication! +> Look out for bugs as we're working through the last issues, +> especially, the oauth proxy might not play very nice with Expo +> so you might need to disable that in [`@acme/auth`](./packages/auth/src/index.ts) -Preset = Character[] & Gameplay +## Installation -Characters: (img, name, voiceId, position = "left" | "right", width, role = "teacher" | "student") -Gameplay: URL +> [!NOTE] +> +> Make sure to follow the system requirements specified in [`package.json#engines`](./package.json#L4) before proceeding. -Prompt: string +There are two ways of initializing an app using the `create-t3-turbo` starter. You can either use this repository as a template: -delay?: number = 0.5 -backgroundBlur: "none" = 0 | "medium" = 6 | "large" = 12 +![use-as-template](https://github.com/t3-oss/create-t3-turbo/assets/51714798/bb6c2e5d-d8b6-416e-aeb3-b3e50e2ca994) + +or use Turbo's CLI to init your project (use PNPM as package manager): + +```bash +npx create-turbo@latest -e https://github.com/t3-oss/create-t3-turbo +``` + +## About + +Ever wondered how to migrate your T3 application into a monorepo? Stop right here! This is the perfect starter repo to get you running with the perfect stack! + +It uses [Turborepo](https://turborepo.org) and contains: + +```text +.github + └─ workflows + └─ CI with pnpm cache setup +.vscode + └─ Recommended extensions and settings for VSCode users +apps + β”œβ”€ expo + | β”œβ”€ Expo SDK 53 (EXPERIMENTAL) + | | > [!WARNING] + | | > Using Expo SDK 53 (canary) to unblock Next.js 15 / React 19 support. + | | > This is experimental and might not work as expected. + | β”œβ”€ React Native using React 19 + | β”œβ”€ Navigation using Expo Router + | β”œβ”€ Tailwind using NativeWind + | └─ Typesafe API calls using tRPC + └─ next.js + β”œβ”€ Next.js 15 + β”œβ”€ React 19 + β”œβ”€ Tailwind CSS + └─ E2E Typesafe API Server & Client +packages + β”œβ”€ api + | └─ tRPC v11 router definition + β”œβ”€ auth + | └─ Authentication using better-auth. + β”œβ”€ db + | └─ Typesafe db calls using Drizzle & Supabase + └─ ui + └─ Start of a UI package for the webapp using shadcn-ui +tooling + β”œβ”€ eslint + | └─ shared, fine-grained, eslint presets + β”œβ”€ prettier + | └─ shared prettier configuration + β”œβ”€ tailwind + | └─ shared tailwind configuration + └─ typescript + └─ shared tsconfig you can extend from +``` + +> In this template, we use `@acme` as a placeholder for package names. As a user, you might want to replace it with your own organization or project name. You can use find-and-replace to change all the instances of `@acme` to something like `@my-company` or `@project-name`. + +## Quick Start + +> **Note** +> The [db](./packages/db) package is preconfigured to use Supabase and is **edge-bound** with the [Vercel Postgres](https://github.com/vercel/storage/tree/main/packages/postgres) driver. If you're using something else, make the necessary modifications to the [schema](./packages/db/src/schema.ts) as well as the [client](./packages/db/src/index.ts) and the [drizzle config](./packages/db/drizzle.config.ts). If you want to switch to non-edge database driver, remove `export const runtime = "edge";` [from all pages and api routes](https://github.com/t3-oss/create-t3-turbo/issues/634#issuecomment-1730240214). + +To get it running, follow the steps below: + +### 1. Setup dependencies + +```bash +# Install dependencies +pnpm i + +# Configure environment variables +# There is an `.env.example` in the root directory you can use for reference +cp .env.example .env + +# Push the Drizzle schema to the database +pnpm db:push +``` + +### 2. Configure Expo `dev`-script + +#### Use iOS Simulator + +1. Make sure you have XCode and XCommand Line Tools installed [as shown on expo docs](https://docs.expo.dev/workflow/ios-simulator). + + > **NOTE:** If you just installed XCode, or if you have updated it, you need to open the simulator manually once. Run `npx expo start` from `apps/expo`, and then enter `I` to launch Expo Go. After the manual launch, you can run `pnpm dev` in the root directory. + + ```diff + + "dev": "expo start --ios", + ``` + +2. Run `pnpm dev` at the project root folder. + +#### Use Android Emulator + +1. Install Android Studio tools [as shown on expo docs](https://docs.expo.dev/workflow/android-studio-emulator). + +2. Change the `dev` script at `apps/expo/package.json` to open the Android emulator. + + ```diff + + "dev": "expo start --android", + ``` + +3. Run `pnpm dev` at the project root folder. + +### 3. Configuring Better-Auth to work with Expo + +In order to get Better-Auth to work with Expo, you must either: + +#### Deploy the Auth Proxy (RECOMMENDED) + +Better-auth comes with an [auth proxy plugin](https://www.better-auth.com/docs/plugins/oauth-proxy). By deploying the Next.js app, you can get OAuth working in preview deployments and development for Expo apps. + +By using the proxy plugin, the Next.js apps will forward any auth requests to the proxy server, which will handle the OAuth flow and then redirect back to the Next.js app. This makes it easy to get OAuth working since you'll have a stable URL that is publicly accessible and doesn't change for every deployment and doesn't rely on what port the app is running on. So if port 3000 is taken and your Next.js app starts at port 3001 instead, your auth should still work without having to reconfigure the OAuth provider. + +#### Add your local IP to your OAuth provider + +You can alternatively add your local IP (e.g. `192.168.x.y:$PORT`) to your OAuth provider. This may not be as reliable as your local IP may change when you change networks. Some OAuth providers may also only support a single callback URL for each app making this approach unviable for some providers (e.g. GitHub). + +### 4a. When it's time to add a new UI component + +Run the `ui-add` script to add a new UI component using the interactive `shadcn/ui` CLI: + +```bash +pnpm ui-add +``` + +When the component(s) has been installed, you should be good to go and start using it in your app. + +### 4b. When it's time to add a new package + +To add a new package, simply run `pnpm turbo gen init` in the monorepo root. This will prompt you for a package name as well as if you want to install any dependencies to the new package (of course you can also do this yourself later). + +The generator sets up the `package.json`, `tsconfig.json` and a `index.ts`, as well as configures all the necessary configurations for tooling around your package such as formatting, linting and typechecking. When the package is created, you're ready to go build out the package. + +## FAQ + +### Does the starter include Solito? + +No. Solito will not be included in this repo. It is a great tool if you want to share code between your Next.js and Expo app. However, the main purpose of this repo is not the integration between Next.js and Expo β€” it's the code splitting of your T3 App into a monorepo. The Expo app is just a bonus example of how you can utilize the monorepo with multiple apps but can just as well be any app such as Vite, Electron, etc. + +Integrating Solito into this repo isn't hard, and there are a few [official templates](https://github.com/nandorojo/solito/tree/master/example-monorepos) by the creators of Solito that you can use as a reference. + +### Does this pattern leak backend code to my client applications? + +No, it does not. The `api` package should only be a production dependency in the Next.js application where it's served. The Expo app, and all other apps you may add in the future, should only add the `api` package as a dev dependency. This lets you have full typesafety in your client applications, while keeping your backend code safe. + +If you need to share runtime code between the client and server, such as input validation schemas, you can create a separate `shared` package for this and import it on both sides. + +## Deployment + +### Next.js + +#### Prerequisites + +> **Note** +> Please note that the Next.js application with tRPC must be deployed in order for the Expo app to communicate with the server in a production environment. + +#### Deploy to Vercel + +Let's deploy the Next.js application to [Vercel](https://vercel.com). If you've never deployed a Turborepo app there, don't worry, the steps are quite straightforward. You can also read the [official Turborepo guide](https://vercel.com/docs/concepts/monorepos/turborepo) on deploying to Vercel. + +1. Create a new project on Vercel, select the `apps/nextjs` folder as the root directory. Vercel's zero-config system should handle all configurations for you. + +2. Add your `POSTGRES_URL` environment variable. + +3. Done! Your app should successfully deploy. Assign your domain and use that instead of `localhost` for the `url` in the Expo app so that your Expo app can communicate with your backend when you are not in development. + +### Auth Proxy + +The auth proxy comes as a better-auth plugin. This is required for the Next.js app to be able to authenticate users in preview deployments. The auth proxy is not used for OAuth request in production deployments. The easiest way to get it running is to deploy the Next.js app to vercel. + +### Expo + +Deploying your Expo application works slightly differently compared to Next.js on the web. Instead of "deploying" your app online, you need to submit production builds of your app to app stores, like [Apple App Store](https://www.apple.com/app-store) and [Google Play](https://play.google.com/store/apps). You can read the full [guide to distributing your app](https://docs.expo.dev/distribution/introduction), including best practices, in the Expo docs. + +1. Make sure to modify the `getBaseUrl` function to point to your backend's production URL: + + + +2. Let's start by setting up [EAS Build](https://docs.expo.dev/build/introduction), which is short for Expo Application Services. The build service helps you create builds of your app, without requiring a full native development setup. The commands below are a summary of [Creating your first build](https://docs.expo.dev/build/setup). + + ```bash + # Install the EAS CLI + pnpm add -g eas-cli + + # Log in with your Expo account + eas login + + # Configure your Expo app + cd apps/expo + eas build:configure + ``` + +3. After the initial setup, you can create your first build. You can build for Android and iOS platforms and use different [`eas.json` build profiles](https://docs.expo.dev/build-reference/eas-json) to create production builds or development, or test builds. Let's make a production build for iOS. + + ```bash + eas build --platform ios --profile production + ``` + + > If you don't specify the `--profile` flag, EAS uses the `production` profile by default. + +4. Now that you have your first production build, you can submit this to the stores. [EAS Submit](https://docs.expo.dev/submit/introduction) can help you send the build to the stores. + + ```bash + eas submit --platform ios --latest + ``` + + > You can also combine build and submit in a single command, using `eas build ... --auto-submit`. + +5. Before you can get your app in the hands of your users, you'll have to provide additional information to the app stores. This includes screenshots, app information, privacy policies, etc. _While still in preview_, [EAS Metadata](https://docs.expo.dev/eas/metadata) can help you with most of this information. + +6. Once everything is approved, your users can finally enjoy your app. Let's say you spotted a small typo; you'll have to create a new build, submit it to the stores, and wait for approval before you can resolve this issue. In these cases, you can use EAS Update to quickly send a small bugfix to your users without going through this long process. Let's start by setting up EAS Update. + + The steps below summarize the [Getting started with EAS Update](https://docs.expo.dev/eas-update/getting-started/#configure-your-project) guide. + + ```bash + # Add the `expo-updates` library to your Expo app + cd apps/expo + pnpm expo install expo-updates + + # Configure EAS Update + eas update:configure + ``` + +7. Before we can send out updates to your app, you have to create a new build and submit it to the app stores. For every change that includes native APIs, you have to rebuild the app and submit the update to the app stores. See steps 2 and 3. + +8. Now that everything is ready for updates, let's create a new update for `production` builds. With the `--auto` flag, EAS Update uses your current git branch name and commit message for this update. See [How EAS Update works](https://docs.expo.dev/eas-update/how-eas-update-works/#publishing-an-update) for more information. + + ```bash + cd apps/expo + eas update --auto + ``` + + > Your OTA (Over The Air) updates must always follow the app store's rules. You can't change your app's primary functionality without getting app store approval. But this is a fast way to update your app for minor changes and bug fixes. + +9. Done! Now that you have created your production build, submitted it to the stores, and installed EAS Update, you are ready for anything! + +## References + +The stack originates from [create-t3-app](https://github.com/t3-oss/create-t3-app). + +A [blog post](https://jumr.dev/blog/t3-turbo) where I wrote how to migrate a T3 app into this. diff --git a/SPECIFICATION.md b/SPECIFICATION.md deleted file mode 100644 index c0f53ac..0000000 --- a/SPECIFICATION.md +++ /dev/null @@ -1,129 +0,0 @@ -# Project Context: Family Guy Explainer Video Generator - -This document provides context and requirements for an LLM-powered fullstack application that generates "brainrot" explainer videos in the style of Family Guy, leveraging ElevenLabs for AI voice synthesis and transcription. This context is intended for use in Cursor or any LLM-based code workspace. - ---- - -## **Project Overview** - -The application generates short-form, meme-style explainer videos. The format features: - -- **Images of Family Guy characters** (e.g., Stewie, Peter Griffin, Brian) overlayed on stock Subway Surfers gameplay footage. -- **AI-generated script**: Each character reads lines relevant to a user-provided topic, with dialogue generated via LLM. -- **AI voice cloning**: Each character's lines are spoken using a custom ElevenLabs voice clone. -- **Automatic subtitles**: Subtitles are generated and timed using ElevenLabs' Speech-to-Text API. -- **Video composition**: All elements are programmatically assembled with Remotion (React video library). - -**Assume all necessary copyright and usage rights have been obtained for character likenesses and voices.** - ---- - -## **Technical Stack** - -- **Script Generation**: Vercel AI SDK (or equivalent) with a pre-defined system prompt. Output is a Zod-validated array of script objects: - - `speaker`: character name - - `text`: the line to be spoken -- **Voice Synthesis**: ElevenLabs Text-to-Speech API with custom voice clones for each character. - - Each script line is synthesized using the corresponding character's voice. -- **Transcription \& Timing**: ElevenLabs Speech-to-Text API for generating transcripts and word-level timestamps from the synthesized audio, enabling accurate subtitle overlays. -- **Video Generation**: Remotion (React library) to: - - Play Subway Surfers gameplay as the background. - - Overlay the speaking character’s image and play their audio at the correct time. - - Display subtitles synced to the spoken lines. - ---- - -## **Key APIs and Methods** - -### **ElevenLabs Voice Cloning and TTS** - -- **Voice Cloning**: Create custom voices via the ElevenLabs dashboard by uploading audio samples for each character. Each voice gets a unique `voice_id`[^1][^3][^5]. -- **TTS API Endpoint**: - `POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}` - Headers: `xi-api-key`, `Content-Type: application/json` - Payload: - -```json -{ - "text": "Line to synthesize", - "voice_settings": { - "stability": 0.7, - "similarity_boost": 0.8 - } -} -``` - - - Response: Audio file (e.g., MP3)[^2][^6]. - -### **ElevenLabs Speech-to-Text (Transcription)** - -- **Transcript API**: - - Input: Audio file URL or data - - Options: Word-level timestamps, speaker diarization, language selection - - Output: Transcript with precise timing for each word, suitable for subtitle generation[^4]. - -### **Remotion (Video Generation)** - -- **Key Remotion Concepts**: - - ``: Time-based layering of video/audio/image elements. - - `