A feature-rich social network application designed to mimic core functionalities of platforms like Facebook, built with a Go backend and a Vue.js frontend, using SQLite for data persistence. The entire application is containerized using Docker for easy setup and deployment.
This application implements the following core functionalities:
- Registration/Login: Users can create an account with email, password, first name, last name, and date of birth. Optional fields include Avatar/Image, Nickname, and "About Me".
- Authentication: Uses Sessions and Cookies to maintain user login state.
- Profiles: Displays user information, activity (posts), followers, and following lists.
- Profile Privacy: Supports Public and Private profiles. Private profiles are only visible to their followers.
- Following: Users can follow/unfollow others. Following a private profile requires a follow request that must be accepted. Following a public profile is instant.
- Posts & Comments: Users can create posts and comments, optionally including an image or GIF.
- Post Privacy: Posts can be set to Public, Almost Private (followers only), or Private (select followers only).
- Group Creation: Users can create groups with a title and description.
- Joining Groups: Members can be invited or can request to join (requires creator approval).
- Group Content: Groups have their own posts and comments, visible only to members.
- Events: Group members can create events with a Title, Description, and Day/Time. Users can RSVP with "Going" or "Not Going".
- Private Chat: Users can send real-time private messages to users they follow or are followed by, using WebSockets.
- Group Chat: Common chat room for all group members, also using WebSockets.
- Emojis: Support for sending emojis in chats.
- A dedicated notification system for real-time alerts on:
- Private profile follow requests.
- Group invitations.
- Requests to join groups (for the group creator).
- Group event creations.
| Component | Technology | Description |
|---|---|---|
| Backend | Go (Golang) | Handles API requests, business logic, authentication, and WebSocket connections. |
| Frontend | Vue.js | Client-side rendering for the user interface and interactivity. |
| Database | SQLite | Lightweight, file-based SQL database for data persistence. |
| Containerization | Docker | Used to package and run the Backend and Frontend in separate, isolated containers. |
| Migrations | golang-migrate | Used to manage and apply database schema changes. |
These instructions will guide you through setting up and running the project using Docker and Docker Compose.
You need to have Docker and Docker Compose installed on your system.
- Install Docker
- Install Docker Compose (Often bundled with Docker Desktop)
-
Clone the repository:
git clone [[your_repo_link](https://github.com/ABouziani/social-network.git)] cd [social-network] -
Build and Run with Docker Compose: Execute the following command in the root directory of the project. This command will:
- Build the
backendDocker image (usingDockerfile.backend). - Build the
frontendDocker image (usingDockerfile.frontend). - Create and start both containers as defined in
docker-compose.yml.
docker-compose up --build
Note: The Go backend will automatically run the SQLite database migrations (
golang-migrate) on startup before starting the server. This ensures the necessary tables are created. - Build the
-
Access the Application:
- The Frontend (Vue.js) will be available at:
http://localhost:[FRONTEND_PORT](Checkdocker-compose.ymlfor the exact port, e.g.,http://localhost:8080). - The Backend (Go API) will be running and listening on a separate port for internal communication (e.g.,
[BACKEND_PORT]).
- The Frontend (Vue.js) will be available at:
-
Stop the Application: To stop and remove the running containers, press
Ctrl+Cin the terminal wheredocker-compose upis running, then execute:docker-compose down
The database schema is managed via the golang-migrate package.
- Migration files are stored in a dedicated directory within the Go project (
backend/pkg/db/migrations/sqlite/). - The logic in the database package (
sqlite.go) handles the connection and automatic application of these migrations upon application startup.
Image files (JPEG, PNG, GIF) are handled by:
- Storing the actual image files on the backend file system (e.g., a dedicated
assets/imagesfolder within the container volume). - Storing the file path or a unique identifier in the SQLite database.
A dedicated Go package manages WebSockets connections. This enables:
- Instant Private Messaging: Messages are pushed immediately to the recipient.
- Instant Group Chat: Messages are broadcast to all group members in real-time.
- Live Notifications: Real-time delivery of notifications across the application.
The Vue.js application is responsible for the user interface and interactivity.
- It uses the Fetch API to make HTTP requests to the Go backend API.
- It uses a WebSocket client library to establish and manage the persistent, real-time connections required for chat and notifications.