The Problem
Students in classrooms with unreliable or no internet cannot share files or chat in real time. A lightweight LAN‑only messenger eliminates the need for an external network while still offering instant messaging, media sharing, and simple announcements.
What This Does
The repository ships a full‑stack web app that mimics the classic Windows Live Messenger experience. The frontend lives under frontEnd/ and is a React 19 + TypeScript UI built with Vite (frontEnd/vite.config.ts). Core UI components such as ChatPage.tsx, SignupPage.tsx, and TitleBar.tsx render the chat view, registration flow, and common header.
The backend is an Express 5 server in server/server/. It opens an HTTP listener (server/server/server.js), configures CORS, attaches a native WebSocket, and loads in‑memory stores (memory/userStore.js, memory/chatStore.js). Controllers (signinController.js, sigupController.js) and handlers (messageHandler.js, authHandler.js) process HTTP routes and socket events, while middleware (authMiddleware.js, validateMessage.js, rateLimiter.js) enforce security and request validation.
How It Is Wired
- Startup – Execution begins in
server/server/server.js. The file imports the Express app, applies CORS (app.use(cors())), registers middleware, mounts routes fromroutes/chatRoutes.js, and starts the HTTP server (app.listen). It also creates a WebSocket (new WebSocket.Server({ server })) and wires events to themessageHandlerandbroadcastService.
- Client bootstrap –
frontEnd/src/main.tsximportsApp.tsxand mounts it intoindex.html. Vite serves the bundle and hot‑reloads during development.
- Authentication flow – The client’s signup form (
SignupPage.tsx) POSTs to/api/signuphandled bysigupController.js. The controller validates the request viavalidateMessage.js, checks IP/email uniqueness usinguserStore.js, and on success creates a session cookie.
- Real‑time messaging – After login,
ChatPage.tsxopens a WebSocket connection to the server endpoint. Incoming messages triggermessageHandler.js, which writes tochatStore.jsand broadcasts to all connected sockets viabroadcastService.js. Outgoing messages from the UI are sent through the same socket and validated byvalidateMessage.js.
- Data flow hotspots –
ChatPage.tsximports 18 other modules (instability 0.95) and contains 2 351 lines, making it the most volatile component.TitleBar.tsxis a hub (12 dependents, instability 0.08); any change there has a wide blast radius. *userStore.jsandsocket.jshave multiple inbound edges but no outbound imports, so they are stable leaf nodes.
No circular dependencies were detected, so the import graph is acyclic.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/Dot-messanger.git
cd Dot-messanger
# Install backend dependencies
cd server
npm ci # uses server/package-lock.json
# Copy example env and adjust if needed
cp .example.env .env
# Start the backend (see server/package.json scripts)
node server/server.js # or npm run start if defined
# Install frontend dependencies
cd ../frontEnd
npm ci # uses frontEnd/package-lock.json
# Launch the Vite dev server (script defined in frontEnd/package.json)
npm run dev # serves http://localhost:5173
The client expects the API at the same host (default) and will automatically connect to the WebSocket endpoint provided by server.js.
Real‑World Use
A school IT admin can spin up the server on a Raspberry Pi connected to the LAN, run the commands above, and point student laptops to the Pi’s IP address. Once the React UI loads, students register with a unique school email, and the chat, file‑share, and announcement panels become instantly available without any external internet traffic.
Code Health & Issues
- HIGH – No test suite – 40 source files, zero test files.
- HIGH – Missing lockfile for root –
.vite/deps/package.jsonlacks a companion lockfile. - HIGH – No CI workflow – repository has no
.github/workflowsor other pipeline definitions. - HIGH – Wildcard CORS –
server/server/server.jscallscors()with default (allow‑all) while also enabling credentials. - MEDIUM – Dependabot disabled – three manifest files present, no update bot configured.
- LOW – Missing repository conventions – no
.editorconfig,.gitattributes, or formatter config.
Additional observations from the static analysis:
- Deep nesting and duplicated code blocks across several chat dialogs (
AddNewsDialog.tsx,PhotoPreviewDialog.tsx, etc.) increase cognitive load. ChatPage.tsxis oversized (2 351 lines) and highly unstable (imports 18 modules).validateMessage.jscontains 23 branch points in 79 lines, suggesting a refactor to a strategy table.
The Bottom Line
The project delivers a functional LAN‑only messenger with a complete UI and real‑time backend, but the codebase suffers from poor modularity, no automated testing or CI, and insecure CORS settings. It is suitable for rapid prototyping or educational environments where the team can address the highlighted health issues before production deployment.