How mrshd3im05/social-network works
This is a Facebook-like social network: users manage profiles and follows, publish privacy-controlled posts, interact through comments and reactions, join groups and events, and chat in real time. The principal workflow runs from the browser through the frontend API client to Go handlers, business services, SQL repositories, and SQLite; WebSocket messaging provides a separate live path. The README documents the backend layer sequence and product capabilities; sampled frontend code shows chat history and live-message behavior. Other feature-level wiring is summarized from documentation, not inspected source.
Main entry points: server.go HTTP server and routes · service Business services · api.js API client · useChat.js Chat state
Components 24
Web app
- Social pages
frontend/app/(main) - Login and registration
frontend/app/(auth) - Shared UI
frontend/components - API client
frontend/lib/api.js - Chat state
frontend/lib/useChat.js - Message history
frontend/lib/useMessageHistory.js - Socket client
frontend/lib/socket.js - Frontend utilities
frontend/lib
Social API
- HTTP server and routes
backend/internal/server/server.go - Request middleware
backend/internal/middleware - Sessions and identity
backend/internal/service/authsvc/service.go - Profiles and follows
backend/internal/handler/userhandler - Posts and interactions
backend/internal/handler/posthandler/handler.go - Groups and events
backend/internal/service/groupsvc/service.go - Image files
backend/internal/service/filesvc/service.go - Message handling
backend/internal/handler/messagehandler/handler.go - Notifications
backend/internal/handler/notificationhandler/handler.go - Business services
backend/internal/service
Real-time
- WebSocket hub
backend/internal/websocket/hub.go - Live event publishing
backend/internal/websocket/publish.go - WebSocket endpoint
backend/internal/websocket/session.go
Persistence
- SQL repositories
backend/internal/repository - SQLite database
backend/internal/db/sqlite/sqlite.go
Other components
- Browser user
Connections 32
- Browser user → Social pages: uses
- Browser user → Login and registration: signs in
- Social pages → API client: requests data
- Social pages → Shared UI: presents features
- Chat state → Message history: loads history
frontend/lib/useChat.js - Message history → API client: fetches pages
frontend/lib/useMessageHistory.js - Chat state → API client: uploads messages
frontend/lib/useChat.js - Chat state → Socket client: sends and receives
frontend/lib/useChat.js - Socket client → API client: gets socket URL
frontend/lib/socket.js - Frontend utilities → API client: supports requests
frontend/lib/useChat.js - API client → HTTP server and routes: calls API
- HTTP server and routes → Request middleware: applies
- HTTP server and routes → Sessions and identity: routes auth
- HTTP server and routes → Profiles and follows: routes requests
- HTTP server and routes → Posts and interactions: routes requests
- HTTP server and routes → Groups and events: routes requests
- HTTP server and routes → Image files: routes requests
- HTTP server and routes → Message handling: routes requests
- HTTP server and routes → Notifications: routes requests
- Sessions and identity → Business services: implements rules
- Profiles and follows → Business services: applies rules
- Posts and interactions → Business services: applies rules
- Groups and events → Business services: applies rules
- Image files → Business services: applies rules
- Message handling → Business services: applies rules
- Notifications → Business services: applies rules
- Business services → SQL repositories: queries SQL
- SQL repositories → SQLite database: reads and writes
- Browser user → WebSocket endpoint: opens connection
- WebSocket endpoint → WebSocket hub: dispatches live events
- WebSocket hub → Live event publishing: publishes events
- Live event publishing → Socket client: pushes updates