Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sentinel - Unified Social Networking Platform

A modular social networking platform combining the best features of Instagram, Twitter, WhatsApp, and LinkedIn into one unified experience.

🌟 Features

πŸ“Έ Instagram-style Media

  • Photo and video sharing with beautiful galleries
  • Grid-based media display with lightbox viewing
  • Like and comment on media posts
  • Tag support for discoverability

🐦 Twitter-style Microblogging

  • Text posts and articles
  • Like, comment, and repost functionality
  • Visibility controls (public, connections, private)
  • Chronological feed (no algorithmic manipulation)

πŸ’¬ WhatsApp-style Real-time Chat

  • Instant messaging with real-time updates
  • Online presence indicators
  • Typing indicators
  • Seen/read receipts
  • Direct and group conversations

πŸ’Ό LinkedIn-style Professional Profiles

  • Professional profiles with experience and education
  • Skills endorsements
  • Connection requests and networking
  • Role-based accounts (User, Creator, Recruiter, Admin)

πŸ› οΈ Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Database: MongoDB with Mongoose
  • Real-time: Socket.IO
  • Cache/Presence: Redis
  • Styling: Tailwind CSS
  • State Management: Zustand
  • Animations: Framer Motion
  • Validation: Zod

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”œβ”€β”€ (app)/              # Protected routes
β”‚   β”‚   β”œβ”€β”€ feed/           # Main feed page
β”‚   β”‚   β”œβ”€β”€ profile/        # User profiles
β”‚   β”‚   β”œβ”€β”€ chat/           # Real-time messaging
β”‚   β”‚   └── network/        # Connections management
β”‚   β”œβ”€β”€ (auth)/             # Auth routes
β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   └── register/
β”‚   └── api/                # API Route Handlers
β”‚       β”œβ”€β”€ auth/           # Authentication endpoints
β”‚       β”œβ”€β”€ users/          # User management
β”‚       β”œβ”€β”€ network/        # Connections
β”‚       β”œβ”€β”€ posts/          # Microblogging
β”‚       β”œβ”€β”€ media/          # Media sharing
β”‚       β”œβ”€β”€ chat/           # Conversations & messages
β”‚       └── feed/           # Unified feed
β”œβ”€β”€ components/             # React components
β”‚   β”œβ”€β”€ ui/                 # Reusable UI primitives
β”‚   β”œβ”€β”€ PostCard.tsx        # Twitter-style post display
β”‚   β”œβ”€β”€ MediaGrid.tsx       # Instagram-style media grid
β”‚   β”œβ”€β”€ ChatWindow.tsx      # WhatsApp-style chat
β”‚   β”œβ”€β”€ ProfileCard.tsx     # LinkedIn-style profile
β”‚   └── ...
β”œβ”€β”€ hooks/                  # Custom React hooks
β”œβ”€β”€ lib/                    # Utilities and configurations
β”‚   β”œβ”€β”€ db.ts               # MongoDB connection
β”‚   β”œβ”€β”€ redis.ts            # Redis client & helpers
β”‚   β”œβ”€β”€ auth.ts             # Auth utilities & middleware
β”‚   └── validations.ts      # Zod schemas
β”œβ”€β”€ models/                 # Mongoose models
β”‚   β”œβ”€β”€ User.ts
β”‚   β”œβ”€β”€ Post.ts
β”‚   β”œβ”€β”€ Media.ts
β”‚   β”œβ”€β”€ Connection.ts
β”‚   β”œβ”€β”€ Conversation.ts
β”‚   └── Message.ts
β”œβ”€β”€ server/                 # Socket.IO server
β”‚   └── socket-server.ts
β”œβ”€β”€ store/                  # Zustand stores
β”‚   β”œβ”€β”€ auth-store.ts
β”‚   └── chat-store.ts
└── types/                  # TypeScript definitions
    └── index.ts

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB instance (local or Atlas)
  • Redis instance (local or cloud)
  • npm, yarn, or pnpm

Environment Setup

  1. Clone the repository:
git clone <repository-url>
cd social-media
  1. Install dependencies:
npm install
  1. Create a .env.local file based on .env.example:
cp .env.example .env.local
  1. Configure your environment variables:
# Database
MONGODB_URI=mongodb://localhost:27017/sentinel

# Redis
REDIS_URL=redis://localhost:6379

# Authentication
JWT_SECRET=your-super-secret-jwt-key-min-32-chars
JWT_EXPIRES_IN=7d

# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_SOCKET_URL=http://localhost:3001

# Optional: Cloudinary for media uploads
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret

Running the Application

  1. Development mode (runs Next.js on port 3000):
npm run dev
  1. Socket.IO server (runs on port 3001):
npm run socket
  1. Production build:
npm run build
npm start

Running with Docker (Optional)

# Start MongoDB and Redis
docker-compose up -d mongo redis

# Run the application
npm run dev

πŸ“‘ API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login user
POST /api/auth/logout Logout user
GET /api/auth/me Get current user

Users

Method Endpoint Description
GET /api/users List users
GET /api/users/[username] Get user profile
PUT /api/users/[username] Update profile
POST /api/users/[username]/experience Add experience
POST /api/users/[username]/education Add education

Network

Method Endpoint Description
POST /api/network/connect Send connection request
POST /api/network/accept Accept connection
GET /api/network/connections List connections
DELETE /api/network/[connectionId] Remove connection

Posts

Method Endpoint Description
GET /api/posts List posts
POST /api/posts Create post
GET /api/posts/[id] Get post
PUT /api/posts/[id] Update post
DELETE /api/posts/[id] Delete post
POST /api/posts/[id]/like Toggle like
POST /api/posts/[id]/comment Add comment

Media

Method Endpoint Description
GET /api/media List all media
POST /api/media Upload media
GET /api/media/[id] Get media item
DELETE /api/media/[id] Delete media
POST /api/media/[id]/like Toggle like
POST /api/media/[id]/comment Add comment
GET /api/media/user/[username] User's media gallery

Chat

Method Endpoint Description
GET /api/chat/conversation List conversations
POST /api/chat/conversation Create conversation
POST /api/chat/group Create group chat
GET /api/chat/messages/[conversationId] Get messages
POST /api/chat/messages/[conversationId] Send message
PUT /api/chat/messages/[conversationId]/seen Mark as seen

Feed

Method Endpoint Description
GET /api/feed Get unified chronological feed

πŸ”Œ Socket.IO Events

Client β†’ Server

Event Payload Description
message:send { conversationId, content } Send message
message:seen { conversationId, messageId } Mark seen
typing:start { conversationId } Start typing
typing:stop { conversationId } Stop typing
join:conversation conversationId Join room
leave:conversation conversationId Leave room

Server β†’ Client

Event Payload Description
message:new Message New message received
message:seen { messageId, userId } Message was seen
user:typing { conversationId, userId } User is typing
user:online userId User came online
user:offline userId User went offline

πŸ”’ Authentication

The platform uses JWT tokens stored in HTTP-only cookies for security:

  • Tokens are automatically included in API requests
  • Protected routes redirect to login if unauthenticated
  • Role-based access control for admin features

🎨 Theming

The platform uses a custom Tailwind theme with:

  • Primary brand colors
  • Surface colors for cards and backgrounds
  • Semantic colors (success, warning, error)
  • Custom animations (fade-in, slide-up)

πŸ“± Responsive Design

The platform is fully responsive with:

  • Mobile-first approach
  • Adaptive layouts for tablet and desktop
  • Touch-friendly interactions
  • Native-like mobile experience

πŸ§ͺ Testing

# Run unit tests
npm run test

# Run e2e tests
npm run test:e2e

πŸ“„ License

MIT License - see LICENSE for details.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

Built with ❀️ using Next.js, TypeScript, and modern web technologies.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages