If it sounds right, I have following implementation plan in mind ## Implementation plan ### v0: Plain data classes (in progress) **PR**: [supabase/postgres-meta#1050 ](https://github.com/supabase/postgres-meta/pull/1050) Adds a Kotlin template to postgres-meta, enabling `supabase gen types kotlin`. Generated output is plain `@Serializable` data classes — same approach as the Swift generator (#779). ```kotlin // Generated from database schema @Serializable data class MoviesSelect( val id: Long, val title: String, val genre: String? = null, @SerialName("created_at") val createdAt: String? = null ) @Serializable data class MoviesInsert( val title: String, val genre: String? = null ) @Serializable data class MoviesUpdate( val title: String? = null, val genre: String? = null ) ``` Usage: ```kotlin val movies: List<MoviesSelect> = client.from("movies").select().decodeList() client.from("movies").insert(MoviesInsert(title = "Foo")) ``` The client has no compile-time knowledge of table names or schemas — you manually pair the right type with the right table string. This matches the current state of Swift type generation. ### v1: Type-safe client integration (future) Depends on v0. Would add a `TypedTable` abstraction to supabase-kt's Postgrest module so the compiler enforces correct types: ```kotlin // Generated object Tables { val movies = TypedTable<MoviesSelect, MoviesInsert, MoviesUpdate>("movies") } // Usage — compiler knows the types val movies = client.from(Tables.movies).select() // returns List<MoviesSelect> client.from(Tables.movies).insert(MoviesInsert(title = "Foo")) // type-safe client.from(Tables.movies).insert(MoviesSelect(...)) // compile error ``` This is analogous to how TypeScript's `createClient<Database>()` flows types through `.from()` and `.select()`, adapted to Kotlin's type system using generics instead of mapped types. | | v0 | v1 | |---|---|---| | **Where** | postgres-meta | postgres-meta + supabase-kt | | **What** | Plain data classes | TypedTable abstraction + Tables object | | **Type safety** | Serialization only | Table names + column types at compile time | | **Prerequisite** | None | v0 |