Here is the folder structure of this app.
gamehub/
|- app/
|-- (auth)/
|--- _components/
|--- sign-in/[[...sign-in]]/
|--- sign-up/[[...sign-up]]/
|--- layout.tsx
|-- (browser)/
|--- _components/
|--- (home)/
|--- [username]/
|--- search/
|--- layout.tsx
|-- (dashboard)/u/[username]/
|--- _components/
|--- (home)/
|--- chat/
|--- community/
|--- keys/
|--- layout.tsx
|-- api/
|--- uploadthing/
|---- core.ts
|---- route.ts
|--- webhooks/
|---- clerk/
|----- route.ts
|---- livekit/
|----- route.ts
|--- page.tsx
|-- error.tsx
|-- favicon.ico
|-- globals.css
|-- layout.tsx
|-- not-found.tsx
|- components/
|-- stream-player/
|-- ui/
|-- hint.tsx
|-- live-badge.tsx
|-- theme-provider.tsx
|-- thumbnail.tsx
|-- user-avatar.tsx
|-- verified-mark.tsx
|- config/
|-- site.ts
|- hooks/
|-- use-viewer-token.ts
|- lib/
|-- auth-service.ts
|-- block-service.ts
|-- db.ts
|-- feed-service.ts
|-- follow-service.ts
|-- recommended-service.ts
|-- search-service.ts
|-- stream-service.ts
|-- uploadthing.ts
|-- user-service.ts
|-- utils.ts
|- prisma/
|-- schema.prisma
|- public/
|-- logo.svg
|- store/
|-- use-chat-sidebar.tsx
|-- use-creator-sidebar.tsx
|-- use-sidebar.tsx
|- .env
|- .env.example
|- .eslintrc.json
|- .gitignore
|- components.json
|- middleware.ts
|- next.config.js
|- package-lock.json
|- package.json
|- postcss.config.js
|- tailwind.config.ts
|- tsconfig.json
- Make sure Git and NodeJS is installed.
- Clone this repository to your local computer.
- Create
.env
file in root directory. - Contents of
.env
:
# .env
# clerk auth credentials
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLERK_SECRET_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLERK_WEBHOOK_SECRET=whsec_XXXXXXXXXXXXXXXXXXXXXXXX
# clerk redirect urls
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
# mysql db uri
DATABASE_URL="mysql://127.0.0.1/gamehub?ssl-mode=REQUIRED"
# livekit keys
LIVEKIT_API_KEY=XXXXXXXXXXXXXXXXXXXX
LIVEKIT_API_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# livekit uris
LIVEKIT_API_URL=https://gamehub-xxxxxxxxxxxxxxx.livekit.cloud
NEXT_PUBLIC_LIVEKIT_WS_URL=wss://gamehub-xxxxxxxxxxxxxxx.livekit.cloud
# app base url
NEXT_PUBLIC_BASE_URL=http://localhost:3000
# uploadthing keys
UPLOADTHING_SECRET=sk_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
UPLOADTHING_APP_ID=XXXXXXXXX
- Clerk Redirect URLs
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
- MySQL DB URI
DATABASE_URL="mysql://127.0.0.1/gamehub?ssl-mode=REQUIRED"
- Livekit Keys
To obtain Livekit keys, follow these steps:
-
Sign up for a Livekit account:
- Visit Livekit Signup to create an account.
-
Create a new project:
- Log in to your Livekit account.
- Go to the dashboard and create a new project.
-
Get API Key and Secret:
- Once the project is created, navigate to the project settings.
- Find or generate API Key and Secret.
LIVEKIT_API_KEY=XXXXXXXXXXXXXXXXXXXX
LIVEKIT_API_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Livekit URIs
LIVEKIT_API_URL=https://gamehub-xxxxxxxxxxxxxxx.livekit.cloud
NEXT_PUBLIC_LIVEKIT_WS_URL=wss://gamehub-xxxxxxxxxxxxxxx.livekit.cloud
- App Base URL
NEXT_PUBLIC_BASE_URL=http://localhost:3000
- Uploadthing Keys
To obtain Uploadthing keys, follow these steps:
-
Sign up for an Uploadthing account:
- Visit Uploadthing Signup to create an account.
-
Create a new application:
- Log in to your Uploadthing account.
- Navigate to the dashboard and create a new application.
-
Get Secret and App ID:
- Once the application is created, find or generate the Secret and App ID.
UPLOADTHING_SECRET=sk_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
UPLOADTHING_APP_ID=XXXXXXXXX
-
Open terminal in root directory. Run
npm install --legacy-peer-deps
oryarn install --legacy-peer-deps
. -
Now app is fully configured 👍 and you can start using this app using
npm run dev
oryarn dev
.
- Clerk Documentation: Clerk Documentation
- Stripe Documentation: Stripe Documentation
- Aiven Documentation: Aiven Documentation
- Prisma Documentation: Prisma Documentation
- LiveKit Components React Documentation: LiveKit Components React Documentation
- Radix UI Avatar Documentation: Radix UI Avatar Documentation
- Radix UI Dialog Documentation: Radix UI Dialog Documentation
- Radix UI Label Documentation: Radix UI Label Documentation
- Radix UI Scroll Area Documentation: Radix UI Scroll Area Documentation
- Radix UI Select Documentation: Radix UI Select Documentation
- Radix UI Separator Documentation: Radix UI Separator Documentation
- Radix UI Slider Documentation: Radix UI Slider Documentation
- Radix UI Slot Documentation: Radix UI Slot Documentation
- Radix UI Switch Documentation: Radix UI Switch Documentation
- Radix UI Tooltip Documentation: Radix UI Tooltip Documentation
- Tanstack React Table Documentation: Tanstack React Table Documentation
- UploadThing React Documentation: UploadThing React Documentation
- Class Variance Authority Documentation: Class Variance Authority Documentation
- clsx Documentation: clsx Documentation
- date-fns Documentation: date-fns Documentation
- jwt-decode Documentation: jwt-decode Documentation
- LiveKit Client Documentation: LiveKit Client Documentation
- LiveKit Server SDK Documentation: LiveKit Server SDK Documentation
- Lucide React Documentation: Lucide React Documentation
- Next.js Documentation: Next.js Documentation
- Next Themes Documentation: Next Themes Documentation
- query-string Documentation: query-string Documentation
- React Documentation: React Documentation
- React DOM Documentation: React DOM Documentation
- Sonner Documentation: Sonner Documentation
- SVIX Documentation: SVIX Documentation
- Tailwind Merge Documentation: Tailwind Merge Documentation
- Tailwind CSS Animate Documentation: Tailwind CSS Animate Documentation
- UploadThing Documentation: UploadThing Documentation
- useHooks-ts Documentation: useHooks-ts Documentation
- UUID Documentation: UUID Documentation
- Zustand Documentation: Zustand Documentation
NOTE: Please make sure to keep your API keys and configuration values secure and do not expose them publicly.
You might encounter some bugs while using this app. You are more than welcome to contribute. Just submit changes via pull request and I will review them before merging. Make sure you follow community guidelines.
Useful resources and dependencies that are used in GameHub.
- Thanks to CodeWithAntonio: https://codewithantonio.com/
- @clerk/nextjs: ^4.27.6
- @clerk/themes: ^1.7.9
- @livekit/components-react: ^1.5.0
- @prisma/client: ^5.7.0
- @radix-ui/react-avatar: ^1.0.4
- @radix-ui/react-dialog: ^1.0.5
- @radix-ui/react-label: ^2.0.2
- @radix-ui/react-scroll-area: ^1.0.5
- @radix-ui/react-select: ^2.0.0
- @radix-ui/react-separator: ^1.0.3
- @radix-ui/react-slider: ^1.1.2
- @radix-ui/react-slot: ^1.0.2
- @radix-ui/react-switch: ^1.0.3
- @radix-ui/react-tooltip: ^1.0.7
- @tanstack/react-table: ^8.10.7
- @uploadthing/react: ^6.0.2
- class-variance-authority: ^0.7.0
- clsx: ^2.0.0
- date-fns: ^2.30.0
- jwt-decode: ^4.0.0
- livekit-client: ^1.15.4
- livekit-server-sdk: ^1.2.7
- lucide-react: ^0.294.0
- next: 14.0.4
- next-themes: ^0.2.1
- query-string: ^8.1.0
- react: ^18
- react-dom: ^18
- sonner: ^1.2.4
- svix: ^1.15.0
- tailwind-merge: ^2.1.0
- tailwindcss-animate: ^1.0.7
- uploadthing: ^6.1.0
- usehooks-ts: ^2.9.1
- uuid: ^9.0.1
- zustand: ^4.4.7
- @types/node: ^20
- @types/react: ^18
- @types/react-dom: ^18
- autoprefixer: ^10.0.1
- eslint: ^8
- eslint-config-next: 14.0.4
- postcss: ^8
- prisma: ^5.7.0
- tailwindcss: ^3.3.0
- typescript: ^5
- @types/node: ^20
- @types/react: ^18
- @types/react-dom: ^18
- autoprefixer: ^10.0.1
- eslint: ^8
- eslint-config-next: 14.0.4
- postcss: ^8
- prisma: ^5.7.0
- tailwindcss: ^3.3.0
- typescript: ^5
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out Next.js deployment documentation for more details.
You can also give this repository a star to show more people and they can use this repository.
```