https://kotlinlang.org logo
Join SlackCommunities
Powered by
# server
  • t

    Tanmay Shree

    12/08/2024, 9:29 AM
    Hello everyone, I'm looking for a guidance or resource for web scraping in kotlin/kmp, can someone guide me regarding that? also if you have any playlist or so pls do recommend. Thanks.
    p
    d
    • 3
    • 2
  • n

    Nick

    12/11/2024, 5:54 PM
    Has anyone had success using
    kotlinx-serialization
    in a Spring app? I haven't found an easy way to return nice, formatted HTTP responses when serialization fails for some reason. For example, a user sends a request, making a String field null when it should not be null. Since it should not be null, I want to model it in my domain as a non-nullable String, but if I do, kotlinx-serialization will throw a a serialization exception which is difficult to handle in a way that can programmatically discern the reason why serialization failed and send that back in a user-friendly response. • Example:
    Copy code
    {
      "code": "400",
      "name": "Bad Request",
      "description": "field 'name' cannot be null"
    }
    I end up having to do something like
    Copy code
    data class User(name: String? = null)
    and then validate that it's not null after serialization Wish there was a way to intercept the request before serialization, and check for any null values that should not be null, and return a nice, user-readable error in response.
    c
    d
    k
    • 4
    • 3
  • i

    Irfan

    12/11/2024, 6:39 PM
    Hello, I am working on a multi-tenant system where users can belong to multiple tenants simultaneously. This results in a many-to-many relationship between users and tenants, with roles and policies varying per tenant. During authentication, an access token is generated containing the user's roles and policies for each tenant. However, due to the large number of tenants and roles/policies, the token payload can grow significantly, potentially leading to inefficiencies in transmission, and authorization performance. The challenge is to manage this token size while ensuring efficient authorization. Possible solutions that i am considering are - 1. Storing only a reference to the user's tenants in the token (e.g., user ID, tenant IDs), and dynamically fetching roles and policies for each tenant during reosurce authorization. But that would involve db calls at each authorization request which seems inefficient. 2. Storing only minimal claims (e.g., user ID, tenant ID) in the token and dynamically loading roles/policies during resource authorization from a cache which involves loading polices/roles in cache on successful authentication and invalidating it on logout. 3. Using rule engine during authorisation which i am not very keen about. This doesn’t seem like an uncommon problem, so I’m here to seek suggestions and recommendations.
    d
    j
    • 3
    • 4
  • d

    Daniel Dzhukashev

    12/12/2024, 10:09 AM
    Hello, can anybody please help me to understand why there is no netty as the HttpClient engine of choice? Is there any research or benchmarks or just at the theory stage they decided not to make such an implementation and to emphasize CIO?
    c
    a
    d
    • 4
    • 4
  • y

    Yevhen Bobrov

    12/12/2024, 5:27 PM
    Hello! I’ve added ktor to spring boot project which was using logback (with spring-logback.xml) and now I don’t see any spring logs. Thus, the custom logs produced by my code are outputted. Does anybody have this problem before and may help?
    • 1
    • 1
  • g

    God'swill Jonathan

    12/27/2024, 9:21 AM
    Hello world! I am an Android Dev currently working on my first backend with Kotlin. I am still figuring things out in the backend world. I am working on the OTP feature for verification of emails during authentication. Please, I have two questions: 1. What library/plugin could I use for sending the OTP email? 2. What db/cache with TTL would you recommend for handling the OTP seamlessly in Kotlin?
    d
    d
    • 3
    • 4
  • j

    Junsu Park

    01/15/2025, 4:12 AM
    Hello everyone! I'm curious about how you manage User IDs in client-server communication. Here are the specific conditions: • User Identification and Logging: The server uses User IDs to identify users and logs their actions. • Third-Party User Management: User management is handled by a third-party service (e.g., Firebase, Supabase), with a direct database access URL. • User ID Ownership: The User ID belongs to the logged-in user (device). • Client-Side Usage: The User ID is not used on the client-side. • Frequent Logging: Logs are generated approximately once every 2-3 seconds. • JWT Usage: JWTs can be used by the server to identify users. I've considered the following approaches: Case 1: Storing User ID in Client-Side Memory • Communication: HTTPS is used for communication, and the User ID is sent in the body of the request, not exposed in the URL. • JWT and User ID: A JWT is included in the header, and the User ID is sent in the body if needed. • Concerns: Are there any security risks or other issues with temporarily storing the User ID on the client and sending it in API calls? Case 2: Using Only JWT for API Calls • Communication: A JWT is included in the header, and the User ID is not stored on the client. • Server-Side Lookup: The server accesses the third-party database to find the User ID. • Concerns: Is the latency introduced by accessing the third-party database significant? When using JWTs for user identification on the server, it requires accessing the third-party database, which might introduce a slight delay. Thank you guys and have a wonderful day 😛
    not kotlin but kotlin colored 4
    k
    n
    a
    • 4
    • 8
  • s

    Shankar Gupta

    01/18/2025, 1:57 PM
    Hi, I am new to ktor backend. I have downloaded a new project by selecting couple of plugins. The routing is defined in the databases class. how can I access this routing from postman.
    s
    • 2
    • 1
  • h

    Hong Phuc

    01/23/2025, 10:36 AM
    Hi all, just wanted to ask base on what criteria would you guys split a long-running, resources-consuming service to be a separated executable? Thanks in advance
    a
    • 2
    • 1
  • k

    Keshav Lingala

    01/27/2025, 2:27 PM
    Hello Everyone, My name is Keshav, and I work as a Senior Software Developer at Winsupply Inc. I have recently proposed using Kotlin for a new application that our organization plans to develop from scratch. Currently, our architect and all the developers are comfortable with Java and existing tools such as Checkstyle and Sonar. I suggested that with only minor adjustments, we can continue to develop in Kotlin alongside Java. I have already built a part of the application in Kotlin and demonstrated how clean and easy it is to write Kotlin code. My team responded positively and is eager to continue using Kotlin for this application, at least for now. I also have a meeting scheduled with our architect to confirm the official use of Kotlin for the new project. I am looking for assistance in establishing project setup guidelines for REST API development using Spring Boot and Kotlin.
    j
    k
    +4
    • 7
    • 14
  • j

    Júlio Santos

    01/29/2025, 1:44 PM
    Hey guys I'm having this
    ClassNotFoundException problem when using REST clients inside Kotlin coroutines after updating the Quarkus version
    , has anyone experienced it? If so, how did you solve it?
  • r

    Rob Elliot

    02/03/2025, 8:01 PM
    Quick query - do people with good experience of both tend to use java.time or kotlin.time?
    d
    j
    +3
    • 6
    • 10
  • m

    muliyul

    02/03/2025, 10:20 PM
    Seems related to both channels...
  • s

    Sujan

    02/11/2025, 7:06 AM
    👋 Hello, team!
    👋 11
    👋🏼 1
  • s

    s4nchez

    02/13/2025, 1:35 PM
    🚀 Hey everyone! We're excited to announce the release of http4k v6! 🚀It includes major changes to ecosystem, including setting the minimum Java support to 21*, rewriting of the routing, new modules for Datastar, Helidon and bridges to other popular JVM frameworks, the introduction of the first few Pro modules and more! You can read the full announcement here: https://http4k.org/v6 *_long-term support for http4k v5 and older Java versions available in Enterprise Edition subscription_
    🚀 2
    http4k 2
    👍 1
    K 8
  • j

    Jakub Zalas

    02/13/2025, 9:26 PM
    What's the best (most stable, feature complete) mqtt client library to use in Kotlin?
    a
    m
    j
    • 4
    • 27
  • m

    Marcus Ilgner

    02/17/2025, 8:39 AM
    After reading about how
    produce
    can lose elements, I wonder whether
    Flow::produceIn
    has the same potential issue? Does anyone know? I want to use
    select
    to pull elements out of a flow but without the chance of losing any... (i.e. if that
    SelectClause
    gets cancelled, it should just receive that element on the next attempt).
    j
    e
    • 3
    • 4
  • c

    Chuong

    02/24/2025, 1:10 AM
    Hi. I'm debugging an issue where, on a
    ktor
    rest API server,
    GET
    /api/v1/myroute/CompTIE
    matches the route I've created, but
    GET
    /api/v1/myroute/CompTIA
    does not. The route is defined as
    Copy code
    fun Route.myRoutes() {
      route("/myroute") {
        get("/{name}") {
          ...
        }
      }
    }
    Why am I getting this error?
    d
    • 2
    • 1
  • a

    audax

    02/24/2025, 12:38 PM
    Hi! I am building a multiplatform application with a SpringBoot-backend. We have to use Hibernate+JPA. Is there a library to support kotlinx.datetime types in Hibernate Entities, or do I have to write it myself? I would like to use native types in my postgres database, so I can formulate complex queries and we don't want to use java.time types for consistency reasons. Our whole business logic uses kotlinx.datetime and not java.time. :)
    f
    • 2
    • 2
  • a

    Admin_966

    02/24/2025, 2:23 PM
    Hi. I'm debugging an issue where, on a
    ktor
    rest API server,
    GET
    /api/v1/myroute/CompTIE
    matches the route I've created, but
    GET
    /api/v1/myroute/CompTIA
    does not. The route is defined as
    Copy code
    fun Route.myRoutes() {
      route("/myroute") {
        get("/{name}") {
          ...
        }
      }
    }
    Why am I getting this error? Thread in Slack Conversation
  • a

    Anton Yalyshev [JB]

    03/05/2025, 2:46 PM
    Dear developers! In Kotlin team we try to understand better the way how our language becomes accepted in projects and teams. We assume that usually it starts from one or several enthusiasts, and then they need to convince the rest of the team or the managers to introduce Kotlin into the project (to include into the allowed set of technologies). If you are now in such kind of process, of had it recently - we would really like to know how exactly this happens(ed): what objections, doubts, conditions the team/manager expresses. What reasoning works and what doesn’t. We would like to make a kind of guidance, or F.A.Q. for that (provide information that people who make the decision might want to know about Kotlin), but before we want to learnt how it goes. If you’re up to share with us your experience, please respond with 👋 - I’ll reach you a bit later in DM.
    👋 12
    👍 1
    👋🏼 1
    ✨ 1
    l
    j
    +4
    • 7
    • 9
  • a

    Andrew O'Hara

    03/13/2025, 4:51 PM
    Not sure where to get started with API development? 🤔 Check out the first video of my new series for beginners!

    https://www.youtube.com/watch?v=nHVeMEbZYKI▾

    http4k 4
    ❤️ 1
    🇨🇴 1
    👍 4
    K 1
    h
    d
    • 3
    • 2
  • d

    Doğaç Eldenk

    03/30/2025, 7:17 PM
    Hi folks, I have recently built a framework to declare your Dockerfile's in Kotlin DSL. I think it provides some benefits such as dynamic configuration and simplifying multi-image builds into your gradle configuration. Please let me know how you feel and I would be super happy if you decide to use this in your projects! https://github.com/Dogacel/dockerfile-kotlin-dsl
    K 11
    🐳 2
    🆒 4
  • a

    Anton Yalyshev [JB]

    04/01/2025, 10:54 AM
    Hi everyone! Kotlin team is currently gathering insights on runtime experiences and would like to know if any of you are using Azul or Liberica JDK with your server-side projects. If you are, could you please DM me, or react with 👋, and I’ll reach you? I have a couple of questions about how they’re used, and would greatly appreciate your feedback. Thanks for your help!
    👋 3
  • y

    Yusuf Aweda

    04/04/2025, 4:22 PM
    Hello! I'm Yusuf Aweda, interested in the 'Build Server Protocol: Add Kotlin Support' project. I've explored Kotlin and Gradle a bit and would love to discuss the approach and proposal structure!
    👋 3
    s
    • 2
    • 2
  • v

    Vishal Reddy

    04/07/2025, 12:56 PM
    I just saw that the latest Ktor server release CIO engine supports server side wasm. Anyone know a gradle setup example for this project?
    j
    • 2
    • 1
  • w

    wakingrufus

    04/09/2025, 1:15 PM
    https://www.tiobe.com/tiobe-index/ They only mention Kotlin on android and iOS and say its only for 1 platform.... Totally sleeping on backend kotlin. IME it is becoming more and more common to meet people doing back end kotlin. I think maybe tiobe is not properly detecting JVM backend work using a hybrid of java/kotlin
    kodee sad 10
    🥱 1
    o
    g
    +5
    • 8
    • 11
  • s

    Shadman

    04/27/2025, 5:41 PM
    So I have a general question. 🙃 Can I use
    Gradle Flavors
    instead of feature based modules for a
    ktor
    backend and I still have the advantages of a real
    microservice
    structure (For example independent deploy)? I don't think so right?🤔 Can't we somehow trick it? Like giving different port for each
    flavor
    , for both server port and database port?
    h
    • 2
    • 1
  • u

    배규민

    05/06/2025, 7:45 AM
    Hi everyone! I’d like to share Documentify, an open-source tool that simplifies creating OpenAPI specs using Kotlin DSL. It combines the strengths of Swagger and RestDocs for intuitive and efficient documentation, without the complexity of conventional RestDocs. Feedback and contributions are welcome! (and stars 🤣) https://github.com/BGMSound/documentify
    📚 1
  • m

    Mohammad Zaki

    05/11/2025, 9:46 AM
    Hi Team, I am trying to implement web socket through ktor server . Its working fine but its not connecting to android app which is using ktor client. I am getting this error : ws://ip-here8080/clipboard/myRoom Operation not permitted
    a
    m
    • 3
    • 2