How ccivam/social-media-website works
Main Components
A. Frontend Layer:
• Views (EJS templates)
• Static Assets (CSS, JavaScript, Images)
• Client-side JavaScript modules
B. Backend Layer:
• Express.js Server
• Authentication System
• API Layer (v1)
• Controllers
• Models
C. Database Layer:
• MongoDB
D. External Services:
• Google OAuth Integration
Component Relationships and Structure
[Client Browser] → [Frontend Layer] → [Backend Layer] → [Database Layer]
A. Frontend Layer (Top):
• To Static Assets (assets/)
• Client-side JavaScript modules (home_posts.js, toggle_likes.js)
B. Backend Layer (Middle):
• Express Server (Main Application)
• Authentication Module
• Local Strategy
• JWT Strategy
• Google OAuth Strategy
• API Routes (v1)
• Controllers
• Middleware
C. Database Layer (Bottom):
• MongoDB Collections
• Users
• Posts
• Comments
• Likes
Key Interactions to Highlight
A. Authentication Flow:
• Local login
• Google OAuth
• JWT token generation
B. Data Flow:
• Post creation/retrieval
• Comment management
• Like system
• File uploads (avatars)
Implementation Details
[Client Layer]
• ↓
[Frontend (Views + Assets)]
• ↓
[Authentication Layer]
• ↓
[Application Layer (Controllers + Routes)]
• ↓
[Data Layer (Models + MongoDB)]
Additional Elements
• Notes about environment configurations
• Gulp build process
• Production vs development environments