:PROPERTIES:
:ID:       9a71daa4-d9d4-4706-98f1-72e3d4eda9bc
:END:
#+title: Server Backend
#+filetags: :server:java:api:

* Introduction
The original backend was written using FastAPI and has now been archived.

In replacement, I have written a Java Spring Boot backend that handles all of the API calls the domain ~zainezq.com~ uses.

Here is the repository for the backend:

[[https://gitea.zainezq.com/zaine/org_backend][Link to the backend repository]]


* Structure

The backend is structured as a typical Spring Boot application. It consists of several packages that handle different aspects of the application:
- **Controllers**: These classes handle incoming HTTP requests and map them to appropriate service methods.
- **Services**: These classes contain the business logic of the application.
- **Repositories**: These classes interact with the database to perform CRUD operations.
- **Models**: These classes represent the data structures used in the application.

The full list of API endpoints can be viewed using Swagger UI, which is available at the ~/swagger-ui.html~ endpoint once the application is running.

* Running the Application

The application is built using Maven. To run the application, you can utilise the ~Makefile~ provided in the repository.

The project is packaged as a Docker container, making it easy to deploy. You can build and run the Docker container using the following commands:

#+begin_src bash

  docker compose build org_backend

  docker compose up -d org_backend
    
  # To check logs

  docker logs -f org_backend
  
#+end_src
