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..746fca3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,43 +1,56 @@ # 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 + +# vercel +.vercel + +# typescript +dist/ +.cache + +# turbo +.turbo # Worker artifacts apps/worker/temp -apps/worker/out apps/worker/public \ No newline at end of file diff --git a/.infisical.json b/.infisical.json index 9b388c8..99f5bd9 100644 --- a/.infisical.json +++ b/.infisical.json @@ -1,5 +1,5 @@ { - "workspaceId": "3d93ffc6-9c9f-4588-9d5a-1f787ae20036", - "defaultEnvironment": "", - "gitBranchToEnvironmentMapping": null -} \ No newline at end of file + "workspaceId": "3d93ffc6-9c9f-4588-9d5a-1f787ae20036", + "defaultEnvironment": "", + "gitBranchToEnvironmentMapping": null +} 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..91a34b4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,16 @@ -# VidGen +# TODO: -## Parameterization Requirements +- Create Hono API + Allow either uuid for auth OR api key -Preset = Character[] & Gameplay +Preset = Character[] & backgroundVideo (url) & backgroundBlur & delay (table) -Characters: (img, name, voiceId, position = "left" | "right", width, role = "teacher" | "student") -Gameplay: URL +Character: (img, name, voiceId, position = "left" | "right", width, role = "teacher" | "student") -Prompt: string - -delay?: number = 0.5 -backgroundBlur: "none" = 0 | "medium" = 6 | "large" = 12 +- /jobs :POST + - PresetId/Name, Prompt (string) +- /jobs/:uuid + - Progress + - Status + - Name? + - URL 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. - - `