Skip to content

[Enhancement] Add GraalVM native-image compatibility for serverless and containerized deployments #87

Description

@deepgram-robot

Summary

Add GraalVM native-image compatibility annotations, reflection metadata, and build configuration so that applications using the Deepgram Java SDK can be compiled to native executables with near-instant startup times — critical for serverless (AWS Lambda, Azure Functions, Google Cloud Functions) and containerized deployments.

Problem it solves

Java developers deploying voice transcription in serverless environments face cold-start penalties of 3-10 seconds with standard JVM startup. GraalVM native-image compilation eliminates this by ahead-of-time compiling to native executables with <100ms startup. However, SDKs that use reflection, dynamic proxies, or runtime class loading (common in HTTP/WebSocket clients and JSON serialization) fail at native-image compile time without proper metadata hints. Developers currently cannot use the Deepgram Java SDK in GraalVM native-image builds without manually providing reflection configuration, which is fragile and undocumented.

Proposed API

// No API changes needed — compatibility is transparent
// Works as a standard dependency in native-image builds

// pom.xml or build.gradle (no extra config needed)
// <dependency>
//   <groupId>io.deepgram</groupId>
//   <artifactId>deepgram-java-sdk</artifactId>
// </dependency>

// Application code works identically
var client = new DeepgramClient(apiKey);
var response = client.listen().prerecorded()
    .transcribeUrl(audioUrl, options);

// Compiles with: native-image -jar myapp.jar
// Or with Quarkus/Micronaut/Spring Native build plugins

Acceptance criteria

  • reflect-config.json and resource-config.json included for all SDK model classes
  • Native-image build succeeds without manual --initialize-at-build-time or reflection overrides
  • Pre-recorded STT and streaming STT work correctly in native-image builds
  • Tested with GraalVM CE 22+ native-image
  • Documented with native-image build example (standalone and Spring Native)
  • Compatible with existing API (no breaking changes)

Raised by the DX intelligence system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions