Kotlin Projects

Apply your Kotlin skills with console apps, Android mini projects, API integrations, and real-time applications

Console Android API Real-Time

Table of Contents

1Console Applications

Console applications run in the terminal with text-based input and output. They are ideal for learning Kotlin fundamentals — variables, control flow, functions, collections, and file I/O — without Android complexity.

Project ideas

ProjectSkills practicedDifficulty
Calculator CLIFunctions, operators, whenBeginner
Student Grade ManagerData classes, lists, file I/OBeginner
To-Do List (file-backed)Collections, read/write filesIntermediate
Quiz GameSealed classes, random, loopsIntermediate
Expense TrackerMaps, grouping, CSV exportIntermediate

Starter: Interactive Calculator

Calculator.ktfun main() { println("=== Kotlin Calculator ===") print("Enter first number: ") val a = readln().toDoubleOrNull() ?: return print("Enter operator (+, -, *, /): ") val op = readln().trim() print("Enter second number: ") val b = readln().toDoubleOrNull() ?: return val result = when (op) { "+" -> a + b "-" -> a - b "*" -> a * b "/" -> if (b != 0.0) a / b else Double.NaN else -> { println("Invalid operator"); return } } println("Result: $result") }

Starter: To-Do List with file save

TodoApp.ktimport java.io.File fun main() { val file = File("tasks.txt") val tasks = if (file.exists()) file.readLines().toMutableList() else mutableListOf() while (true) { println("\n1. List 2. Add 3. Remove 4. Save & Exit") when (readln().trim()) { "1" -> tasks.forEachIndexed { i, t -> println("${i + 1}. $t") } "2" -> { print("Task: "); tasks.add(readln()) } "3" -> { print("Index to remove: ") readln().toIntOrNull()?.let { tasks.removeAt(it - 1) } } "4" -> { file.writeLines(tasks); println("Saved!"); return } } } }

2Android Mini Projects

Android mini projects combine Kotlin with Activities, layouts or Compose, and basic persistence. Start small — one screen, one feature — then add complexity.

Recommended mini projects

Calculator App

Buttons, TextView result, basic logic — great first Android app.

Notes App

RecyclerView or LazyColumn, Room database, add/edit/delete notes.

Weather App

Retrofit API, coroutines, display temperature and conditions.

Habit Tracker

Compose UI, SharedPreferences or Room, daily streak counter.

Project structure checklist

LayerWhat to include
UIActivity + View Binding or Jetpack Compose screens
LogicViewModel with StateFlow / LiveData
DataRoom, SharedPreferences, or in-memory list
AsyncCoroutines for network or database

Starter: Counter App (Compose)

CounterScreen.kt@Composable fun CounterScreen() { var count by remember { mutableIntStateOf(0) } Column( modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { Text("Count: $count", fontSize = 32.sp) Spacer(modifier = Modifier.height(16.dp)) Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) { Button(onClick = { count-- }) { Text("-") } Button(onClick = { count++ }) { Text("+") } } } }
Build path: Start with Kotlin Android Development, then Jetpack Compose. For Room and MVVM see the Android Tutorial.

3API-Based Projects

API-based projects fetch data from REST services — news, weather, movies, GitHub repos — using Kotlin coroutines and libraries like Retrofit or Ktor Client.

Popular free APIs for practice

APIDataAuth
JSONPlaceholderFake posts, users, commentsNone
OpenWeatherMapWeather by cityFree API key
REST CountriesCountry info, flagsNone
GitHub APIRepos, users, starsOptional token
TMDBMovies, posters, ratingsFree API key

Architecture pattern

Typical API app flowUI (Compose/Activity) ↓ observes ViewModel (StateFlow) ↓ calls Repository ↓ uses Retrofit/Ktor API Service ↓ HTTP GET/POST Remote REST API

Starter: Fetch posts with Retrofit

ApiService.kt// Gradle: implementation("com.squareup.retrofit2:retrofit:2.9.0") // implementation("com.squareup.retrofit2:converter-gson:2.9.0") data class Post(val id: Int, val title: String, val body: String) interface ApiService { @GET("posts") suspend fun getPosts(): List<Post> } object RetrofitClient { val api: ApiService = Retrofit.Builder() .baseUrl("https://jsonplaceholder.typicode.com/") .addConverterFactory(GsonConverterFactory.create()) .build() .create(ApiService::class.java) }
ViewModel.ktclass PostViewModel : ViewModel() { private val _posts = MutableStateFlow<List<Post>>(emptyList()) val posts: StateFlow<List<Post>> = _posts.asStateFlow() fun loadPosts() { viewModelScope.launch { try { _posts.value = RetrofitClient.api.getPosts() } catch (e: Exception) { println("Error: ${e.message}") } } } }

Project ideas

  • News Reader — list articles, detail screen, pull-to-refresh
  • Movie Search — search TMDB, show posters with Coil/Glide
  • GitHub Profile — enter username, show repos and followers
  • Currency Converter — fetch exchange rates, convert amounts
Essentials

Use data class for JSON models, coroutines for network calls, and sealed classes for Loading/Success/Error UI state. See Coroutines and REST API Networking.

4Real-Time Kotlin Applications

Real-time applications update instantly as data changes — chat messages, live scores, stock prices, or collaborative edits. Kotlin handles real-time logic with coroutines, Flow, WebSockets, and Firebase.

Real-time technologies

TechnologyUse caseKotlin integration
Firebase Realtime DBChat, live countersFirebase Kotlin SDK + Flow
Firestore snapshotsLive document updatessnapshotFlow { }
WebSocketCustom server pushOkHttp WebSocket + coroutines
Kotlin FlowStream UI updatesStateFlow, collect
Server-Sent EventsOne-way live feedsKtor client or Retrofit

Project ideas

Chat App

Firebase or WebSocket — send/receive messages in real time.

Live Dashboard

Stream sensor or API data with Flow; update Compose UI live.

Live Score App

Poll sports API or WebSocket for match score updates.

Notification Feed

Firebase Cloud Messaging push + in-app live list.

Starter: Live counter with Flow

LiveTicker.kt — conceptimport kotlinx.coroutines.* import kotlinx.coroutines.flow.* fun tickerFlow(intervalMs: Long = 1000L): Flow<Int> = flow { var count = 0 while (true) { emit(count++) delay(intervalMs) } } fun main() = runBlocking { tickerFlow(500) .take(10) .collect { value -> println("Live value: $value") } }

Starter: Firebase-style listener pattern

Observe messages (concept)// ViewModel observing live data class ChatViewModel : ViewModel() { private val _messages = MutableStateFlow<List<ChatMessage>>(emptyList()) val messages: StateFlow<List<ChatMessage>> = _messages.asStateFlow() fun startListening() { viewModelScope.launch { chatRepository.observeMessages() .collect { newMessages -> _messages.value = newMessages } } } } data class ChatMessage(val id: String, val text: String, val timestamp: Long)

Skills checklist for real-time apps

  • Coroutines and structured concurrency — Coroutines
  • Flow and StateFlow for reactive UI updates
  • Exception handling and reconnection logic
  • Offline support and optimistic UI updates
  • Compose collectAsStateWithLifecycle() for live UI
Production tip: Always handle connection loss, show loading/error states with sealed classes, and cancel coroutine listeners in onCleared() or lifecycle scope.

5Summary Cheatsheet

Project typeBest forKey topics
Console ApplicationsLearning fundamentalsBasics, collections, file I/O
Android Mini ProjectsMobile UI and persistenceActivities, Compose, ViewModel
API-Based ProjectsNetwork and data layersRetrofit, coroutines, JSON
Real-Time ApplicationsLive updating appsFlow, Firebase, WebSocket
1

Complete console projects to master Kotlin syntax and logic.

2

Build 2–3 Android mini apps with Compose and Room.

3

Add API integration with Retrofit and MVVM architecture.

4

Challenge yourself with a real-time chat or live dashboard app.

Congratulations!

You've reached the end of the Kotlin tutorial track. Review any topic from the sidebar, explore the Android Tutorial, or return to the Technology Hub.