How salem-5/studysync works
1. Top-level shape
StudySync is a two-process desktop system: a Qt client and a local C++ TCP server. They are built from the same CMake workspace, with a small shared library for common data structures.
2. Client subsystem
The client is a Qt GUI application under client/. Its entrypoint is client/src/main.cpp, which launches the main window and UI state. The client is responsible for all user interaction: login, dashboard, groups, chat, tasks, focus timer, and the AI Tutor placeholder.
3. Client UI architecture
The UI is organized into reusable pages and dialogs:
- ui/MainWindow is the shell that hosts navigation and page switching.
- Pages such as DashboardPage, GroupsPage, GroupChatPage, TasksPage, FocusPage, and AiTutorPage represent major screens.
- Widgets/dialogs like LoginWindow, CreateGroupDialog, CreateTaskDialog, EditTaskDialog, ManageMembersDialog, and NotificationsDialog handle focused workflows.
This structure is important for a diagram because the UI is not a single monolith; it is composed of multiple feature screens around a shared application state.
4. Client-side application state and language/theme
ClientState appears to hold UI/session state, while LanguageManager loads localized strings from client/resources/lang/*.json. The client also bundles theme styling and icons via Qt resources. This means presentation concerns are mostly local to the client and are separated from networking and domain logic.
5. Client networking boundary
Networking is isolated behind TcpClient, ServerAPI, and ClientNetworkManager.
- TcpClient is the transport layer for raw TCP communication.
- ServerAPI is the higher-level request/response interface used by the UI.
- ClientNetworkManager likely coordinates network calls and updates UI state.
This separation is the main client-side boundary between GUI code and backend communication.
6. Server subsystem
The server is in server/ and runs as a standalone process started locally alongside the client. Its entrypoint is server/src/main.cpp. The server owns authentication/session handling, routing of messages, and persistence.
7. Server networking and routing
TcpServer accepts client connections and feeds incoming payloads to MessageRouter. ServerRoutes.cpp defines the application-level handlers for requests such as group operations, chat messages, and task actions. The server is therefore structured as:
transport in → route/message dispatch → domain/database operations → response out.
8. Persistence layer
Database wraps SQLite access. The repo includes the SQLite amalgamation directly under server/src/sqlite and exposes the SQLite header under server/include/sqlite. This makes the server self-contained and explains why the README requires a local server: the persistent state lives in the server process and its SQLite database, not in the client.
9. Shared domain model
The shared/ directory contains DataStructures, which is the contract layer between client and server. These types likely define the request/response payloads, entities, and message formats both sides need to understand. In an architecture diagram, this is the key cross-cutting boundary: both processes depend on the same serialized data model.
10. Primary data flows
The main flow is:
user action in Qt UI → client page/dialog → ServerAPI/ClientNetworkManager → TcpClient → server TcpServer → MessageRouter/routes → Database → response back to client UI.
Most app features follow this pattern, especially groups, tasks, chat, and notifications.
11. Feature boundaries
The repo’s product features map cleanly to server-backed domains:
- Groups: create/manage groups and members
- Chat: live group messaging
- Tasks: task creation, assignment, editing
- Dashboard: aggregated view of active tasks and pinned groups
- Focus Timer: likely local/UI-driven, with less backend dependence
- AI Tutor: explicitly a placeholder, so it is a UI stub rather than an integrated backend feature
This distinction matters because not every screen has the same backend dependency.
12. Build and deployment
The whole project is CMake-based and builds both executables from the workspace root. There is no separate cloud deployment in the repo; the current architecture assumes a desktop client + locally running server model. For diagrams, depict the server as a required peer process rather than a remote SaaS dependency.
13. What to draw as the main architecture boxes
The most accurate high-level diagram would show:
- Qt desktop client
- TCP network boundary
- C++ server process
- SQLite database embedded in the server
- shared data model library used by both client and server
That captures the actual separation of responsibilities in this repository.
Main entry points: MainWindow.h Main Window · ClientNetworkManager.h Network Manager · DataStructures.h Data Structures · ServerAPI.h Server API
Components 20
Qt Client
Desktop GUI process with navigation, feature pages, and network bridge.
- Client App · Starts the desktop client and initializes UI flow.
client/src/main.cpp - Main Window · Hosts navigation and page switching for the client.
client/include/ui/MainWindow.h - Client State · Holds session and application UI state.
client/include/ui/ClientState.h - Login · Initial login workflow for the client.
client/include/ui/widget/LoginWindow.h - Dashboard · Aggregated overview of active work and pinned groups.
client/include/ui/page/DashboardPage.h - Groups · Group browsing and management screen.
client/include/ui/page/GroupsPage.h - Chat · Group messaging and chat interactions.
client/include/ui/page/GroupChatPage.h - Tasks · Task list and task workflows.
client/include/ui/page/TasksPage.h - Focus Timer · Local focus timer and productivity screen.
client/include/ui/page/FocusPage.h - AI Tutor · Placeholder feature screen without backend integration.
client/include/ui/page/AiTutorPage.h - Network Manager · Coordinates client network calls and state updates.
client/include/ClientNetworkManager.h - Server API · Higher-level interface used by the UI to call the backend.
client/include/ServerAPI.h - TCP Client · Raw TCP transport for client-server communication.
client/include/TcpClient.h - Language Manager · Loads localized strings for the client UI.
client/include/LanguageManager.h
Local Server
Standalone C++ process handling transport, routing, and persistence.
- Server App · Starts the local C++ server process.
server/src/main.cpp - TCP Server · Accepts client connections and incoming messages.
server/include/TcpServer.h - Message Router · Routes incoming payloads to application handlers.
server/include/MessageRouter.h - Server Routes · Application-level request handlers for groups, chat, and tasks.
server/src/ServerRoutes.cpp - Database · Persistence layer wrapping embedded SQLite access.
server/include/Database.h
Shared Model
Common data structures used by both processes.
- Data Structures · Common request, response, and entity types shared by both processes.
shared/include/DataStructures.h
Connections 25
- Client App → Main Window: launches · Client startup creates the main UI shell.
- Main Window → Client State: uses · UI shell reads and updates application state.
- Main Window → Login: opens · Login dialog is part of the main client flow.
- Main Window → Dashboard: navigates · Main shell switches to the dashboard screen.
- Main Window → Groups: navigates · Main shell switches to the groups screen.
- Main Window → Chat: navigates · Main shell switches to group chat.
- Main Window → Tasks: navigates · Main shell switches to task management.
- Main Window → Focus Timer: navigates · Main shell switches to the focus timer.
- Main Window → AI Tutor: navigates · Main shell can show the AI Tutor placeholder.
- Groups → Network Manager: requests · Group workflows call into the client network coordinator.
- Chat → Network Manager: requests · Chat screen sends and receives through the network layer.
- Tasks → Network Manager: requests · Task workflows use the client network coordinator.
- Dashboard → Network Manager: loads · Dashboard aggregates server-backed data through the network layer.
- Network Manager → Server API: delegates · Coordinator uses the higher-level backend API.
- Server API → TCP Client: sends · API serializes requests onto the TCP transport.
- Language Manager → Main Window: localizes · Localized strings feed the UI layer.
- Server App → TCP Server: starts · Server startup creates the TCP listener.
- TCP Server → Message Router: forwards · Incoming payloads are handed to the router.
- Message Router → Server Routes: dispatches · Router passes application requests to route handlers.
- Server Routes → Database: persists · Handlers read and write persistent state.
- Server Routes → Data Structures: uses · Routes operate on shared message and entity types.
- Server API → Data Structures: uses · Client API encodes and decodes the shared contract.
- TCP Client → TCP Server: connects · Raw network link between the desktop client and local server.
- Client App → Data Structures: uses · Client startup compiles against shared types.
- Server App → Data Structures: uses · Server startup compiles against shared types.