Backend (Kotlin)

Backend (Kotlin/Java Spring Boot)

The backend of this project is built using Kotlin, Java, and Spring Boot. It also incorporates the Wanim Library, which is a custom library I developed. You can find the instructions and details of this library in the Wanim Library GitHub repository. I will add more detailed information about it later.

Our backend repository can be found here: Backend Repository.

Dependencies in the Backend

The backend includes the following dependencies in the build.gradle file:

dependencies {

    implementation("com.wanim_ms:wanim-library:$baseLibLatestVersion")
    
    implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation("org.springframework.boot:spring-boot-starter-jdbc")
    implementation("org.springframework.boot:spring-boot-starter-security")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.springframework.boot:spring-boot-starter-websocket")
    runtimeOnly("org.postgresql:postgresql")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
    testImplementation("org.springframework.security:spring-security-test")
    testRuntimeOnly("org.junit.platform:junit-platform-launcher")

    // JWT Dependencies
    implementation("io.jsonwebtoken:jjwt-api:0.12.6")
    implementation("io.jsonwebtoken:jjwt-impl:0.12.6")
    implementation("io.jsonwebtoken:jjwt-jackson:0.12.6")
}

API Endpoints

I won't go into the details of each dependency, but I will provide the API endpoints that are used in the backend. Some of these APIs may be outdated or not working correctly. If you find any issues, please open an issue on the GitHub Issues page and I will update the APIs accordingly.

Here are some of the key API endpoints:

ESP32 API

  • Create ESP32: Method: POST URL: http://localhost:8080/api/v1/esp32 Request Body:

  • Get ESP32 by ID: Method: GET URL: http://localhost:8080/api/v1/esp32/{id}

  • Get All ESP32 Devices: Method: GET URL: http://localhost:8080/api/v1/esp32?page=0&pageSize=10&sortOrder=ASC&sortBy=title

  • Update ESP32: Method: PUT URL: http://localhost:8080/api/v1/esp32/{id} Request Body:

  • Delete ESP32: Method: DELETE URL: http://localhost:8080/api/v1/esp32/{id}

Smart Home API

  • Create Device: Method: POST URL: {{baseUrl}}/api/devices

  • Get Device by ID: Method: GET URL: {{baseUrl}}/api/devices/:id

  • Get All Devices: Method: GET URL: {{baseUrl}}/api/devices?page=0&pageSize=10&sortOrder=DESC&sortBy=id

  • Create ESP32: Method: POST URL: {{baseUrl}}/api/v1/esp32

  • Update ESP32: Method: PUT URL: {{baseUrl}}/api/v1/esp32/:id

  • Delete ESP32: Method: DELETE URL: {{baseUrl}}/api/v1/esp32/:id

Homes API

  • Create Home: Method: POST URL: {{baseUrl}}/api/homes

  • Get Home by ID: Method: GET URL: {{baseUrl}}/api/homes/:id

  • Get All Homes: Method: GET URL: {{baseUrl}}/api/homes?page=0&pageSize=10&sortOrder=DESC&sortBy=id

  • Update Home: Method: PUT URL: {{baseUrl}}/api/homes/:id

Users API

  • Register User: Method: POST URL: {{baseUrl}}/api/users/register

  • Login User: Method: POST URL: {{baseUrl}}/api/users/login

You can refer to these API details and endpoints in your development process.

Last updated