API

Table of Contents
Why Spring Boot
For our REST API, we chose Spring Boot.
The main reason we choose this was due to the teams familiarity with the technology. As a team we concluded that we'd rather opt for a tool we're all comfortable in and that wouldn't add more risk to the whole project.
However, Spring Boot was the option for a work like this. It offers several advantages over other option like Node.js or Django:
- "convention over configuration" approach which speeds up the development process and eliminates boilerplate code
- very robust ecosystem with great dependency management
- designed to scale horizontally without a lot of changes to configuration
- java's type safety helps catch a lot of error at compile time
- great performance compared to other languages
- is very used in an enterprise setting which may help commercialization
Implementation
Endpoints
Our endpoints are the routes that the client can use to interact with the API. They implement CRUD operations (Create, Read, Update and Delete) for the different models in our application. The documentation for these endpoints will be available through Swagger. This tool allows us to document our API in a way that is easy to read and understand. It also allows us to test the endpoints directly from the documentation.
Models
The models are the classes that represent the data in our application. They are used to map the data from the database to the application. The models are also used to validate the data that is sent to the API.
Our models include (but are not limited to):
- User (Student, Tutor, Administrator)
- EPA
- Course
- MEC
By using Spring Data JPA, we can easily map these models to the database. This allows us to use the same classes for both the API and the database.
Repositories
The repositories are interfaces used for data access oeprations between the API and the database.
They allow us to use java methods instead of SQL queries and have a lot of built-in methods that make it easy to work with the data.
Services
These represent the business logic of our applciation. They are between the controllers and repositories.
Our services include (but are not limited to):
- UserService
- EPAService
- CourseService
- NotificationService
Services are very useful for separating the business logic from the controllers. This allows us to have a clean and organized codebase with good reusability and testability.
Others
Additionally, we have some other classes that are used to handle specific tasks in our application. These include:
- Config - Includes configurations for our authentication and other security features like CORS.
- DTO - Has all our Data Transfer Objects. These are used to transfer data between different layers of the application.
- Scripts - We have several sql scripts that are used to populate the database with our initial data. In the future, this data will be inserted through the API as needed.