How lucasclx/tessera-academica works
Purpose and entry points
Tessera Acadêmica is a full-stack academic-document management system: users register and are administratively managed; students/advisors collaborate on documents, comments, versions, editing sessions, and notifications. The Spring Boot API starts at backend/com.tessera/src/main/java/com/tessera/backend/Application.java; the React/Vite SPA starts at frontend/src/main.tsx and composes routes/UI in frontend/src/App.tsx.
Client application and API boundary
The frontend is a TypeScript React SPA with role-oriented dashboards and document workflows. Pages such as frontend/src/pages/DocumentViewPage.tsx, frontend/src/pages/DocumentEditPage.tsx, and frontend/src/pages/admin/AdminDashboard.tsx call the backend through the centralized API client/configuration in frontend/src/lib/api.tsx and frontend/src/config/api.tsx. Client auth, notification, and theme state are held separately in frontend/src/store/authStore.tsx, frontend/src/store/notificationStore.ts, and frontend/src/store/themeStore.ts.
Backend HTTP application layer
REST controllers expose domain operations for authentication, documents, collaboration, comments, versions, users, administration, metrics, and notifications. Key boundary adapters are backend/com.tessera/src/main/java/com/tessera/backend/controller/AuthController.java, backend/com.tessera/src/main/java/com/tessera/backend/controller/DocumentController.java, and backend/com.tessera/src/main/java/com/tessera/backend/controller/AdminController.java. DTOs isolate HTTP payloads from persistence entities; global exception mapping standardizes error responses in backend/com.tessera/src/main/java/com/tessera/backend/exception/GlobalExceptionHandler.java.
Identity, authorization, and administration
JWT authentication enters through backend/com.tessera/src/main/java/com/tessera/backend/security/JwtAuthenticationFilter.java, with token creation/validation in backend/com.tessera/src/main/java/com/tessera/backend/security/JwtTokenProvider.java; Spring security policy is configured in backend/com.tessera/src/main/java/com/tessera/backend/config/SecurityConfig.java. Auth and authorization services enforce identity, roles, permissions, registration approval, and access control: backend/com.tessera/src/main/java/com/tessera/backend/service/AuthService.java, backend/com.tessera/src/main/java/com/tessera/backend/service/AuthorizationService.java, and backend/com.tessera/src/main/java/com/tessera/backend/service/AdminService.java.
Document collaboration lifecycle
DocumentService owns document-level operations, while collaborator, comment, edit-session, and version services implement adjacent workflows: backend/com.tessera/src/main/java/com/tessera/backend/service/DocumentService.java, backend/com.tessera/src/main/java/com/tessera/backend/service/DocumentCollaboratorService.java, and backend/com.tessera/src/main/java/com/tessera/backend/service/VersionService.java. The persisted core consists of documents, document-user membership/roles, comments, and historical versions in backend/com.tessera/src/main/java/com/tessera/backend/entity/Document.java, backend/com.tessera/src/main/java/com/tessera/backend/entity/DocumentCollaborator.java, and backend/com.tessera/src/main/java/com/tessera/backend/entity/Version.java. The frontend editor is frontend/src/Editor/TiptapEditor.tsx; version comparison is represented by frontend/src/components/Versions/VersionDiff.tsx.
Realtime events and notifications
WebSocket support is configured and authenticated at backend/com.tessera/src/main/java/com/tessera/backend/config/WebSocketConfig.java and backend/com.tessera/src/main/java/com/tessera/backend/config/WebSocketAuthChannelInterceptor.java. Notification-producing domain actions flow through an application event and listener pipeline: backend/com.tessera/src/main/java/com/tessera/backend/event/NotificationEvent.java, backend/com.tessera/src/main/java/com/tessera/backend/service/NotificationEventListener.java, and backend/com.tessera/src/main/java/com/tessera/backend/service/NotificationService.java. The SPA consumes socket-driven state via frontend/src/components/providers/WebSocketProvider.tsx and displays it through frontend/src/components/Notifications/NotificationCenter.tsx.
Persistence and external infrastructure
The backend uses Maven/Spring Boot with repository-backed persistence; repository interfaces such as backend/com.tessera/src/main/java/com/tessera/backend/repository/DocumentRepository.java, backend/com.tessera/src/main/java/com/tessera/backend/repository/UserRepository.java, and backend/com.tessera/src/main/java/com/tessera/backend/repository/NotificationRepository.java separate services from the database. Runtime database, JWT, CORS, mail, cache, and related settings are environment-driven through backend/com.tessera/.env.example and backend/com.tessera/src/main/resources/application.properties. Email is an external integration represented by backend/com.tessera/src/main/java/com/tessera/backend/service/EmailService.java and backend/com.tessera/src/main/java/com/tessera/backend/config/MailConfig.java; schema evolution includes database/migrations/V2__drop_legacy_columns.sql.
Main entry points: DocumentController.java REST controllers · DocumentRepository.java Repository interfaces · NotificationService.java Notification service · DocumentEditPage.tsx Document workflows
Components 19
React SPA
- SPA entry & routes
frontend/src/main.tsx - Document workflows · Viewing, editing, admin, and version comparison UI.
frontend/src/pages/DocumentEditPage.tsx - Rich-text editor
frontend/src/Editor/TiptapEditor.tsx - API client
frontend/src/lib/api.tsx - Client state · Authentication, notifications, and theme state.
frontend/src/store/authStore.tsx - WebSocket UI bridge
frontend/src/components/providers/WebSocketProvider.tsx
Spring Boot API
- Application bootstrap
backend/com.tessera/src/main/java/com/tessera/backend/Application.java - REST controllers · Auth, document, and administration endpoints.
backend/com.tessera/src/main/java/com/tessera/backend/controller/DocumentController.java - API error mapping
backend/com.tessera/src/main/java/com/tessera/backend/exception/GlobalExceptionHandler.java - JWT security · Authenticates requests and applies Spring security policy.
backend/com.tessera/src/main/java/com/tessera/backend/security/JwtAuthenticationFilter.java - Identity & administration · Registration approval, roles, permissions, and user administration.
backend/com.tessera/src/main/java/com/tessera/backend/service/AuthService.java - Collaboration services · Documents, collaborators, comments, edit sessions, and versions.
backend/com.tessera/src/main/java/com/tessera/backend/service/DocumentService.java
Realtime & Notifications
- Authenticated WebSocket
backend/com.tessera/src/main/java/com/tessera/backend/config/WebSocketConfig.java - Notification event pipeline · Domain events are handled and turned into notifications.
backend/com.tessera/src/main/java/com/tessera/backend/event/NotificationEvent.java - Notification service
backend/com.tessera/src/main/java/com/tessera/backend/service/NotificationService.java
Persistence & Integrations
- Repository interfaces · Persistence boundary for documents, users, and notifications.
backend/com.tessera/src/main/java/com/tessera/backend/repository/DocumentRepository.java - Academic records · Documents, memberships, comments, versions, users, and notifications.
backend/com.tessera/src/main/java/com/tessera/backend/entity/Document.java - Runtime database · Schema evolves through SQL migrations.
database/migrations/V2__drop_legacy_columns.sql - Email integration
backend/com.tessera/src/main/java/com/tessera/backend/service/EmailService.java
Connections 21
- SPA entry & routes → Document workflows: renders
- Document workflows → Rich-text editor: edits documents with
- Document workflows → API client: calls
- API client → REST controllers: HTTPS API
- Client state → API client: supplies auth state
- Application bootstrap → REST controllers: starts
- REST controllers → JWT security: secured by
- REST controllers → Identity & administration: delegates identity/admin
- REST controllers → Collaboration services: delegates collaboration
- API error mapping → REST controllers: standardizes failures
- Identity & administration → Repository interfaces: reads and writes
- Collaboration services → Repository interfaces: reads and writes
- Collaboration services → Notification event pipeline: publishes
- Notification event pipeline → Notification service: handled by
- Notification service → Repository interfaces: persists notifications
- Notification service → Email integration: sends email
- Repository interfaces → Academic records: maps
- Repository interfaces → Runtime database: persists to
- WebSocket UI bridge → Authenticated WebSocket: authenticated socket
- Notification service → Authenticated WebSocket: pushes events through
- WebSocket UI bridge → Client state: updates notification state