Skip to content

Backend Structure

dlee432 edited this page Mar 20, 2022 · 1 revision

Backend Structure

General Overview

The backend codebase is a Spring Boot project, with most code split between the general categories of Controllers, Domain Objects, Data Transfer Objects, Repositories, and Services. Some exceptions exist for more specific code which doesn't fit a specific category or sub-team. The contents of each category is further split by sub-team into a sub-category for easier code owner integration. These sub-categories include communication, pairing, timetable, and users. There are also files within the root directory such as pom.xml which contains information and configuration details of the project that is used by Maven to build the project. This structure is mirrored in a test directory, which also contains testing resources like SQL scripts.

Category Overviews

Config

The config folder contains files that handle web security, authentication and authorization of the user. This includes the generation of tokens, secret keys, interceptors and configuration.

Controllers

The controllers folder contains files that are used to consume Services and define endpoints and methods for the frontend to use. There are four sub-category folders in the controllers folder, consisting of communication, pairing, timetable, and users, which all respectively contain files that help with defining endpoints that are related to their sub-category.

Domain Objects

The domain folder contains files that are used for domain objects to represent entities in the application. There are three sub-category folders in the domain folder, consisting of communication, timetable, and users, which all respectively contain files that have domain objects to represent entities of the respective sub-category for the application. An example of these entities include user, buddy, and course.

DTOs

The dtos folder contains files that are used for mirroring data fields of a domain object and using it to transfer the data to the frontend. There are four sub-category folders in the dtos folder, consisting of communication, pairing, timetable, and users, which all respectively contain files that are used for mirroring data fields of domain objects related to the sub-category.

Interceptor

The interceptor folder contains a file that handles the appropriate HTTP requests and responses for the user and to add the user to the request session.

Repositories

The repositories folder contains files that are consumed by Services and handle interactions with the database. There are three sub-category folders in the repositories folder, consisting of communication, timetable, and users, which all respectively contain files that are used to handle interactions with the database that are related to their sub-category.

Services

The services folder contains files that consist of the main business logic of the application. There are four sub-category folders in the services folder, consisting of communication, pairing, timetable, and users, which all respectively contain files that contain the sub-category related logic and methods of the application.

Socket

The socket folder contains files that are needed for messaging between users. This folder contains files that help with general chat event handling, creating, sending and reading a message from a user.