- run
gradlew clean assemble jarin Spring Boot project (/spring) - Copy
devakademi-1.jarfrom/spring/build/libsto/docker-compose/spring_app(it should be in same directory with Dockerfile) - run
docker-compose -p did_i_win up -din /docker-compose directory
The docker compose will be up. mongo_seed container will populate the MongoDB container with classified.json file and will exit when it's done
The spring container will wait for localhost:27017 for mongo instance to go online with the help of wait-for-it.sh
You need to set your IPv4 address on /util/Consts.kt only if you will run it on a real device that is on the same network with host.
If you will run it on emulator, check this doc for local address
Language: Kotlin
I've setup Spring Boot (WebFlux) as backend and MongoDB for database. I've also used Kotlin Coroutines with suspend functions.
In ResourceContoller there is three endpoints.
- You can get specific item with its id
- You can get items belongs to specific seller (I was going to use this on Android side to list seller's items but time was up already)
- This is the big search.
- You can select
SellerType - You can search words in
titleit will return items that has that text in their title. Similar to LIKE query in SQL - You can arrange the price with min and max value.
- I also implemented my own pagination using MongoDB. You can fetch any page by specifying the page.
- You can select
I also containerized the project using Docker.
Caching, Pagination, Dependency Injection, Coroutines
Language: Kotlin
Libraries I've used:
- Jetpack Navigation Component with Safe-Args
- New Hilt (Dependency Injection)
- Jetpack Room for persistence database
- New Paging 3 Library
- Retrofit2
- Not library but I've used Kotlin Coroutines effectively
When app launches there is a SplashFragment with Sahibinden logo on the background. It navigates after 2 seconds. \
MainFragment will list all the items from https://devakademi.sahibinden.com/api/classified/load by default. I've used RemoteMediator from Paging3 library. It downloads the data, caches on the Room database and the displays the. It will not fetch the anymore data if there are items in database. Whenever it runs out, it will fetch the next page. \
In the bottom right corner there is a FAB. If you click it, new QueryBottomSheetDialog will pop up. You can select your filters. It will trigger the viewmodel->repository->AdNetworkPagingSpring. This flow will not be cached in Room. Becaues filtered items can be break the .prevKey and the .nextKey values.
- Category selection on android. This failed because I couldn't send categories from backend and it's so hard to hardcode on Android side
- Seller's items. I was going to implement this but caching with Paging3 took me hours the fix
- The endpoints only available for Admin
- Authorization and Authentication with Keycloak and Spring Security
- Categories. Other than that dataset was perfect. It fits all diciplinces in CS