Giter Club home page Giter Club logo

discord-clone's Introduction

Discord Clone - Real-time chat, voice, and community features in a modern, scalable Next.js 14-powered platform.

Discord Clone - Real-time chat, voice, and community features in a modern, scalable Next.js 14-powered platform.

Ask Me Anything! GitHub license Maintenance GitHub branches Github commits GitHub issues GitHub pull requests Railway status

๐Ÿ“” Table of Contents

โ€ผ๏ธ Folder Structure

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

๐Ÿงฐ Getting Started

  1. Make sure Git and NodeJS is installed.
  2. Clone this repository to your local computer.
  3. Create .env file in root directory.
  4. Contents of .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
  1. Next.js Telemetry Disabled:

    • Visit the Next.js documentation or repository.
    • Find the instructions to disable telemetry.
    • Set NEXT_TELEMETRY_DISABLED to 1 in your .env file.
  2. Clerk Authentication Keys:

    • Go to the Clerk website and sign in to your account.
    • Navigate to the settings or API keys section.
    • Generate or locate your Clerk publishable and secret keys.
    • Set NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY accordingly in the .env file.
  3. Clerk Redirect URLs:

    • Refer to the Clerk documentation or settings.
    • Set the required URLs for sign-in, sign-up, after sign-in, and after sign-up.
    • Assign these URLs to 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.
  4. Neon Database URL:

    • Access your database provider (e.g., PostgreSQL).
    • Retrieve the necessary connection details such as username, password, host, and port.
    • Construct the database URL using the obtained information and SSL mode.
    • Assign the constructed URL to DATABASE_URL in the .env file.
  5. Uploading API Key and App ID:

    • Go to the UploadThing website or application.
    • Find the section for API keys or account settings.
    • Generate or locate your secret key and app ID.
    • Set UPLOADTHING_SECRET and UPLOADTHING_APP_ID in the .env file accordingly.
  6. App Base URL:

  • Determine the base URL of your application.
  • Set NEXT_PUBLIC_BASE_URL to the base URL in the .env file.
  1. Livekit API Keys and Public URL:
  • Visit the Livekit website or dashboard.
  • Navigate to API settings or keys section.
  • Generate or locate your API key and secret.
  • Set LIVEKIT_API_KEY, LIVEKIT_API_SECRET, and NEXT_PUBLIC_LIVEKIT_URL in the .env file according to the obtained information.
  1. Save and Secure:

    • Save the changes to the .env.local file.
  2. Install Project Dependencies using npm install --legacy-peer-deps or yarn install --legacy-peer-deps.

  3. 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.

๐Ÿ“ท Screenshots

Modern UI/UX

Video Conferencing

One-on-one Chat

โš™๏ธ Tech Stack

React JS Next JS Typescript Tailwind CSS Vercel Postgresql

๐Ÿ”ง Stats

Stats for Discord Clone

๐Ÿ™Œ Contribute

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.

๐Ÿ’Ž Acknowledgements

Useful resources and dependencies that are used in Discord Clone.

โ˜• Buy Me a Coffee

๐Ÿš€ Follow Me

Follow Me Tweet about this project Subscribe to my YouTube Channel

๐Ÿ“š Learn More

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!

๐Ÿ“ƒ Deploy on Railway

Deploying your Next.js app on Railway.app is simple and straightforward.

  1. Sign up or Log in:

    • Head over to Railway.app and either sign up for a new account or log in to your existing one.
  2. Connect Repository:

    • Connect your project repository (e.g., GitHub, GitLab, Bitbucket) to Railway.
  3. Configure Environment Variables:

    • Set up your environment variables in Railway's dashboard or using their CLI. Ensure you include all required variables as per your project's configuration.
  4. Set Up Build Command:

    • Configure your build command to ensure Railway can build and deploy your Next.js app correctly. Typically, this command will be yarn build or npm run build.
  5. Deploy:

    • Trigger the deployment process either from Railway's dashboard or through their CLI.
  6. Monitor Deployment:

    • Once deployed, monitor the deployment process and check for any errors or warnings in Railway's dashboard.
  7. Custom Domain (Optional):

    • If you have a custom domain, you can set it up with Railway to point to your deployed Next.js app.

For more detailed instructions or troubleshooting, refer to Railway documentation.

โญ Give A Star

You can also give this repository a star to show more people and they can use this repository.

๐ŸŒŸ Star History

Star History Chart

(back to top)

discord-clone's People

Contributors

sanidhyy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.