> ## Documentation Index
> Fetch the complete documentation index at: https://v1-learn.neoartd.my.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Backend

# Laundry Management System - Backend

A Spring Boot application that serves as the backend for a laundry management system. This application handles customer data, branches, transactions, and payment processing

## Technologies Used

* [Java 17](https://www.java.com/)
* [Spring Boot 3.4.1](https://spring.io/projects/spring-boot)
* [MySQL 8.x](https://www.mysql.com/)
* [Maven](https://maven.apache.org/)
* [Lombok](https://projectlombok.org/)
* [Spring Data JPA](https://spring.io/projects/spring-data-jpa)
* [OkHttp3](https://square.github.io/okhttp/)
* FastJSON

## Prerequisites

* JDK 17 or higher
* MySQL 8.x
* Maven 3.x
* Ngrok (for payment gateway integration)

## Installation

Several quick start options are available:

1. Clone the repo: git clone [https://github.com/initheo/Final-Project-Laundry.git](https://github.com/initheo/Final-Project-Laundry.git)
2. Run cd to the newly created `/Final-Project-Laundry/backend` [directory](#project-structure)
3. Install `java` and `maven` first if you don't have it in your machine.
4. Update the [database configuration](#database-configuration) in `application.properties`
5. Update the [payment gateway configuration](#payment-gateway-configuration) in `application.properties`
6. Update the [Ngrok configuration](#ngrok-configuration) in `application.properties`
7. Run the application using the [Maven Wrapper](#using-maven-wrapper) or [Maven](#using-maven)
8. Done Next [Frontend Installation](/series/kuliah/3/pemrograman-2/fp/frontend)

Read the [documentation page](https://docs.spring.io/spring-boot/installing.html) for more information on the framework contents, templates and examples, and more.

## Project Structure

```plaintext theme={null}
backend/ 
    ├── src/  
    ├── main/  
    │ ├── java/com/laundry/backend/
    │ │ ├── controller/ 
    │ │ ├── dto/ 
    │ │ ├── model/ 
    │ │ ├── repository/
    │ │ ├── service/ 
    │ │ └── BackendApplication.java
    │ └── resources/
    │ └── application.properties
    └── test/ 
    └── pom.xml
```

## Configuration

### Database Configuration

Update `application.properties`:

```properties theme={null}
spring.datasource.url=jdbc:mysql://localhost:3306/laundry_service
spring.datasource.username=your_username
spring.datasource.password=your_password
```

### Payment Gateway Configuration

Update `application.properties`:

```properties theme={null}
ipaymu.virtual-account=your_virtual_account
ipaymu.api-key=your_api_key
ipaymu.payment-url=payment_gateway_url

# Change the following URLs to your frontend URLs
ipaymu.return-url=<Frontend Url>/transactions?payment=success
ipaymu.cancelUrl=<Frontend Url>/transactions?payment=cancel
```

### Ngrok Configuration

Update `application.properties`:

```properties theme={null}
ngrok.authtoken=your_authtoken
ngrok.edge=your_edge_label
ngrok.edge.url=your_edge_url
```

## Running the Application

### Using Maven Wrapper

```bash theme={null}
# Build the project
./mvnw clean install

# Run the application
./mvnw spring-boot:run
```

### Using Maven

```bash theme={null}
# Build the project
mvn clean install

# Run the application
mvn spring-boot:run
```

The application will start on port `8080` by default.

## API Documentation

* [Pelanggan API](/series/kuliah/3/pemrograman-2/fp/api/pelanggan)
* [Branch API](/series/kuliah/3/pemrograman-2/fp/api/branch)
* [Voucher API](/series/kuliah/3/pemrograman-2/fp/api/voucher)
* [Transaksi API](/series/kuliah/3/pemrograman-2/fp/api/transaction)
