ConnectHub is a small social feed web app built with React, Vite, and shadcn/ui. It provides authentication, a social feed, posts (likes/saved), follows, notifications, real-time messaging, and profile management. This repository contains the client-side implementation and integration points for an API and WebSocket server.
Status: Development
Tech stack: React, Vite, JavaScript, shadcn/ui, Zustand (or Redux-like store), WebSockets (sockets/socket.js)
Key folders:
- src/app/: app bootstrap and routing
- src/layouts/: application layouts (
AuthLayout,MainLayout) - src/features/: feature modules (auth, feed, follows, notifications, posts, profile)
- src/services/: API client and endpoint definitions
- src/sockets/: WebSocket client (
socket.js) - src/state/: global state store and slices
- Email/password sign up & login flows
- Feed with posts, likes, and saved posts
- Follow/unfollow other users
- Notifications and messages views
- Profile pages with tabs
- Real-time updates via WebSockets
src/features/auth/— auth components, hooks, and servicessrc/features/feed/— feed components and hookssrc/features/posts/— create, list, like, and save postssrc/features/notifications/— notifications and messages UIsrc/features/profile/— profile UI and tabssrc/services/apiClient.js— configured Axios/fetch clientsrc/services/endpoints.js— central API endpoint constantssrc/sockets/socket.js— WebSocket connection helper
- Install dependencies
npm install- Start the dev server
npm run dev- Build for production
npm run build- Preview production build
npm run previewOther useful scripts (if available):
npm run format # run project formatterCreate a .env file at the project root (copy from .env.example if present) and provide values used by src/services/apiClient.js and socket initialization. Common variables:
VITE_API_BASE_URL— base URL for the REST APIVITE_WS_URL— WebSocket server URL for real-time updates
The client expects authentication tokens (JWT) to be returned by the API and stored/used by the auth service/hooks.
- API endpoints are centralized in src/services/endpoints.js
- The HTTP client is in src/services/apiClient.js
- WebSocket helper lives in src/sockets/socket.js and is used by notification and feed features to receive live updates.
When integrating with a backend, ensure the API follows the routes expected in endpoints.js (auth, posts, follows, notifications, profile).
- Components follow the shadcn/ui patterns and live under
src/layoutandsrc/components/ui. - Feature code is grouped under
src/features/<feature>to keep concerns isolated. - Use the provided hooks (e.g.,
useAuth.js,usePosts.js,useFeed.js) to interact with services and state.
- Fork the repo and create feature branches.
- Follow existing code style and run
npm run formatbefore submitting PRs. - Add tests for new behavior where appropriate.
- If API requests fail, verify
VITE_API_BASE_URLand CORS settings on the backend. - For socket issues, confirm
VITE_WS_URLand that the backend accepts socket connections from your origin.