suga.yaml, you need a way to interact with them from your application code. Suga provides generated client libraries that give you a cloud-agnostic interface to your resources.
Why Use Generated Clients?
The Suga client generation approach offers several key advantages:- Cloud Portability - Same code works on AWS, GCP, or any platform
- Local Development - Enable
suga devwith emulated cloud services - Type Safety - IDE autocomplete and compile-time error checking
- Simplified API - Consistent interface across all cloud providers
- Tailored Surface - Only includes resources and permissions you’ve defined
What Resources Support Client Generation?
Currently, Suga generates clients for:- Buckets - Object storage operations (read, write, delete)
- Databases - Use standard PostgreSQL libraries with injected connection strings (see Database Access)
- Services - Communicate through entrypoints or shared resources
Generated Client Libraries
Generate type-safe client libraries using thesuga generate command:
- Node.js
- Python
- Go
suga.yaml, providing a tailored API surface for your application.
Cloud-Agnostic Portability
The Suga client maximizes portability by abstracting away cloud provider differences. When you use the client to interact with resources, the same code works regardless of where your application is deployed:Write once, run anywhere
Cloud-specific code (without Suga)
- True multi-cloud deployment - Switch providers without changing application code
- Simplified codebase - No conditional logic for different cloud providers
- Easier testing - Mock resources uniformly across environments
- Future-proofing - Platform changes don’t require application code updates
Local Development with suga dev
The generated client unlocks powerful local development capabilities. When you run suga dev, Suga automatically substitutes real cloud services with local emulations:
- No cloud account needed for development
- Zero cloud costs during development
- Fast iteration - test changes instantly without deployment
- Offline development - work anywhere, no internet required
- Consistent behavior - same resource interactions locally and in production
How It Works
The Suga client uses runtime adapters provided by your target platform’s plugins:-
In Production:
Example:
suga.uploads.write()→ S3 Adapter → AWS SDK → S3 -
During
suga dev:Example:suga.uploads.write()→ Local Adapter →.suga/buckets/uploads/
Type Safety and Auto-Completion
Generated clients provide full type safety and IDE auto-completion:When to Use the Generated Client
Use the generated Suga client when:- You want cloud-agnostic code
- You need local development with
suga dev - You’re building a multi-cloud application
- You want simplified resource access
- You need cloud-specific features not exposed by Suga
- You have deep integration requirements with a specific provider
- You’re gradually migrating an existing application