Encore's JavaScript/TypeScript SDK, currently at stable version 1.56.6, provides the necessary APIs and development utilities for building backend applications within the Encore cloud platform. It enables developers to define services, interact with built-in platform features like caching and secrets, and manage application infrastructure using a declarative, type-safe approach. The SDK integrates seamlessly with the Encore CLI and platform, abstracting away complex infrastructure provisioning. Recent updates include comprehensive built-in support for caching in Encore.ts, powered by Redis, offering various type-safe keyspace types such as `StringKeyspace` and `StructKeyspace`. It also includes internal improvements for Go 1.26 support and enhanced secret management features via the CLI. Releases are frequent, typically focusing on minor fixes, performance enhancements, and new platform feature integrations.
npm install encore.devVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining an Encore API service in TypeScript with type-safe caching using a `StringKeyspace` to retrieve and store user data.
Ensure your Node.js environment is updated to version 18.0.0 or later. Use `nvm` or similar tools for managing Node.js versions.
Install the Encore CLI (`curl -L https://encore.dev/install | bash`) and initialize an Encore application to use the SDK as intended.
Update your scripts and practices to use `encore secret delete` for removing secrets, allowing for reuse of secret names after deletion.
Use ES module `import` statements instead: `import { someSymbol } from 'encore.dev';`Run your Encore application using the `encore run` command from your terminal, or deploy it with `encore deploy`.
Verify that `import { api, Cache } from 'encore.dev';` is at the top of your file and ensure your application is launched via `encore run` or deployed to the Encore platform.