├── .env.example ├── .gitignore ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── _eslintrc.cjs ├── next.config.mjs ├── package-lock.json ├── package.json ├── postcss.config.cjs ├── prettier.config.cjs ├── prisma └── schema.prisma ├── public ├── assets │ └── hero-image.svg ├── favicon.ico ├── hero.riv └── logo.png ├── src ├── components │ ├── animation │ │ ├── character.tsx │ │ ├── pop.tsx │ │ ├── text.tsx │ │ └── typing.tsx │ ├── captions │ │ └── index.tsx │ ├── card │ │ └── index.tsx │ ├── features │ │ └── index.tsx │ ├── footer │ │ └── index.tsx │ ├── join │ │ └── index.tsx │ ├── loader │ │ └── index.tsx │ ├── modal │ │ └── index.tsx │ ├── navbar │ │ └── index.tsx │ ├── splashScreen │ │ └── index.tsx │ └── tabs │ │ └── index.tsx ├── env.mjs ├── hooks │ └── useTranscribe.ts ├── lib │ ├── Debug.tsx │ ├── client-utils.tsx │ ├── serverUtils.ts │ └── type.ts ├── pages │ ├── _app.tsx │ ├── api │ │ ├── auth │ │ │ └── [...nextauth].ts │ │ ├── pusher.ts │ │ └── trpc │ │ │ └── [trpc].ts │ ├── index.tsx │ ├── profile.tsx │ └── rooms │ │ └── [name].tsx ├── server │ ├── api │ │ ├── root.ts │ │ ├── routers │ │ │ ├── pusher.ts │ │ │ └── rooms.ts │ │ └── trpc.ts │ ├── auth.ts │ └── db.ts ├── styles │ └── globals.css └── utils │ ├── api.ts │ ├── pusher.ts │ └── speak.ts ├── tailwind.config.cjs └── tsconfig.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 | # Prisma 13 | # https://www.prisma.io/docs/reference/database-reference/connection-urls#env 14 | DATABASE_URL="" 15 | 16 | # Next Auth 17 | # You can generate a new secret on the command line with: 18 | # openssl rand -base64 32 19 | # https://next-auth.js.org/configuration/options#secret 20 | NEXTAUTH_SECRET="" 21 | NEXTAUTH_URL="" 22 | 23 | # Next Auth Google Provider 24 | GOOGLE_CLIENT_ID="" 25 | GOOGLE_CLIENT_SECRET="" 26 | 27 | # Livekit 28 | LIVEKIT_API_KEY="" 29 | LIVEKIT_API_SECRET="" 30 | NEXT_PUBLIC_LIVEKIT_API_HOST="" 31 | 32 | # Pusher 33 | PUSHER_APP_ID = "" 34 | PUSHER_KEY = "" 35 | PUSHER_SECRET = "" 36 | PUSHER_CLUSTER = "" 37 | NEXT_PUBLIC_PUSHER_KEY= "" 38 | NEXT_PUBLIC_PUSHER_CLUSTER= "" 39 | 40 | # OneAI 41 | ONEAI_API_KEY="" -------------------------------------------------------------------------------- /.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 | # database 12 | /prisma/db.sqlite 13 | /prisma/db.sqlite-journal 14 | 15 | # next.js 16 | /.next/ 17 | /out/ 18 | next-env.d.ts 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # local env files 34 | # 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 35 | .env 36 | .env*.local 37 | 38 | # vercel 39 | .vercel 40 | 41 | # typescript 42 | *.tsbuildinfo 43 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "livekit" 4 | ] 5 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > **Note** 2 | > We have rebuilt the Entire architecture during a 24 hour Hackathon and brought down the latency to just 3-5 seconds. Checkout the [new repo](https://github.com/nagarajpandith/hackverse) for the latest version of the project. 3 | 4 | ![Social Cover - Jab We Meet](https://user-images.githubusercontent.com/83623339/226182317-55a21e48-8176-440e-b16c-93ea218748e2.png) 5 | [Live Demo](https://jabwemeet.vercel.app/) | [Pitch Deck](https://www.canva.com/design/DAFdhOPv1eA/qvB2ivAdB--1m9PxY-buWw/view?utm_content=DAFdhOPv1eA&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink) | [Hackoverflow 1.0](https://hack-overflow.tech/) 6 | 7 | # Jab We Meet 8 | Jab We Meet is a web application that allows users who speak different languages to converse with ease by translating the audio on the fly and speaking the translated audio in the native language of the user as well as provide them with translated captions. It also offers HD video and screen share, and can accommodate up to 100 concurrent users. The application also generates automatic meeting summaries and transcripts, making it easy for participants to review important details from the meeting. 9 | 10 | > This is the Winning solution developed at 36-hour National Level hackathon called 'Hackoverflow 1.0' by PHCET, Navi Mumbai. 11 | 12 | ![Jab We Meet - winners](https://user-images.githubusercontent.com/83623339/226183207-e8b0198f-c2af-4d1f-a518-0b61e6abab7a.png) 13 | 14 | ## Use cases 15 | - Startups and MNCs with international work culture. 16 | - Freelancers with daily foreign communication. 17 | - Content creators & live streamers to reach global range audience. 18 | - Educational organizations to teach courses to multilingual students. 19 | 20 | ## Built with 21 | 22 |

23 |       24 |       25 |       26 |       27 |       28 | 29 |

30 | 31 | - [**Next JS**](https://nextjs.org/): React-based framework for building server-side rendered and statically exported web apps. 32 | - [**Typescript**](https://www.typescriptlang.org/): Statically typed superset of JavaScript, adds type annotations to enhance code reliability & readability 33 | - [**Livekit**](https://livekit.io/): End-to-end WebRTC infrastructure to build live video and audio applications. 34 | - [**Pusher**](https://pusher.com/): WebSockets solution for Realtime updates and bidirectional communication. 35 | - [**TailwindCSS**](https://tailwindcss.com/): Utility-first CSS framework 36 | - [**Planetscale**](https://planetscale.com/): Highly scalable, globally distributed database 37 | - [**tRPC**](https://trpc.io/): Provides a simple, type-safe way to build APIs for TS & JS 38 | - [**Prisma ORM**](https://www.prisma.io/): Modern, type-safe ORM for Node.js and TS 39 | - **APIs used**: Browser's [Webspeech](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) API for transcribing and tts/speech synthesis. [Google-translate-browser](https://www.npmjs.com/package/google-translate-api-browser) API for translating texts, OneAI's [Summarizer](https://www.oneai.com/summarize) for summarizations of meeting transcripts. 40 | 41 | > **Note** 42 | > This project was bootstrapped with [create-t3-app](https://create.t3.gg/). Check [package.json](https://github.com/swasthikshetty10/hackoverflow/blob/main/package.json) to know all the dependencies and tech stack we used. 43 | 44 | ## Features 45 | - Multilingual Meeting Support 46 | - Real-time Translation and Transcriptions 47 | - Automatic Meeting Minutes generation 48 | - Support to upto 100 concurrent users 49 | - Supports HQ Video streaming 50 | 51 | ## Architecture 52 | Screenshot 2023-03-18 at 11 09 44 AM 53 | 54 | ## Installation steps 55 | 56 | 1. - Fork the [repo](https://github.com/swasthikshetty10/hackoverflow) 57 | - Clone the repo to your local system `git clone https://github.com/swasthikshetty10/hackoverflow.git` 58 | - Change current directory `cd hackoverflow` 59 | 2. Install latest version of [Nodejs](https://nodejs.org/en/) and install all the dependencies: 60 | 61 | ```bash 62 | npm install 63 | ``` 64 | 65 | 3. Generate prisma client 66 | 67 | ```bash 68 | npx prisma generate 69 | ``` 70 | 71 | 4. Copy and Rename the .env.example to .env, place it in the root directory and fill the essential vars. 72 | 73 | ```bash 74 | cp .env.example .env 75 | ``` 76 | 77 | > **Warning** 78 | > Do not rename the original .env.example, it is used to keep track for env vars list as .env with values is gitignored 79 | 80 | 5. Run the development server: 81 | 82 | ```bash 83 | npm run dev 84 | ``` 85 | 86 | ## Known Issues 87 | - There is latency of around 5-6 seconds between the original time and the time when translated audio is spoken out. The latency issue can be tackled by following ways: 88 | - Use native models for faster transcriptions 89 | - Use paid APIs for quicker translations like Whisper AI, Google translate etc. 90 | - Develop a learning model to predict the next moves of the speaker, which is a replacement for WebSpeech API's final transcription boolean. 91 | - As the app relies on browser's native Web Speech API for transcribing and tts, few browsers like Brave with known issues for this API and microphone functions tend to fail at running the app successfully. 92 | 93 | ## Future scope of development 94 | - Use deepAI models to sync video/lip movements & translated audio. 95 | - Resemble the spoken audio(translated) to source audio(speaker) pitch. 96 | 97 | ## Team Members 98 | 99 | | | | | 100 | | :-----------------------------------------------------------------------------: | :-----------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | 101 | | [Nagaraj Pandith](https://github.com/nagarajpandith/) | [Swasthik Shetty](https://github.com/swasthikshetty10/](https://github.com/rudra246)>) | [Tanishka Rao](https://github.com/tanishkarao16) | 102 | 103 | ## License 104 | [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 105 | 106 | This repository is licensed under [Apache License 2.0](https://github.com/swasthikshetty10/hackoverflow/blob/main/LICENSE) 107 | 108 | ## Attributions 109 | 110 | - [Icon from - Flaticon](https://www.flaticon.com/free-icons/) -------------------------------------------------------------------------------- /_eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import("eslint").Linter.Config} */ 2 | const config = { 3 | overrides: [ 4 | { 5 | extends: [ 6 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 7 | ], 8 | files: ["*.ts", "*.tsx"], 9 | parserOptions: { 10 | project: "tsconfig.json", 11 | }, 12 | }, 13 | ], 14 | parser: "@typescript-eslint/parser", 15 | parserOptions: { 16 | project: "./tsconfig.json", 17 | }, 18 | plugins: ["@typescript-eslint"], 19 | extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], 20 | rules: { 21 | "@typescript-eslint/consistent-type-imports": [ 22 | "warn", 23 | { 24 | prefer: "type-imports", 25 | fixStyle: "inline-type-imports", 26 | }, 27 | ], 28 | "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], 29 | }, 30 | }; 31 | 32 | module.exports = config; 33 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | /** 4 | * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. 5 | * This is especially useful for Docker builds. 6 | */ 7 | !process.env.SKIP_ENV_VALIDATION && (await import("./src/env.mjs")); 8 | 9 | /** @type {import("next").NextConfig} */ 10 | const config = { 11 | reactStrictMode: true, 12 | 13 | /** 14 | * If you have the "experimental: { appDir: true }" setting enabled, then you 15 | * must comment the below `i18n` config out. 16 | * 17 | * @see https://github.com/vercel/next.js/issues/41980 18 | */ 19 | i18n: { 20 | locales: ["en"], 21 | defaultLocale: "en", 22 | }, 23 | images: { 24 | domains: ['lh3.googleusercontent.com'] 25 | } 26 | }; 27 | export default config; 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hackoverflow", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build", 7 | "dev": "next dev", 8 | "postinstall": "prisma generate", 9 | "lint": "next lint", 10 | "start": "next start" 11 | }, 12 | "dependencies": { 13 | "@headlessui/react": "^1.7.13", 14 | "@livekit/components-react": "0.6.2", 15 | "@livekit/components-styles": "0.2.1", 16 | "@next-auth/prisma-adapter": "^1.0.5", 17 | "@prisma/client": "^4.11.0", 18 | "@rive-app/react-canvas": "^3.0.38", 19 | "@tanstack/react-query": "^4.28.0", 20 | "@trpc/client": "^10.18.0", 21 | "@trpc/next": "^10.18.0", 22 | "@trpc/react-query": "^10.18.0", 23 | "@trpc/server": "^10.18.0", 24 | "@vitalets/google-translate-api": "^9.1.0", 25 | "axios": "^1.3.4", 26 | "framer-motion": "^10.9.0", 27 | "google-translate-api-browser": "^3.0.1", 28 | "livekit-client": "^1.7.1", 29 | "livekit-server-sdk": "^1.1.0", 30 | "next": "^13.2.4", 31 | "next-auth": "^4.20.1", 32 | "nodejs-text-summarizer": "^2.0.3", 33 | "openai": "^3.2.1", 34 | "pusher": "^5.1.2", 35 | "pusher-js": "^8.0.2", 36 | "react": "18.2.0", 37 | "react-dom": "18.2.0", 38 | "react-icons": "^4.8.0", 39 | "react-speech-recognition": "^3.10.0", 40 | "react-type-animation": "^3.0.1", 41 | "superjson": "1.12.2", 42 | "transliteration": "^2.3.5", 43 | "zod": "^3.21.4" 44 | }, 45 | "devDependencies": { 46 | "@types/react-speech-recognition": "^3.9.1", 47 | "@types/eslint": "^8.21.3", 48 | "@types/google-translate-api": "^2.3.2", 49 | "@types/node": "^18.15.7", 50 | "@types/prettier": "^2.7.2", 51 | "@types/react": "^18.0.28", 52 | "@types/react-dom": "^18.0.11", 53 | "@typescript-eslint/eslint-plugin": "^5.56.0", 54 | "@typescript-eslint/parser": "^5.56.0", 55 | "autoprefixer": "^10.4.14", 56 | "eslint": "^8.36.0", 57 | "eslint-config-next": "^13.2.4", 58 | "postcss": "^8.4.21", 59 | "prettier": "^2.8.7", 60 | "prettier-plugin-tailwindcss": "^0.2.5", 61 | "prisma": "^4.11.0", 62 | "tailwindcss": "^3.2.7", 63 | "typescript": "^5.0.2" 64 | }, 65 | "ct3aMetadata": { 66 | "initVersion": "7.7.0" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /postcss.config.cjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | 8 | module.exports = config; 9 | -------------------------------------------------------------------------------- /prettier.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import("prettier").Config} */ 2 | const config = { 3 | plugins: [require.resolve("prettier-plugin-tailwindcss")], 4 | }; 5 | 6 | module.exports = config; 7 | -------------------------------------------------------------------------------- /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 = "mysql" 10 | url = env("DATABASE_URL") 11 | relationMode = "prisma" 12 | } 13 | 14 | model Example { 15 | id String @id @default(cuid()) 16 | createdAt DateTime @default(now()) 17 | updatedAt DateTime @updatedAt 18 | } 19 | 20 | // Necessary for Next auth 21 | model Account { 22 | id String @id @default(cuid()) 23 | userId String 24 | type String 25 | provider String 26 | providerAccountId String 27 | refresh_token String? @db.Text 28 | access_token String? @db.Text 29 | expires_at Int? 30 | token_type String? 31 | scope String? 32 | id_token String? @db.Text 33 | session_state String? 34 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) 35 | 36 | @@unique([provider, providerAccountId]) 37 | @@index([userId], name: "userId") 38 | } 39 | 40 | model Session { 41 | id String @id @default(cuid()) 42 | sessionToken String @unique 43 | userId String 44 | expires DateTime 45 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) 46 | 47 | @@index([userId], name: "userId") 48 | } 49 | 50 | model User { 51 | id String @id @default(cuid()) 52 | name String? 53 | email String? @unique 54 | emailVerified DateTime? 55 | image String? 56 | accounts Account[] 57 | sessions Session[] 58 | Room Room[] 59 | Participant Participant[] 60 | Transcript Transcript[] 61 | } 62 | 63 | model VerificationToken { 64 | identifier String 65 | token String @unique 66 | expires DateTime 67 | 68 | @@unique([identifier, token]) 69 | } 70 | 71 | model Room { 72 | createdAt DateTime @default(now()) 73 | updatedAt DateTime @updatedAt 74 | name String @id @unique @default(cuid()) 75 | metadata String? @db.Text 76 | slug String? 77 | OwnerId String 78 | Owner User @relation(fields: [OwnerId], references: [id], onDelete: Cascade) 79 | summary String? @db.Text 80 | Participant Participant[] 81 | transcripts Transcript[] 82 | 83 | @@index([OwnerId]) 84 | } 85 | 86 | model Transcript { 87 | id String @id @default(cuid()) 88 | createdAt DateTime @default(now()) 89 | updatedAt DateTime @updatedAt 90 | RoomName String 91 | Room Room @relation(fields: [RoomName], references: [name], onDelete: Cascade) 92 | text String @db.Text 93 | UserId String 94 | User User @relation(fields: [UserId], references: [id], onDelete: Cascade) 95 | 96 | @@index([RoomName]) 97 | @@index([UserId]) 98 | } 99 | 100 | model Participant { 101 | createdAt DateTime @default(now()) 102 | updatedAt DateTime @updatedAt 103 | UserId String 104 | User User @relation(fields: [UserId], references: [id], onDelete: Cascade) 105 | RoomName String 106 | Room Room @relation(fields: [RoomName], references: [name], onDelete: Cascade) 107 | 108 | @@id([UserId, RoomName]) 109 | @@index([UserId]) 110 | @@index([RoomName]) 111 | } 112 | -------------------------------------------------------------------------------- /public/assets/hero-image.svg: -------------------------------------------------------------------------------- 1 | 2 | 12083704_Wavy_Bus-35_Single-02-ai 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swasthikshetty10/hackoverflow/0b245c9d147da00825536d736b0dbf096b3a5329/public/favicon.ico -------------------------------------------------------------------------------- /public/hero.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swasthikshetty10/hackoverflow/0b245c9d147da00825536d736b0dbf096b3a5329/public/hero.riv -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swasthikshetty10/hackoverflow/0b245c9d147da00825536d736b0dbf096b3a5329/public/logo.png -------------------------------------------------------------------------------- /src/components/animation/character.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useRef } from 'react'; 2 | import { motion, useInView } from 'framer-motion'; 3 | 4 | const CharacterAnimation: FC<{ 5 | text: string; 6 | className?: string; 7 | textStyle?: string; 8 | }> = ({ text, className, textStyle }) => { 9 | const ref = useRef(null); 10 | const isInView = useInView(ref, { once: true }); 11 | const letters = Array.from(text); 12 | 13 | const container = { 14 | hidden: { opacity: 0 }, 15 | visible: (i = 1) => ({ 16 | opacity: 1, 17 | transition: { staggerChildren: 0.03, delayChildren: 0.04 * i }, 18 | }), 19 | }; 20 | 21 | const child = { 22 | visible: { 23 | opacity: 1, 24 | y: 0, 25 | transition: { 26 | type: 'spring', 27 | damping: 12, 28 | stiffness: 100, 29 | }, 30 | }, 31 | hidden: { 32 | opacity: 0, 33 | y: 20, 34 | transition: { 35 | type: 'spring', 36 | damping: 12, 37 | stiffness: 100, 38 | }, 39 | }, 40 | }; 41 | 42 | return ( 43 | 51 | {letters.map((letter, index) => ( 52 | 53 | {letter === ' ' ? '\u00A0' : letter} 54 | 55 | ))} 56 | 57 | ); 58 | }; 59 | 60 | export default CharacterAnimation; -------------------------------------------------------------------------------- /src/components/animation/pop.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, ReactNode, useRef } from "react"; 2 | import { motion, useInView } from "framer-motion"; 3 | 4 | const PopAnimation: FC<{ 5 | className?: string; 6 | children: ReactNode; 7 | }> = ({ className, children }) => { 8 | const ref = useRef(null); 9 | const isInView = useInView(ref, { once: true }); 10 | 11 | return ( 12 | 38 | {children} 39 | 40 | ); 41 | }; 42 | 43 | export default PopAnimation; 44 | -------------------------------------------------------------------------------- /src/components/animation/text.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useRef } from "react"; 2 | import { motion, useInView } from "framer-motion"; 3 | 4 | const TextAnimation: FC<{ 5 | text: string; 6 | className?: string; 7 | textStyle?: string; 8 | }> = ({ text, className, textStyle }) => { 9 | const ref = useRef(null); 10 | const isInView = useInView(ref, { once: true }); 11 | const words = text.split(" "); 12 | 13 | const container = { 14 | hidden: { opacity: 0 }, 15 | visible: (i = 1) => ({ 16 | opacity: 1, 17 | transition: { staggerChildren: 0.12, delayChildren: 0.04 * i }, 18 | }), 19 | }; 20 | 21 | const child = { 22 | visible: { 23 | opacity: 1, 24 | y: 0, 25 | transition: { 26 | type: "spring", 27 | damping: 12, 28 | stiffness: 100, 29 | }, 30 | }, 31 | hidden: { 32 | opacity: 0, 33 | y: 20, 34 | transition: { 35 | type: "spring", 36 | damping: 12, 37 | stiffness: 100, 38 | }, 39 | }, 40 | }; 41 | 42 | return ( 43 | 51 | {words.map((word, index) => ( 52 | 58 | {word} 59 | 60 | ))} 61 | 62 | ); 63 | }; 64 | 65 | export default TextAnimation; 66 | -------------------------------------------------------------------------------- /src/components/animation/typing.tsx: -------------------------------------------------------------------------------- 1 | import { TypeAnimation } from "react-type-animation"; 2 | 3 | export default function Typing() { 4 | return ( 5 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/components/captions/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { Dispatch, SetStateAction, useEffect, useState } from "react"; 2 | import { setCORS } from "google-translate-api-browser"; 3 | import speakOut from "~/utils/speak"; 4 | import langs from "google-translate-api-browser/dist/languages"; 5 | 6 | const translate = setCORS("https://corsanywhere.herokuapp.com/"); 7 | 8 | type Transcription = { 9 | sender: string; 10 | message: string; 11 | senderId: string; 12 | isFinal: boolean; 13 | }; 14 | 15 | interface Props { 16 | transcriptionQueue: Transcription[]; 17 | setTranscriptionQueue: Dispatch>; 18 | languageCode: string; 19 | } 20 | 21 | const Captions: React.FC = ({ 22 | transcriptionQueue, 23 | setTranscriptionQueue, 24 | languageCode, 25 | }) => { 26 | const [caption, setCaption] = useState<{ sender: string; message: string }>(); 27 | 28 | useEffect(() => { 29 | async function translateText() { 30 | console.info("transcriptionQueue", transcriptionQueue); 31 | if (transcriptionQueue.length > 0) { 32 | const res = await translate(transcriptionQueue[0]?.message as string, { 33 | // @ts-ignore 34 | to: languageCode.split("-")[0], 35 | }); 36 | setCaption({ 37 | message: res.text, 38 | sender: transcriptionQueue[0]?.sender as string, 39 | }); 40 | const isEmpty = transcriptionQueue.length === 0; 41 | speakOut(res.text as string, isEmpty); 42 | setTranscriptionQueue((prev) => prev.slice(1)); 43 | } 44 | } 45 | translateText(); 46 | 47 | // Hide the caption after 5 seconds 48 | const timer = setTimeout(() => { 49 | setCaption({ 50 | message: "", 51 | sender: "", 52 | }); 53 | }, 5000); 54 | 55 | return () => { 56 | clearTimeout(timer); 57 | }; 58 | }, [transcriptionQueue]); 59 | 60 | return ( 61 |
62 |
63 | {caption?.message ? ( 64 | <> 65 |
{caption.sender}
66 | 67 | 68 | ) : null} 69 |
{caption?.message}
70 |
71 |
72 | ); 73 | }; 74 | 75 | export default Captions; 76 | -------------------------------------------------------------------------------- /src/components/card/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import Modal from "../modal"; 3 | import { IoDocumentTextOutline } from "react-icons/io5"; 4 | import PopAnimation from "../animation/pop"; 5 | import TextAnimation from "../animation/text"; 6 | 7 | function Card({ 8 | room, 9 | }: { 10 | room: { 11 | name: string; 12 | slug: string | null; 13 | createdAt: Date; 14 | }; 15 | }) { 16 | let [isOpen, setIsOpen] = useState(false) 17 | 18 | return ( 19 |
20 |
21 | 22 |
{room.slug || room.name}
23 | 24 |
25 | {room.createdAt.toLocaleDateString("en-US", { 26 | year: "numeric", 27 | month: "long", 28 | day: "numeric", 29 | })}{" "} 30 | at{" "} 31 | {room.createdAt.toLocaleTimeString("en-US", { 32 | hour: "numeric", 33 | minute: "numeric", 34 | hour12: true, 35 | })} 36 |
37 | 38 | 39 | 49 | 50 | 51 | {isOpen && ( 52 | 53 | )} 54 |
55 |
56 | ); 57 | } 58 | 59 | export default Card; 60 | -------------------------------------------------------------------------------- /src/components/features/index.tsx: -------------------------------------------------------------------------------- 1 | import { RiTranslate } from "react-icons/ri"; 2 | import { MdHighQuality } from "react-icons/md"; 3 | import { BsGlobe2 } from "react-icons/bs"; 4 | import { HiOutlineDocumentText, HiUserGroup } from "react-icons/hi"; 5 | import { BsFillBookmarkHeartFill } from "react-icons/bs"; 6 | import TextAnimation from "../animation/text"; 7 | import PopAnimation from "../animation/pop"; 8 | 9 | const Features = () => { 10 | const perks = [ 11 | { 12 | icon: ( 13 | 14 | ), 15 | title: "Multilingual Meeting Support", 16 | desc: "Our app allows users who speak different languages to communicate with each other. The app translates the text and speaks it out to other participants in the language they have selected.", 17 | }, 18 | { 19 | icon: ( 20 | 21 | ), 22 | title: "Real-time Translation", 23 | desc: "Our app provides real-time translation, so you can focus on the conversation without worrying about the language barrier. The translation is done quickly and accurately, ensuring smooth communication.", 24 | }, 25 | { 26 | icon: ( 27 | 31 | ), 32 | title: "Meeting Minutes", 33 | desc: "Our app automatically generates a summary of the entire meeting or conference. This feature saves time and helps ensure that all participants are on the same page.", 34 | }, 35 | { 36 | icon: ( 37 | 38 | ), 39 | title: "Large Capacity", 40 | desc: "Our app can support up to 100 concurrent users. This means that even large meetings and conferences can be easily accommodated, making it ideal for businesses, schools, and other organizations.", 41 | }, 42 | { 43 | icon: ( 44 | 48 | ), 49 | title: "HQ video and Screen Sharing", 50 | desc: "Our app provides high-quality video and screen sharing, ensuring that everyone can see and hear each other clearly. This feature helps to ensure that the meeting is productive and engaging.", 51 | }, 52 | { 53 | icon: ( 54 | 58 | ), 59 | title: "User friendly Interface", 60 | desc: "Our app has a user-friendly interface that is easy to navigate. This ensures that everyone can participate in the meeting or conference without any technical difficulties, making it ideal for users of all skill levels.", 61 | }, 62 | ]; 63 | 64 | return ( 65 |
69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
77 |
78 |
79 | 84 |
85 |
86 |
87 |
88 | {perks.map((perk, index) => ( 89 | 93 | {perk.icon} 94 | 99 |

{perk.desc}

100 |
101 | ))} 102 |
103 |
104 |
105 |
106 | ); 107 | }; 108 | 109 | export default Features; 110 | -------------------------------------------------------------------------------- /src/components/footer/index.tsx: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | import Link from "next/link"; 3 | import PopAnimation from "../animation/pop"; 4 | import TextAnimation from "../animation/text"; 5 | 6 | const Footer = () => { 7 | const links = [ 8 | { 9 | label: "Home", 10 | path: "#", 11 | }, 12 | { 13 | label: "About", 14 | path: "#about", 15 | }, 16 | { 17 | label: "Contact", 18 | path: "#contact", 19 | }, 20 | ]; 21 | return ( 22 |
23 |
24 | 25 | Logo 32 | 33 |

34 | 35 | 36 | 41 |

42 | 56 |
57 |
58 | ); 59 | }; 60 | 61 | export default Footer; 62 | -------------------------------------------------------------------------------- /src/components/join/index.tsx: -------------------------------------------------------------------------------- 1 | import { useRouter } from "next/router"; 2 | import { useState } from "react"; 3 | import { BsKeyboard } from "react-icons/bs"; 4 | import CharacterAnimation from "../animation/character"; 5 | 6 | const JoinRoom = () => { 7 | const [roomName, setRoomName] = useState(""); 8 | const router = useRouter(); 9 | return ( 10 |
11 | 24 | 25 | 34 |
35 | ); 36 | }; 37 | 38 | export default JoinRoom; 39 | -------------------------------------------------------------------------------- /src/components/loader/index.tsx: -------------------------------------------------------------------------------- 1 | import { BiLoader } from "react-icons/bi"; 2 | 3 | const Loader = ({ className }: { className?: string }) => { 4 | return ( 5 |
8 | 9 |
10 | ); 11 | }; 12 | 13 | export default Loader; 14 | -------------------------------------------------------------------------------- /src/components/modal/index.tsx: -------------------------------------------------------------------------------- 1 | import { Dispatch, SetStateAction, type FunctionComponent } from "react"; 2 | import { api } from "~/utils/api"; 3 | import { Dialog, Transition } from "@headlessui/react"; 4 | import { Fragment, useState } from "react"; 5 | import Loader from "../loader"; 6 | import Tabs from "../tabs"; 7 | 8 | type ModalProps = { 9 | setIsOpen: Dispatch>; 10 | roomName: string; 11 | visible: boolean; 12 | }; 13 | 14 | const Modal: FunctionComponent = ({ 15 | setIsOpen, 16 | roomName, 17 | visible, 18 | }) => { 19 | const { data, error, isLoading } = api.rooms.getRoomSummary.useQuery({ 20 | roomName, 21 | }); 22 | console.log(data); 23 | // input array 24 | // output array-> contents [0].utterance 25 | 26 | return ( 27 | 28 | setIsOpen(false)} 32 | > 33 | 42 |
43 | 44 | 45 |
46 |
47 | 56 | 57 | 61 | Meeting Details 62 | 63 |
64 | {isLoading ? ( 65 | 66 | ) : data ? ( 67 |
68 | {data.output[0].contents.length > 1 && ( 69 | 73 | )} 74 |
75 | ) : ( 76 |
77 | No summary available 78 |
79 | )} 80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | ); 88 | }; 89 | 90 | export default Modal; 91 | -------------------------------------------------------------------------------- /src/components/navbar/index.tsx: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | import Link from "next/link"; 3 | import CharacterAnimation from "../animation/character"; 4 | import { BiMenuAltRight as MenuIcon } from "react-icons/bi"; 5 | import { AiOutlineClose as XIcon } from "react-icons/ai"; 6 | import { useState } from "react"; 7 | import { signIn, signOut } from "next-auth/react"; 8 | import { Session } from "next-auth"; 9 | import { FcGoogle } from "react-icons/fc"; 10 | import PopAnimation from "../animation/pop"; 11 | import Loader from "../loader"; 12 | 13 | const Navbar = ({ 14 | status, 15 | session, 16 | }: { 17 | status: "loading" | "authenticated" | "unauthenticated"; 18 | session: Session | null; 19 | }) => { 20 | const links = [ 21 | { 22 | label: "Home", 23 | path: "#", 24 | }, 25 | { 26 | label: "About", 27 | path: "#about", 28 | }, 29 | { 30 | label: "Contact", 31 | path: "#contact", 32 | }, 33 | ]; 34 | 35 | const [isMenuOpen, setIsMenuOpen] = useState(false); 36 | 37 | const toggleMenu = () => { 38 | setIsMenuOpen(!isMenuOpen); 39 | }; 40 | 41 | return ( 42 | 174 | ); 175 | }; 176 | 177 | export default Navbar; 178 | -------------------------------------------------------------------------------- /src/components/splashScreen/index.tsx: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | import Loader from "../loader"; 3 | 4 | const SplashScreen = () => { 5 | return ( 6 |
7 | Logo 15 |
16 |

Jab We Meet

17 |
18 | Loading your experience... 19 | 20 |
21 |
22 |
23 | ); 24 | }; 25 | 26 | export default SplashScreen; 27 | -------------------------------------------------------------------------------- /src/components/tabs/index.tsx: -------------------------------------------------------------------------------- 1 | import { Tab } from "@headlessui/react"; 2 | 3 | function classNames(...classes: (string | undefined)[]) { 4 | return classes.filter(Boolean).join(" "); 5 | } 6 | 7 | export default function Tabs({ 8 | summary, 9 | transcriptions, 10 | }: { 11 | summary: string; 12 | transcriptions: string[]; 13 | }) { 14 | return ( 15 |
16 | 17 | 18 | 20 | classNames( 21 | "w-full rounded-lg py-2.5 text-sm font-medium leading-5 ", 22 | " ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2", 23 | selected 24 | ? "bg-secondary/10 shadow" 25 | : "text-blue-100 hover:bg-white/[0.12] hover:text-white" 26 | ) 27 | } 28 | > 29 | Summary 30 | 31 | 32 | 34 | classNames( 35 | "w-full rounded-lg py-2.5 text-sm font-medium leading-5 ", 36 | "ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2", 37 | selected 38 | ? "bg-secondary-300/10 shadow" 39 | : "text-blue-100 hover:bg-white/[0.12] hover:text-white" 40 | ) 41 | } 42 | > 43 | Transcription 44 | 45 | 46 | 47 | 48 |

{summary}

49 |
50 | 51 | {transcriptions.map((transcription: any, index) => { 52 | return ( 53 |
54 |

{transcription?.speaker}

55 |

56 | {transcription.utterance} 57 |

58 |
59 | {transcription.timestamp} 60 |
61 |
62 | ); 63 | })} 64 |
65 |
66 |
67 |
68 | ); 69 | } 70 | -------------------------------------------------------------------------------- /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 | GOOGLE_CLIENT_ID: z.string(), 23 | GOOGLE_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 | GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID, 46 | GOOGLE_CLIENT_SECRET: process.env.GOOGLE_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 | -------------------------------------------------------------------------------- /src/hooks/useTranscribe.ts: -------------------------------------------------------------------------------- 1 | import { useEffect } from "react"; 2 | import SpeechRecognition, { 3 | useSpeechRecognition, 4 | } from "react-speech-recognition"; 5 | import { api } from "~/utils/api"; 6 | 7 | type UseTranscribeProps = { 8 | roomName: string; 9 | audioEnabled: boolean; 10 | languageCode?: string; 11 | }; 12 | 13 | const useTranscribe = ({ 14 | roomName, 15 | audioEnabled, 16 | languageCode, 17 | }: UseTranscribeProps) => { 18 | const { 19 | transcript, 20 | resetTranscript, 21 | finalTranscript, 22 | browserSupportsSpeechRecognition, 23 | } = useSpeechRecognition(); 24 | 25 | const pusherMutation = api.pusher.send.useMutation(); 26 | 27 | useEffect(() => { 28 | if (finalTranscript !== "") { 29 | pusherMutation.mutate({ 30 | message: transcript, 31 | roomName: roomName, 32 | isFinal: true, 33 | }); 34 | resetTranscript(); 35 | } 36 | }, [finalTranscript]); 37 | 38 | useEffect(() => { 39 | if (audioEnabled) { 40 | SpeechRecognition.startListening({ 41 | continuous: true, 42 | language: languageCode, 43 | }); 44 | } 45 | }, [audioEnabled]); 46 | 47 | return null; 48 | }; 49 | 50 | export default useTranscribe; 51 | -------------------------------------------------------------------------------- /src/lib/Debug.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { useRoomContext } from '@livekit/components-react'; 3 | import { setLogLevel, LogLevel } from 'livekit-client'; 4 | 5 | export const useDebugMode = ({ logLevel }: { logLevel?: LogLevel }) => { 6 | setLogLevel(logLevel ?? 'debug'); 7 | const room = useRoomContext(); 8 | React.useEffect(() => { 9 | // @ts-expect-error 10 | window.__lk_room = room; 11 | 12 | return () => { 13 | // @ts-expect-error 14 | window.__lk_room = undefined; 15 | }; 16 | }); 17 | }; 18 | 19 | export const DebugMode = ({ logLevel }: { logLevel?: LogLevel }) => { 20 | useDebugMode({ logLevel }); 21 | return <>; 22 | }; 23 | -------------------------------------------------------------------------------- /src/lib/client-utils.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | 3 | export function useServerUrl(region?: string) { 4 | const [serverUrl, setServerUrl] = useState(); 5 | useEffect(() => { 6 | let endpoint = `/api/url`; 7 | if (region) { 8 | endpoint += `?region=${region}`; 9 | } 10 | fetch(endpoint).then(async (res) => { 11 | if (res.ok) { 12 | const body = await res.json(); 13 | console.log(body); 14 | setServerUrl(body.url); 15 | } else { 16 | throw Error("Error fetching server url, check server logs"); 17 | } 18 | }); 19 | }); 20 | return serverUrl; 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/serverUtils.ts: -------------------------------------------------------------------------------- 1 | import { RoomServiceClient } from "livekit-server-sdk"; 2 | 3 | export function getRoomClient(): RoomServiceClient { 4 | checkKeys(); 5 | return new RoomServiceClient(getLiveKitURL()); 6 | } 7 | 8 | export function getLiveKitURL(region?: string | string[]): string { 9 | let targetKey = "LIVEKIT_URL"; 10 | if (region && !Array.isArray(region)) { 11 | targetKey = `LIVEKIT_URL_${region}`.toUpperCase(); 12 | } 13 | const url = process.env[targetKey]; 14 | if (!url) { 15 | throw new Error(`${targetKey} is not defined`); 16 | } 17 | return url; 18 | } 19 | 20 | function checkKeys() { 21 | if (typeof process.env.LIVEKIT_API_KEY === "undefined") { 22 | throw new Error("LIVEKIT_API_KEY is not defined"); 23 | } 24 | if (typeof process.env.LIVEKIT_API_SECRET === "undefined") { 25 | throw new Error("LIVEKIT_API_SECRET is not defined"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/lib/type.ts: -------------------------------------------------------------------------------- 1 | import { LocalAudioTrack, LocalVideoTrack } from "livekit-client"; 2 | 3 | export interface SessionProps { 4 | roomName: string; 5 | identity: string; 6 | audioTrack?: LocalAudioTrack; 7 | videoTrack?: LocalVideoTrack; 8 | region?: string; 9 | turnServer?: RTCIceServer; 10 | forceRelay?: boolean; 11 | } 12 | 13 | export interface TokenResult { 14 | identity: string; 15 | accessToken: string; 16 | } 17 | -------------------------------------------------------------------------------- /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 | import "@livekit/components-styles"; 9 | import "@livekit/components-styles/prefabs"; 10 | import Head from "next/head"; 11 | 12 | const MyApp: AppType<{ session: Session | null }> = ({ 13 | Component, 14 | pageProps: { session, ...pageProps }, 15 | }) => { 16 | return ( 17 | 18 | 19 | Jab We Meet 20 | 21 | 22 | 23 | 24 | 25 | ); 26 | }; 27 | 28 | export default api.withTRPC(MyApp); 29 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/pages/api/pusher.ts: -------------------------------------------------------------------------------- 1 | import { NextApiRequest, NextApiResponse } from "next"; 2 | import { pusher } from "../../utils/pusher"; 3 | 4 | export default async function handler( 5 | req: NextApiRequest, 6 | res: NextApiResponse 7 | ) { 8 | const { message, sender } = req.body; 9 | console.log("here", message, sender); 10 | const response = await pusher.trigger("chat", "chat-event", { 11 | message, 12 | sender, 13 | }); 14 | 15 | res.json({ message: "completed" }); 16 | } 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | // @refresh reset 2 | import type { NextPage } from "next"; 3 | import { signIn, useSession } from "next-auth/react"; 4 | import { useRouter } from "next/router"; 5 | import React from "react"; 6 | import Typing from "~/components/animation/typing"; 7 | import Navbar from "~/components/navbar"; 8 | import { api } from "~/utils/api"; 9 | import { AiOutlineVideoCameraAdd } from "react-icons/ai"; 10 | import JoinRoom from "~/components/join"; 11 | import Image from "next/image"; 12 | import Features from "~/components/features"; 13 | import CharacterAnimation from "~/components/animation/character"; 14 | import { useRive, Layout, Fit, Alignment } from "@rive-app/react-canvas"; 15 | import TextAnimation from "~/components/animation/text"; 16 | import Loader from "~/components/loader"; 17 | import Footer from "~/components/footer"; 18 | import SplashScreen from "~/components/splashScreen"; 19 | 20 | function ConnectionTab() { 21 | const { data: session, status } = useSession(); 22 | const createRoom = api.rooms.createRoom.useMutation(); 23 | const router = useRouter(); 24 | const { RiveComponent: Hero } = useRive({ 25 | src: `hero.riv`, 26 | stateMachines: ["State Machine 1"], 27 | autoplay: true, 28 | layout: new Layout({ 29 | fit: Fit.FitWidth, 30 | 31 | alignment: Alignment.Center, 32 | }), 33 | }); 34 | 35 | const [roomLoading, setRoomLoading] = React.useState(false); 36 | const createRoomHandler = async () => { 37 | if (status === "unauthenticated") signIn("google"); 38 | else { 39 | setRoomLoading(true); 40 | const data = await createRoom.mutateAsync(); 41 | setRoomLoading(false); 42 | router.push(`/rooms/${data.roomName}`); 43 | } 44 | }; 45 | 46 | if (status === "loading") return ; 47 | 48 | return ( 49 | <> 50 | 51 | 52 |
53 |
54 |
55 | 61 | 66 | 67 | 75 | 76 | 77 | 78 | 79 | 80 |
81 | 82 |
83 | 84 | 85 | 90 | 91 |
92 | 105 | 106 | {!roomLoading && } 107 |
108 |
109 | 110 |
111 | 112 |
113 |
114 | 115 | 116 | 117 |
118 | 119 |
120 | 126 | 131 | 132 | 140 | 141 | 142 | 143 | 144 | 145 |
146 |
147 | 148 | ); 149 | } 150 | 151 | const Home: NextPage = () => { 152 | return ( 153 | <> 154 |
155 | 156 |
157 | 158 | ); 159 | }; 160 | 161 | export default Home; 162 | -------------------------------------------------------------------------------- /src/pages/profile.tsx: -------------------------------------------------------------------------------- 1 | import { signIn, useSession } from "next-auth/react"; 2 | import TextAnimation from "~/components/animation/text"; 3 | import Card from "~/components/card"; 4 | import Footer from "~/components/footer"; 5 | import Loader from "~/components/loader"; 6 | import Navbar from "~/components/navbar"; 7 | import SplashScreen from "~/components/splashScreen"; 8 | import { api } from "~/utils/api"; 9 | 10 | function profile() { 11 | const { data: session, status } = useSession(); 12 | const { data: rooms, isLoading, error } = api.rooms.getRoomsByUser.useQuery(); 13 | 14 | if (status === "loading") return ; 15 | if (!session && status === "unauthenticated") return signIn("google"); 16 | 17 | const ownedRooms = 18 | rooms?.filter((room) => room.OwnerId === session?.user.id) || []; 19 | const joinedRooms = 20 | rooms?.filter((room) => room.OwnerId !== session?.user.id) || []; 21 | 22 | return ( 23 | <> 24 | 25 |
26 |
27 |

28 | Hello {session?.user.name}!👋🏻 29 |

30 |
31 | 32 |
33 | 37 | {isLoading && } 38 | {ownedRooms.length === 0 && ( 39 |

40 | You haven't started a room yet 41 |

42 | )} 43 |
44 | {ownedRooms.map((room) => { 45 | return ; 46 | })} 47 |
48 |
49 | 50 |
51 | 55 | 56 | {joinedRooms.length === 0 && ( 57 |

58 | You haven't joined any rooms yet 59 |

60 | )} 61 |
62 | {joinedRooms.map((room) => { 63 | return ; 64 | })} 65 |
66 |
67 |
68 |