How ohsync/ohsync works
Project Type and Purpose
• OHsync is a full-stack web application.
• Its primary goal is to manage and display office hours for UF professors/TAs, with a clear separation between the backend API handling business logic (including office hour management, search, LLM integration, etc.) and the frontend user interface presented in a React-like framework.
• The README and file tree confirm the separation into “apps/backend” and “apps/frontend” with dedicated entry points (index.ts for backend, App.tsx for frontend).
Analyzing the File Structure
• The project is organized under a monorepo structure with a clear division into two main components:
a. Backend (located in apps/backend)
• Contains a structured API that follows an MVC-like pattern with controllers, routers, and services (for canvas, healthCheck, llm, search, user endpoints).
• Uses middleware components (adminAuth, cache, rateLimiter, errorHandler, uflAuth) to handle common concerns.
• Incorporates a database layer with repositories, migration scripts (using Knex), seeds, and initialization scripts, indicating a relational database design.
• Includes utility functions and schemas for data validation, suggesting type safety and schema consistency.
b. Frontend (located in apps/frontend)
• A React/TSX-based application (entry point: App.tsx).
• Components organized into UI and business-specific components (e.g., account-button, feedback-dialog, tables).
• Uses external configuration such as Tailwind CSS (tailwind.config.js) for styling and a modern bundler (vite).
• Frontend: The user interface (React, UI components, pages, and services).
• Backend: The RESTful API providing endpoints for office hours, user management, canvas, search, LLM integration, and more.
• Database: The underlying relational database managed via migrations and seeds, supporting data models like users, courses, office hours, feedback, audit logs, etc.
• External/Supporting Services:
• Deployment tooling (Docker, Dockerfile, docker-compose, GitHub workflows for CI/CD).
• Package management via Bun.
• Interactions:
• Backend to the Database to show data persistence and retrieval through repositories and migration tools.
• Middleware in the backend as layers that intercept and process requests/responses.
Important Architectural Patterns and Technologies
• Layered/MVC style used in the backend:
• Controllers handle HTTP requests.
• Routers define the endpoints and delegate to controllers.
• Services contain the business logic.
• Middleware handles cross-cutting concerns like authentication, error handling, and rate limiting.
• For the frontend:
• Component-based structure that leverages React’s strengths in modular UI development.
• Integration with tools and frameworks:
• Knex for database migrations and seeds.
• Bun for dependency management and running scripts.
• Docker for containerization, ensuring environment consistency.
• Tailwind CSS for styling.
• Version control and CI/CD pipelines configured via GitHub worklows.
Instructing the Principal Software Engineer
• Component is clearly labeled:
• "Frontend (React, Vite)" for apps/frontend.
• "Backend APIs (Express/Router Pattern, Business Logic)" for apps/backend.
• "Database (Relational, managed via Knex migrations/seeds)".
• Data flow from the frontend to backend, and from backend to the database.
• The middleware chain in the backend (routing requests via error handling, rate limiter, and authentication middleware).
• Presentation layer (Frontend), service layer (Backend), and persistence layer (Database).
• Deployment and orchestration details as side notes:
• Docker integration via Dockerfile and docker-compose.
• CI/CD integration with GitHub actions.
• Bun commands for running services and managing the database.