All Blogs

Test with Testify and Mockery in Go

Test with Testify and Mockery in Go

In Go, we write unit tests with Testify, a toolkit for assertions and mocks, and Mockery, which auto-generates mocks for our interfaces.

Go JWT Authentication Middleware

Go JWT Authentication Middleware

A JWT Authentication Middleware in Go checks the JSON Web Token of every request before it reaches the handler, without any database query to verify it.

Go Backend Clean Architecture

Go Backend Clean Architecture

Clean architecture in a Go backend splits the project into five layers, which are Router, Controller, Usecase, Repository, and Domain. Let's learn it with a project.

StateFlow and SharedFlow

StateFlow and SharedFlow

StateFlow and SharedFlow are Hot Flows in Kotlin. StateFlow needs an initial value and keeps only the latest value, whereas SharedFlow can replay many values.

Cold Flow vs Hot Flow

Cold Flow vs Hot Flow

A Cold Flow emits data only when there is a collector and starts fresh for each one. A Hot Flow emits data even without collectors and shares it with all of them.

Unit Testing ViewModel with Kotlin Flow and StateFlow

Unit Testing ViewModel with Kotlin Flow and StateFlow

To unit test a ViewModel with Kotlin Flow and StateFlow, we mock the data layer, use a test dispatcher, and verify the StateFlow values using Turbine.

How does the Kotlin Multiplatform work?

How does the Kotlin Multiplatform work?

In Kotlin Multiplatform, we write shared code once in Kotlin. It becomes Java bytecode for Android and native code inside a framework for iOS.

RxJava Subject - Publish, Replay, Behavior, and Async

RxJava Subject - Publish, Replay, Behavior, and Async

A Subject in RxJava acts as both an Observer and an Observable. Publish, Replay, Behavior, and Async Subjects differ in which items a new subscriber gets.

OkHttp Interceptor

OkHttp Interceptor

OkHttp Interceptors are a mechanism that can monitor, rewrite, and retry API calls. We use them for logging, caching, adding headers, and refreshing tokens.