Skip to content

Latest commit

 

History

History
352 lines (275 loc) · 15.5 KB

README.md

File metadata and controls

352 lines (275 loc) · 15.5 KB

Collaborate with your team in this Slack clone built using Next.js

Collaborate with your team in this Slack clone built using Next.js

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

📔 Table of Contents

‼️ Folder Structure

Here is the folder structure of this app.

slack-clone/
  |- convex/
    |-- _generated/
    |-- auth.config.ts
    |-- auth.ts
    |-- channels.ts
    |-- conversations.ts
    |-- http.ts
    |-- members.ts
    |-- messages.ts
    |-- reactions.ts
    |-- README.md
    |-- schema.ts
    |-- tsconfig.json
    |-- upload.ts
    |-- users.ts
    |-- workspaces.ts
  |- public/
    |-- logo.svg
  |- src/
    |-- app/
        |--- auth/
        |--- join/
        |--- workspace/
        |--- apple-icon.png
        |--- favicon.ico
        |--- globals.css
        |--- icon1.png
        |--- icon2.png
        |--- layout.tsx
        |--- page.tsx
    |-- components/
        |--- ui/
        |--- channel-hero.tsx
        |--- conversation-hero.tsx
        |--- convex-client-provider.tsx
        |--- editor.tsx
        |--- emoji-popover.tsx
        |--- hint.tsx
        |--- jotai-provider.tsx
        |--- message-list.tsx
        |--- message.tsx
        |--- modal-provider.tsx
        |--- reactions.tsx
        |--- renderer.tsx
        |--- thread-bar.tsx
        |--- thumbnail.tsx
        |--- toolbar.tsx
    |-- config/
        |--- index.ts
    |-- features/
        |--- auth/
        |--- channels/
        |--- conversations/
        |--- members/
        |--- messages/
        |--- reactions/
        |--- upload/
        |--- workspaces/
    |-- hooks/
        |--- use-channel-id.ts
        |--- use-confirm.tsx
        |--- use-member-id.ts
        |--- use-panel.ts
        |--- use-workspace-id.ts
    |-- lib/
        |--- utils.ts
    |-- middleware.ts
  |- .env.example
  |- .env.local
  |- .eslintrc.json
  |- .gitignore
  |- .prettierrc.json
  |- .prettierrc.mjs
  |- bun.lockb
  |- components.json
  |- environment.d.ts
  |- next-env.d.ts
  |- next.config.mjs
  |- package.json
  |- postcss.config.js
  |- README.md
  |- 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.local file in root directory.
  4. Contents of .env.local:
# .env.local

# disabled next.js telemetry
NEXT_TELEMETRY_DISABLED=1

# deployment used by `npx convex dev` or `bunx convex dev`
CONVEX_DEPLOYMENT=dev:<deployment-name> # team: <team-name>, project: <project-name>

# convex public url
NEXT_PUBLIC_CONVEX_URL="https://<deployment-name>.convex.cloud"
  1. Convex Deployment
  • Visit the Convex website: https://convex.dev
  • Log in to your Convex account or sign up if you don't have one.
  • Once logged in, navigate to the "Deployments" section.
  • Create a new deployment or select an existing one.
  • Replace <deployment-name>, <team-name>, and <project-name> in the .env.local file with your Convex deployment details.
  • In the Convex dashboard, find the public URL associated with your deployment.
  • Replace <your-convex-url> in the .env.local file with your Convex public URL.
  1. Initialise Convex Auth Development Keys
  • Run the initialization command: npx @convex-dev/auth or bunx @convex-dev/auth to setup your project for authenticating via the library.
  • Make sure your SITE_URL environment variable is set correctly. This is the URL where your app is hosted, e.g., http://localhost:3000 for development.
  • Your project authentication is setup for logging in with credentials.
  1. Setting Up Google OAuth

Step 1: Create a Google Cloud Project

  • Go to the Google Cloud Console.
  • Create a new project (if you don’t have one) by clicking on Select a project > New Project, and give it a name.
  • Enable the Google OAuth 2.0 API by navigating to APIs & Services > Library and searching for Google OAuth 2.0.

Step 2: Create OAuth Credentials

  • In the APIs & Services > Credentials section, click Create Credentials and choose OAuth 2.0 Client IDs.

  • Select Web Application as the application type.

  • Set the Authorized Redirect URI to your Convex callback URL. The origin (domain) of the callback URL is your Convex backend's HTTP Actions URL. You can find it in your Convex dashboard and it is similar to your CONVEX_URL, but with .site instead of .cloud.

  • After setting the redirect URI, click Create. You’ll be provided with a Client ID and Client Secret.

Step 3: Set Google OAuth Environment Variables in Convex To configure Google OAuth in your Convex backend, run the following commands with your actual values:

npx convex env set AUTH_GOOGLE_CLIENT_ID your-google-client-id
npx convex env set AUTH_GOOGLE_CLIENT_SECRET your-google-client-secret

OR

bunx convex env set AUTH_GOOGLE_CLIENT_ID your-google-client-id
bunx convex env set AUTH_GOOGLE_CLIENT_SECRET your-google-client-secret
  1. Setting Up GitHub OAuth

Step 1: Create a GitHub OAuth Application

  • Go to GitHub Developer Settings.

  • Under OAuth Apps, click New OAuth App.

  • Fill in the following:

    • Application Name: Name your app (e.g., "Slack Clone").
    • Homepage URL: Your app’s homepage URL, like http://localhost:3000 for local development.
    • Authorization Callback URL: Set this to your Convex callback URL (Similar to Google OAuth Authorized Redirect URI).
  • After registering the app, you’ll get a Client ID and Client Secret.

Step 2: Set GitHub OAuth Environment Variables in Convex

  • To configure GitHub OAuth in your Convex backend, run the following commands with your actual values:
npx convex env set AUTH_GITHUB_ID your-github-client-id
npx convex env set AUTH_GITHUB_SECRET your-github-client-secret

OR

bunx convex env set AUTH_GITHUB_ID your-github-client-id
bunx convex env set AUTH_GITHUB_SECRET your-github-client-secret
  1. Install Project Dependencies using npm install --legacy-peer-deps or yarn install --legacy-peer-deps or bun install --legacy-peer-deps.

  2. Now app is fully configured 👍 and you can start using this app using either one of npm run dev or yarn dev or bun dev.

NOTE: Please make sure to keep your API keys and configuration values secure and do not expose them publicly.

📷 Screenshots

Sign in and Sign up form using Convex Auth

Modern UI/UX

Threads and Reactions

Search Channels and DMs

⚙️ Tech Stack

React JS Next JS Typescript Tailwind CSS Vercel

🔧 Stats

Stats for Slack 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 Slack 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 Vercel

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.

⭐ 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)