A Facebook-like social network application built with Go (backend) and Next.js (frontend).
This project implements a comprehensive social network with features like user profiles, posts, groups, messaging, notifications, and more. It's designed with a modern architecture featuring a Go backend API and a Next.js frontend.
- User registration and login
- Session management with cookies
- Public and private profile options
- User information display
- Profile avatars and about sections
- Follow/unfollow functionality
- Private/public profile settings
- Create, view, and interact with posts
- Support for text and image content
- Privacy levels: public, almost private (followers only), private (selected followers)
- Like and comment on posts
- Create and join groups
- Group posts and comments
- Member management
- Group events with attendance tracking
- Group chat
- Real-time private messaging
- Group chat functionality
- Message status (read/unread)
- Emoji support
- Follow requests
- Group invitations
- Event creation
- Join requests
- Language: Go
- Database: SQLite
- Dependencies:
- Standard Go packages
- Gorilla WebSocket
- golang-migrate / sql-migration
- bcrypt
- uuid
- Framework: Next.js (React)
- State Management: React Hooks
- Styling: Custom CSS
- Dependencies:
- React Icons
- React components
- RESTful API endpoints
- WebSocket server for real-time features
- SQLite database with migration system
- Session-based authentication
- Next.js app router structure
- Client-side rendering for dynamic content
- WebSocket connection for real-time updates
- Responsive design for all devices
- Go (1.20+)
- Node.js (18+)
- npm or yarn
- Docker and Docker Compose (optional, for containerized setup)
-
Navigate to the backend directory:
cd backend -
Install dependencies:
go mod download -
Run the application:
go run main.goThis will start the server on port 1414.
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install -
Run the development server:
npm run devThis will start the Next.js application on port 3000.
-
Build and run using Docker Compose:
docker-compose up -dThis will set up both backend and frontend services.
POST /api/register- Create a new user accountPOST /api/login- Authenticate a userPOST /api/logout- End a user session
GET /api/user-info/{id}- Get user profile informationGET /api/authenticated-user- Get current user informationPUT /api/user-update-info- Update user profile information
GET /api/posts/{page}- Get paginated postsPOST /api/createpost- Create a new postGET /api/user-posts/{id}/{page}- Get paginated posts by user
GET /api/comment/{post_id}/{page}/{target}- Get comments for a postPOST /api/comment/create- Create a new commentPOST /api/comment/{comment_id}/like/{target}- Like a comment
POST /api/requestfollow- Send a follow requestPUT /api/acceptfollow- Accept a follow requestDELETE /api/refusefollow- Refuse a follow requestGET /api/followerlist/{userId}- Get a user's followersGET /api/followinglist/{userId}- Get users followed by a user
POST /api/createGroup- Create a new groupGET /api/groups/{page}- Get paginated groupsGET /api/group/{group_id}- Get group detailsPOST /api/group/create/post- Create a post in a groupGET /api/group/{group_id}/post/{page}- Get paginated group postsPOST /api/group/createEvent- Create a group eventGET /api/group/{group_id}/event/{page}- Get group eventsPOST /api/group/{group_id}/event/response- Respond to an event invitation
GET /api/chat/contacts- Get chat contactsGET /api/chat/{user_id}- Get messages with a userGET /api/chat/groups- Get group chatsGET /api/chat/group/{group_id}- Get group chat messages
GET /api/notifications/{page}- Get user notificationsPUT /api/notifications/{id}/see- Mark notification as seen
The application uses WebSockets for real-time features like chat and notifications. The main WebSocket endpoint is /ws.
The database uses SQLite with the following main tables:
User- User accounts and profile informationSession- Active user sessionsPost- User postsComment- Comments on postsFollow- User follow relationshipsGroup- Groups and their detailsGroup_Membership- Group member associationsGroup_Post- Posts within groupsEvent- Group eventsEvent_Response- User responses to eventsMessage- Private and group messagesNotification- User notificationsLike- Post, comment, and group post likes
This project is for educational purposes.
This social network project was developed by: