A comprehensive social networking platform built with modern web technologies, featuring user profiles, posts, groups, notifications, real-time chats, and more. This project is designed to replicate core functionalities of popular social networks like Facebook.
- Features
- Tech Stack
- Prerequisites
- Installation
- Usage
- API Documentation
- Project Structure
- Testing
- Contributing
- License
- User Authentication: Secure registration and login with session-based authentication using cookies
- User Profiles: Complete profile management with avatars, nicknames, about sections, and follower/following relationships
- Posts: Create, view, and interact with posts (like, comment)
- Groups: Create and manage groups, invite members, and share group-specific content
- Real-time Chats: Private messaging with WebSocket connections for instant communication
- Notifications: Real-time notifications for interactions (likes, comments, follows, etc.)
- Comments: Threaded commenting system on posts
- Events: Create and manage events within groups
- Media Upload: Support for image uploads (JPEG, PNG, GIF) with secure file handling
- Responsive Design: Mobile-first approach with responsive UI
- Real-time Updates: WebSocket integration for live chats and notifications
- Database Migrations: Automated database schema management
- Docker Support: Containerized deployment for easy setup
- RESTful API: Well-structured backend API
- Security: Input validation, authentication middleware, and secure file handling
- Language: Go 1.23
- Framework: Custom HTTP server with Gorilla WebSocket
- Database: SQLite with golang-migrate for schema management
- Authentication: Session-based with cookies
- Real-time: WebSocket for chats and notifications
- Key Libraries:
github.com/gorilla/websocket: WebSocket connectionsgithub.com/golang-migrate/migrate/v4: Database migrationsgithub.com/google/uuid: Unique identifier generationgolang.org/x/crypto: Password hashing
- Framework: Next.js 15.3.1 (React 19)
- Styling: CSS Modules with global styles
- State Management: React Context API
- HTTP Client: Fetch API with custom service layer
- Icons: React Icons
- Key Libraries:
react-cookie: Cookie management for authenticationdotenv: Environment variable management
- Containerization: Docker & Docker Compose
- Development Tools: ESLint, Make
- Testing: Go testing framework, custom test utilities
Before running this project, ensure you have the following installed:
- Docker & Docker Compose: For containerized deployment
- Node.js (v18+): For frontend development (optional, can use Docker)
- Go (v1.23+): For backend development (optional, can use Docker)
- Git: For version control
-
Clone the repository:
git clone <repository-url> cd social-network
-
Start the application:
docker-compose up --build
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
-
Navigate to backend directory:
cd backend -
Install Go dependencies:
go mod download
-
Run migrations:
go run main.go migrate
-
Start the backend server:
go run main.go
-
Navigate to frontend directory:
cd frontend -
Install Node.js dependencies:
npm install
-
Start the development server:
npm run dev
- Visit the application at http://localhost:3000
- Click on "Register" and fill in the required information:
- Password
- First Name
- Last Name
- Date of Birth
- Optional: Avatar, Nickname, About Me
- Log in to your account
- Navigate to the home page or profile
- Click "Create Post"
- Add text content and optionally upload images
- Click "Post" to share
- Browse available groups or create a new one
- Click "Join Group" to become a member
- Participate in group discussions and events
- Go to the chat section
- Select a user to start a conversation
- Send messages that appear instantly
- Visit your profile page
- Update personal information, avatar, and bio
- View your posts, followers, and following
The backend provides a comprehensive REST API. Detailed documentation for each endpoint can be found in the following files:
http://localhost:8080
Most endpoints require authentication via session cookies. Include session cookies in your requests.
social-network/
├── backend/ # Go backend application
│ ├── entity/ # Data models and entities
│ ├── internal/ # Internal packages
│ │ ├── chat/ # Chat functionality
│ │ ├── comment/ # Comment system
│ │ ├── group/ # Group management
│ │ ├── post/ # Post management
│ │ ├── server/ # HTTP server setup
│ │ └── user/ # User management
│ ├── pkg/ # Shared packages
│ │ ├── config/ # Configuration management
│ │ ├── database/ # Database connection & migrations
│ │ ├── sessions/ # Session management
│ │ └── utils/ # Utility functions
│ ├── main.go # Application entry point
│ ├── Dockerfile # Backend Docker configuration
│ └── Makefile # Backend build tasks
├── frontend/ # Next.js frontend application
│ ├── src/
│ │ ├── app/ # Next.js app router pages
│ │ ├── components/ # React components
│ │ ├── context/ # React context providers
│ │ ├── services/ # API service functions
│ │ └── utils/ # Frontend utilities
│ ├── public/ # Static assets
│ ├── package.json # Node.js dependencies
│ ├── Dockerfile # Frontend Docker configuration
│ └── next.config.mjs # Next.js configuration
├── subject/ # Project requirements and audit
├── docker-compose.yml # Docker Compose configuration
├── Makefile # Root-level tasks
└── README.md # This file
cd backend
go test ./...cd frontend
npm run lintUse the provided test utilities and Docker Compose for full integration testing.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Go best practices for backend code
- Use ESLint configuration for frontend code
- Write tests for new features
- Update documentation for API changes
- Ensure Docker compatibility
This project is developed as part of an educational assignment. Please refer to the institution's guidelines for usage and distribution.
- Developed as a collaborative project
- Backend: Go implementation with SQLite
- Frontend: Next.js with React
Note: This is an educational project demonstrating full-stack web development with modern technologies. It includes comprehensive features typical of social networking platforms while maintaining clean, maintainable code architecture.