Gleam + zig is stupid?

I’m planning use Gleam + zig in my server, is stupid?

Gleam have powerfull tools to handle with crash and recover. But Gleam is a language that’s too simple for what I want. I don’t want to be forced to follow the simplistic paradigm of the language throughout the entire architecture, so I thought about using a shared library to bridge the two: Gleam would receive the requests and handle the high-level stuff, while Zig would handle the actual business logic.

Zig has comptime, very compelling data structures, better control over structure, error handling, and things like that. Performance isn’t really my main concern for now — it’s the architecture and structure.

I haven’t found another language that gives me what Zig does in terms of structure, error handling, and so on. Basically, Gleam would handle authentication, headers, validation, timeouts, etc., while Zig would handle the business rules and data structures in general.

Is this completely stupid, or does it actually make some sense? As long as the performance doesn’t degrade to the point where it’s basically as slow as a Node server, that would already be enough for me.

I cant speak for gleam because I have never used it, but you will have to communicate with C ABI between the two different languages. That in itself is not going to introduce a performance problem but you will need to sync every data structure and function signature* as well. If you think managing this is worth it, it makes sense.

EDIT: Basically anything that needs to be interactive between the languages needs to be in C ABI. There are multiple ways to do this, none of them is pretty imo. The parts that dont need this interactivity(is this the right word? idk) can be just “pure zig/gleam”.