Skip to content

Share your ideas. Build communities. Connect with developers. DevConnect is the modern social platform built by developers, for developers.

License

Notifications You must be signed in to change notification settings

preettrank53/DevConnect

Β 
Β 

Repository files navigation

DevConnect

image

image

A modern social platform for developers to share ideas, build communities, and connect with like-minded developers worldwide.

πŸ“‹ Table of Contents

🎯 Overview

DevConnect is a full-stack web application that enables developers to:

  • Create and share posts with the community
  • Form and manage communities around shared interests
  • Engage through nested comments and replies
  • Like and interact with posts
  • Discover other developers and their work

πŸ›  Tech Stack

Frontend

  • React 18 - UI library
  • TypeScript - Type safety
  • Tailwind CSS - Styling
  • React Router - Navigation
  • TanStack Query - Data fetching & caching
  • Supabase Client - Real-time database client
  • Lucide React - Icon library

Backend

  • Supabase - PostgreSQL database & authentication
  • GitHub OAuth - Social authentication

Tools & Libraries

  • Vite - Build tool
  • ESLint - Code linting
  • Prettier - Code formatting

✨ Features

  • πŸ” GitHub Authentication - Sign in with GitHub account ,Gmail based authentication
  • πŸ“ Create Posts - Share posts with images and content
  • πŸ‘€ Profile Dashboard - View user details, email, account info, and manage sessions
  • πŸ’¬ Nested Comments - Multi-level comment threads with collapse/expand
  • πŸ‘₯ Communities - Create and manage developer communities
  • ❀️ Likes System - Vote on posts and comments
  • πŸ’¬ Real-Time Messaging - Direct messages and group chats with live updates
  • πŸ“ File Sharing - Share images and files in conversations
  • πŸ”” Live Notifications - Real-time typing indicators and message notifications
  • πŸ‘€ User Presence - See who's online and their status
  • πŸ“… Event Management - Create, manage, and attend developer events and meetups
  • 🎟️ Event Registration - RSVP system with attendance tracking
  • 🌐 Virtual Events - Support for online events with meeting links
  • 🎨 Modern UI - Dark theme with cyan accents, professional design
  • πŸ“± Responsive Design - Works on desktop and mobile

πŸ“ Project Structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Navbar.tsx                 # Navigation bar
β”‚   β”œβ”€β”€ PostItem.tsx               # Individual post card
β”‚   β”œβ”€β”€ PostList.tsx               # List of all posts
β”‚   β”œβ”€β”€ PostDetail.tsx             # Full post view
β”‚   β”œβ”€β”€ CommentItem.tsx            # Individual comment
β”‚   β”œβ”€β”€ CommentSection.tsx         # Comments container
β”‚   β”œβ”€β”€ LikeButton.tsx             # Like/vote button
β”‚   β”œβ”€β”€ CommunityList.tsx          # List of communities
β”‚   β”œβ”€β”€ CommunityDisplay.tsx       # Posts in a community
β”‚   β”œβ”€β”€ CreatePost.tsx             # Post creation form
β”‚   β”œβ”€β”€ CreateCommunity.tsx        # Community creation form
β”‚   β”œβ”€β”€ MessagingInterface.tsx     # Main messaging layout
β”‚   β”œβ”€β”€ ConversationList.tsx       # Conversation sidebar
β”‚   β”œβ”€β”€ MessageList.tsx            # Message display area
β”‚   β”œβ”€β”€ MessageInput.tsx           # Message composition
β”‚   β”œβ”€β”€ ConversationHeader.tsx     # Chat header with actions
β”‚   β”œβ”€β”€ CreateConversationModal.tsx # New chat creation
β”‚   β”œβ”€β”€ MessageNotificationBadge.tsx # Unread message indicator
β”‚   β”œβ”€β”€ EventCard.tsx              # Individual event card
β”‚   β”œβ”€β”€ EventList.tsx              # List of events
β”‚   β”œβ”€β”€ EventDetail.tsx            # Full event view
β”‚   β”œβ”€β”€ CreateEventForm.tsx        # Event creation form
β”‚   β”œβ”€β”€ EventFilters.tsx           # Event filtering controls
β”‚   β”œβ”€β”€ AttendeeList.tsx           # Event attendees display
β”‚   └── EventActions.tsx           # Event interaction buttons
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ Home.tsx                   # Home page
β”‚   β”œβ”€β”€ PostPage.tsx               # Post detail page
β”‚   β”œβ”€β”€ CommunitiesPage.tsx        # Communities listing page
β”‚   β”œβ”€β”€ CommunityPage.tsx          # Single community page
β”‚   β”œβ”€β”€ CreatePostPage.tsx         # Post creation page
β”‚   β”œβ”€β”€ CreateCommunityPage.tsx    # Community creation page
β”‚   β”œβ”€β”€ MessagesPage.tsx           # Messaging interface page
β”‚   β”œβ”€β”€ EventsPage.tsx             # Events listing page
β”‚   β”œβ”€β”€ CreateEventPage.tsx        # Event creation page
β”‚   └── EventDetailPage.tsx        # Single event page
β”œβ”€β”€ context/
β”‚   β”œβ”€β”€ AuthContext.tsx            # Authentication context
|   └── ThemeContext.tsx           # Dark/light theme context 
β”œβ”€β”€ hooks/
β”‚   └── useMessaging.ts            # Messaging-related hooks
β”œβ”€β”€ types/
β”‚   β”œβ”€β”€ messaging.ts               # TypeScript interfaces for messaging
β”‚   └── events.ts                  # TypeScript interfaces for events
β”œβ”€β”€ supabase-client.ts             # Supabase configuration
β”œβ”€β”€ theme.css                      # Theme-related global styles
β”œβ”€β”€ App.tsx                        # Main app component
└── index.css                      # Global styles

πŸš€ Getting Started

Prerequisites

  • Node.js 16+ and npm/yarn
  • Git
  • A Supabase account
  • A GitHub OAuth application

Installation

  1. Clone the repository
git clone https://github.com/yourusername/devconnect.git
cd devconnect
  1. Install dependencies
npm install
  1. Create a .env file in the root directory:
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
  1. Set up GitHub OAuth
    • Go to GitHub Settings β†’ Developer settings β†’ OAuth Apps
    • Create a new OAuth App
    • Set Authorization callback URL to http://localhost:5173/auth/callback
    • Add credentials to Supabase Authentication

Environment Setup

Supabase Setup

  1. Create a new Supabase project
  2. Create tables with the following schema:

Posts Table

CREATE TABLE Posts (
  id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  title TEXT NOT NULL,
  content TEXT NOT NULL,
  image_url TEXT,
  avatar_url TEXT,
  community_id BIGINT REFERENCES Communities(id),
  user_id UUID NOT NULL,
  created_at TIMESTAMP DEFAULT NOW(),
  updated_at TIMESTAMP DEFAULT NOW()
);

Comments Table

CREATE TABLE Comments (
  id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  post_id BIGINT NOT NULL REFERENCES Posts(id),
  content TEXT NOT NULL,
  author TEXT NOT NULL,
  avatar_url TEXT,
  user_id UUID NOT NULL,
  parent_comment_id BIGINT REFERENCES Comments(id),
  created_at TIMESTAMP DEFAULT NOW()
);

Communities Table

CREATE TABLE Communities (
  id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  name TEXT NOT NULL,
  description TEXT,
  created_at TIMESTAMP DEFAULT NOW()
);

Votes Table

CREATE TABLE Votes (
  id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  post_id BIGINT NOT NULL REFERENCES Posts(id),
  user_id UUID NOT NULL,
  vote INT DEFAULT 1,
  created_at TIMESTAMP DEFAULT NOW(),
  UNIQUE(post_id, user_id)
);

Events Table

CREATE TABLE Events (
  id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  title TEXT NOT NULL,
  description TEXT NOT NULL,
  event_date TIMESTAMP NOT NULL,
  location TEXT,
  is_virtual BOOLEAN DEFAULT FALSE,
  meeting_link TEXT,
  max_attendees INTEGER,
  image_url TEXT,
  tags TEXT[],
  organizer_id UUID NOT NULL REFERENCES auth.users(id),
  community_id BIGINT REFERENCES Communities(id),
  created_at TIMESTAMP DEFAULT NOW(),
  updated_at TIMESTAMP DEFAULT NOW()
);

Event Attendees Table

CREATE TABLE EventAttendees (
  id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  event_id BIGINT NOT NULL REFERENCES Events(id) ON DELETE CASCADE,
  user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
  status TEXT DEFAULT 'attending' CHECK (status IN ('attending', 'maybe', 'not_attending')),
  registered_at TIMESTAMP DEFAULT NOW(),
  UNIQUE(event_id, user_id)
);

Messaging Tables

For the complete messaging schema including conversations, messages, reactions, and real-time features, see database-schema-messaging.sql.

Storage Setup

  • Create a bucket named post-images in Supabase Storage
  • Create a bucket named message-files in Supabase Storage (private)
  • Create a bucket named event-images in Supabase Storage (public)
  • Set post-images bucket to public
  • Set message-files bucket to private
  • Set event-images bucket to public

Running the Project

# Development
npm run dev

# Build
npm run build

# Preview build
npm run preview

# Lint
npm run lint

The app will be available at http://localhost:5173

πŸ’¬ Setting Up Messaging

For detailed instructions on setting up the real-time messaging system, see MESSAGING_SETUP.md.

Quick setup:

  1. Run the SQL schema from database-schema-messaging.sql
  2. Create the message-files storage bucket (private)
  3. Enable real-time for messaging tables
  4. Navigate to /messages to start chatting!

πŸ“… Setting Up Event Management

For detailed instructions on setting up the event management system, see the documentation in /docs/:

Quick setup:

  1. Run the SQL schema from docs/EVENT_SCHEMA.md
  2. Create the event-images storage bucket (public)
  3. Navigate to /events to start creating events!

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch
git checkout -b feature/your-feature-name
  1. Make your changes
  2. Test your changes
  3. Commit with clear messages
git commit -m "feat: add new feature description"
  1. Push to your fork
git push origin feature/your-feature-name
  1. Open a Pull Request

Areas for Contribution

  • βœ… Bug fixes
  • βœ… Feature enhancements
  • βœ… UI/UX improvements
  • βœ… Performance optimizations
  • βœ… Documentation improvements
  • βœ… Accessibility improvements

πŸ“ Code Style

TypeScript Guidelines

  • Use explicit type annotations
  • Avoid any type
  • Create interfaces for data structures
  • Use strict mode

React Guidelines

  • Use functional components with hooks
  • Keep components focused and reusable
  • Use proper TypeScript types for props
  • Avoid inline styles (use Tailwind)

Naming Conventions

  • Components: PascalCase (e.g., PostItem.tsx)
  • Functions: camelCase (e.g., fetchPosts)
  • Constants: UPPER_SNAKE_CASE (e.g., MAX_ITEMS)
  • Files: Match component/function name or use kebab-case

Formatting

# Format code
npm run format

# Lint and fix
npm run lint -- --fix

πŸ”„ Git Workflow

Commit Message Format

<type>: <subject>

<body>

<footer>

Types:

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting)
  • refactor: Code refactoring
  • perf: Performance improvements
  • test: Adding tests
  • chore: Build, dependency updates

Example:

feat: add nested comments support

Implemented multi-level comment threads with collapse/expand functionality.
Added CommentItem component to handle recursive rendering.

Closes #123

πŸ”§ Key Components

Authentication (AuthContext.tsx)

Manages user authentication state including email/password login, GitHub OAuth, logout, password reset, and profile session handling.

const { signInWithGithub, signOut, user, isLoading } = useAuth();

Posts (PostItem.tsx, PostList.tsx)

Displays individual posts and collections of posts with lazy loading.

Comments (CommentItem.tsx, CommentSection.tsx)

Handles nested comment threads with real-time updates using TanStack Query.

Like System (LikeButton.tsx)

Manages post votes with optimistic updates and cache invalidation.

Communities (CommunityList.tsx, CommunityDisplay.tsx)

Shows community listings and posts within communities.

User Account Pages

  • /signin – Email & GitHub login
  • /signup – Create account
  • /reset-password – Password recovery
  • /profile – User profile dashboard

πŸ“Š Database Schema

Key Relationships

  • Users β†’ Posts (1:N)
  • Posts β†’ Comments (1:N)
  • Comments β†’ Comments (1:N, self-referencing for nested replies)
  • Posts β†’ Communities (N:1)
  • Posts β†’ Votes (1:N)
  • Events β†’ Users (organizer_id): Many-to-One
  • Events β†’ Communities (community_id): Many-to-One (optional)
  • Events β†’ EventAttendees: One-to-Many
  • EventAttendees β†’ Users: Many-to-One

Query Patterns

Get posts with community info:

SELECT *, Communities(name) FROM Posts

Get comments with nested structure:

SELECT * FROM Comments WHERE post_id = ? ORDER BY created_at

Get likes for a post:

SELECT COUNT(*) FROM Votes WHERE post_id = ? AND vote = 1

πŸ›  Common Tasks

Adding a New Feature

  1. Create components in src/components/
  2. Create page (if needed) in src/pages/
  3. Update routing in App.tsx
  4. Add data fetching using TanStack Query
  5. Style with Tailwind CSS
  6. Test thoroughly
  7. Update documentation

Making an API Call

import { useQuery } from '@tanstack/react-query';
import { supabase } from '../supabase-client';

const { data, isLoading, error } = useQuery({
  queryKey: ['posts'],
  queryFn: async () => {
    const { data, error } = await supabase
      .from('Posts')
      .select('*')
      .order('created_at', { ascending: false });
    
    if (error) throw new Error(error.message);
    return data;
  }
});

Adding Styling

Use Tailwind CSS classes:

<div className="bg-slate-900/50 border border-slate-800 rounded-lg p-4">
  <h2 className="text-xl font-semibold text-white">Title</h2>
</div>

πŸ› Troubleshooting

Issue: "Could not find the table in schema cache"

Solution: Table names are case-sensitive. Ensure you're using the correct casing (e.g., Comments, not comments).

Issue: Images not uploading

Solution: Check that the post-images bucket exists in Supabase Storage and is set to public.

Issue: Authentication not working

Solution: Verify GitHub OAuth credentials are correctly set in Supabase and the callback URL matches your app URL.

Issue: Comments not loading

Solution: Check database permissions in Supabase. Ensure RLS policies allow reading comments.

Issue: Build errors

Solution:

# Clear node modules and reinstall
rm -rf node_modules package-lock.json
npm install
npm run build

πŸ“š Additional Resources

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ’¬ Support

Have questions?

  • Open an issue on GitHub
  • Check existing issues for solutions
  • Join our discussions

🌟 Acknowledgments

Thanks to all contributors who have helped improve DevConnect!


Happy coding! πŸš€

About

Share your ideas. Build communities. Connect with developers. DevConnect is the modern social platform built by developers, for developers.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.3%
  • PLpgSQL 3.8%
  • CSS 2.4%
  • Other 0.5%