Here is the folder structure of this app.
discord-clone/
|- actions/
|- challenge-progress.ts
|- user-progress.ts
|- user-subscription.ts
|- app/
|-- (auth)/
|--- (routes)/
|---- account/
|---- sign-in/
|---- sign-up/
|--- layout.tsx
|-- (invite)/(routes)/invite/[inviteCode]/
|-- (main)/
|--- (routes)/servers/[serverId]/
|---- channels/[channelId]/
|---- conversations/[memberId]/
|---- layout.tsx
|---- page.tsx
|--- layout.tsx
|-- (setup)/
|--- page.tsx
|-- api/
|--- channels/
|--- direct-messages/
|--- livekit/
|--- members/
|--- messages/
|--- servers/
|--- uploadthing/
|-- apple-icon.png
|-- error.tsx
|-- favicon.ico
|-- globals.css
|-- icon1.png
|-- icon2.png
|-- layout.tsx
|-- loading.tsx
|-- not-found.tsx
|- components/
|-- chat/
|-- clerk/
|-- modals/
|-- navigation/
|-- providers/
|-- server/
|-- ui/
|-- action-tooltip.tsx
|-- emoji-picker.tsx
|-- file-upload.tsx
|-- media-room.tsx
|-- mobile-toggle.tsx
|-- mode-toggle.tsx
|-- socket-indicator.tsx
|-- user-avatar.tsx
|- config/
|-- index.ts
|- hooks/
|-- use-chat-query.ts
|-- use-chat-scroll.ts
|-- use-chat-socket.ts
|-- use-modal-store.ts
|-- use-origin.ts
|- lib/
|-- conversation.ts
|-- current-profile-page.ts
|-- current-profile.ts
|-- db.ts
|-- initial-profile.ts
|-- uploadthing.ts
|-- utils.ts
|- pages/api/socket/
|-- direct-messages/
|-- messages/
|-- io.ts
|- prisma/
|-- schema.prisma
|- public/
|-- github.png
|-- logo.png
|- .env
|- .env.example
|- .eslintrc.js
|- .gitignore
|- .prettierrc.json
|- components.json
|- constants.ts
|- drizzle.config.ts
|- environment.d.ts
|- middleware.ts
|- next.config.mjs
|- package-lock.json
|- package.json
|- postcss.config.js
|- tailwind.config.ts
|- tsconfig.json
.env
file in root directory..env
:# .env
# disabled next.js telemetry
NEXT_TELEMETRY_DISABLED=1
# clerk auth keys
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLERK_SECRET_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# 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=/
# neon databse url
DATABASE_URL="postgresql://<user>:<password>@<host>:<post>/discord-clone?sslmode=require"
# uploading api key and app id
UPLOADTHING_SECRET=sk_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
UPLOADTHING_APP_ID=xxxxxxxxxxxxx
# app base url
NEXT_PUBLIC_BASE_URL=http://localhost:3000
# livekit api keys and public url
LIVEKIT_API_KEY=XXXXXXXXXXXXXXXXX
LIVEKIT_API_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NEXT_PUBLIC_LIVEKIT_URL=wss://discord-clone-xxxxxxxxxx.livekit.cloud
Next.js Telemetry Disabled:
NEXT_TELEMETRY_DISABLED
to 1
in your .env
file.Clerk Authentication Keys:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
and CLERK_SECRET_KEY
accordingly in the .env
file.Clerk Redirect URLs:
NEXT_PUBLIC_CLERK_SIGN_IN_URL
, NEXT_PUBLIC_CLERK_SIGN_UP_URL
, NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL
, and NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL
respectively in the .env
file.Neon Database URL:
DATABASE_URL
in the .env
file.Uploading API Key and App ID:
UPLOADTHING_SECRET
and UPLOADTHING_APP_ID
in the .env
file accordingly.App Base URL:
NEXT_PUBLIC_BASE_URL
to the base URL in the .env
file.LIVEKIT_API_KEY
, LIVEKIT_API_SECRET
, and NEXT_PUBLIC_LIVEKIT_URL
in the .env
file according to the obtained information.Save and Secure:
.env.local
file.Install Project Dependencies using npm install --legacy-peer-deps
or yarn install --legacy-peer-deps
.
Now app is fully configured 👍 and you can start using this app using either one of npm run dev
or yarn dev
.
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 Discord Clone.
To learn more about Next.js, take a look at the following resources:
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.
Deploying your Next.js app on Railway.app is simple and straightforward.
Sign up or Log in:
Connect Repository:
Configure Environment Variables:
Set Up Build Command:
yarn build
or npm run build
.Deploy:
Monitor Deployment:
Custom Domain (Optional):
For more detailed instructions or troubleshooting, refer to Railway documentation.
You can also give this repository a star to show more people and they can use this repository.