encore

Encore is the Backend Development Platform purpose-built to help you create event-driven and distributed systems.

MPL-2.0 License

Downloads
5.9K
Stars
4.7K
Committers
68

Bot releases are hidden (Show)

encore - TypeScript Metadata API Latest Release

Published by marcuskohlberg 6 months ago

We're excited to announce Encore v1.35, with several improvements to Encore for TypeScript!

Discord

We've also just moved the Encore Community to Discord. This gives us several key features that we believe will make the community more engaging and helpful for all members:

  • This will give us several key features that we believe will make the community more engaging and helpful for all members:
  • Unlimited message history, so we never lose valuable chats.
  • Improved Q&A using built-in forums, making it faster and easier to find answers and share knowledge.
  • Dedicated boards for submitting and voting on suggestions — we love hearing your ideas and want to get better at tracking them.
  • The ability to schedule and host live streamed community events.

Hope to see you there!

TypeScript Metadata API

We've added a new API for querying metadata about the application's running environment. It looks like this:

import { appMeta } from "encore.dev";

const meta = appMeta();

The metadata object contains tons of information about the application and where it's running:

// Describes the running Encore application.
export interface AppMeta {
  // The Encore application ID. If the application is not linked to the Encore platform this will be an empty string.
  // To link to the Encore platform run `encore app link` from your terminal in the root directory of the Encore app.
  appID: string;

  // The base URL which can be used to call the API of this running application.
  //
  // For local development it is "http://localhost:<port>", typically "http://localhost:4000".
  //
  // If a custom domain is used for this environment it is returned here, but note that
  // changes only take effect at the time of deployment while custom domains can be updated at any time.
  apiBaseURL: string;

  // Information about the environment the app is running in.
  environment: EnvironmentMeta;

  // Information about the build.
  build: BuildMeta;

  // Information about the deployment.
  deploy: DeployMeta;
}

// Describes the environment the Encore application is running in.
export interface EnvironmentMeta {
  // The name of environment that this application.
  // For local development it is "local".
  name: string;

  // The type of environment is this application running in.
  // For local development it is "development".
  type: EnvironmentType;

  // The cloud this is running in.
  // For local development it is "local".
  cloud: CloudProvider;
}

// Describes what type of environment the application is running in.
export type EnvironmentType =
  // A production environment.
  | "production"
  // A long-lived cloud-hosted, non-production environment, such as test environments, or local development.
  | "development"
  // A short-lived cloud-hosted, non-production environments, such as preview environments
  | "ephemeral"
  // When running automated tests.
  | "test";

// Describes what cloud provider the application is running in.
export type CloudProvider =
  | "aws" // Amazon Web Services
  | "gcp" // Google Cloud Platform
  | "azure" // Microsoft Azure
  | "encore" // Encore Cloud.
  | "local"; // Local development

// Information about the build that formed the running application.
export interface BuildMeta {
  // The git commit that formed the base of this build.
  revision: string;

  // Whether there were uncommitted changes on top of the commit.
  uncommittedChanges: boolean;
}

// Information about the deployment of the running application.
export interface DeployMeta {
  // The unique id of the deployment. Generated by the Encore Platform.
  id: string;
}

Client Generation improvements

The encore gen client command now accepts --excluded-services=foo,bar to exclude specific services from the generated client.

Various TypeScript Improvements

We're also making rapid improvements to all aspects of Encore for TypeScript:

  • Pub/Sub: Added support for AWS Pub/Sub (SQS + SNS)
  • Pub/Sub: Implemented support for maxConcurrency across local development, GCP, and AWS
  • API: Added trailing slash redirect handling

Full Changelog: https://github.com/encoredev/encore/compare/v1.34.7...v1.35.3

encore - Encore for TypeScript Public Beta + Terraform Provider

Published by eandre 7 months ago

encore for typescript

It's been a long time coming, but just in time for Easter it's finally here: Encore for TypeScript is now in Public Beta!

We're soon going to publish an blogpost with details on the design and architecture, but until then here are the key things to know:

  • We've built a custom TypeScript runtime in Rust, for truly eye-watering performance! We believe Encore based apps will be some of the most high-performance TypeScript apps around.
  • The TypeScript SDK is officially unstable, but we expect most of the remaining work to be additive (not modifying) and it's unlikely there will be breaking changes.
  • The TypeScript Beta already supports most of the Encore features you know and love: the local dev dashboard, API docs, tracing, etc.
  • We are working toward feature parity with the Go version and expect to get there in the coming weeks. Currently there are a few key features remaining to implement: Caching, Middleware, Configuration, Raw endpoints, and Metadata.

Try it out yourself: Update the CLI encore version update, create a new app encore app create, and select TypeScript. 🚀

Share your feedback and bug reports: We're dependent on your feedback to improve Encore, please share your thoughts either by creating an issue here on GitHub or by posting on Slack. ❤️

Introducing: The Encore Terraform Provider

We regularly hear how Encore's approach to infrastructure automation is incredible — for the infrastructure primitives that Encore supports. This is sufficient for the majority of use cases, but when you have a use case that requires additional cloud infrastructure that Encore doesn't (yet) have built-in support for, the experience left something to be desired. To be more specific, since Encore set up the infrastructure automatically it was painful and laborious to reference those resources from Terraform, and required lots of manual work.

To solve that problem we've just released the Encore Terraform Provider that dramatically simplifies the experience of combining Encore-managed cloud infrastructure with additional infrastructure managed by Terraform.

It works by providing Terraform Data Sources for Encore-managed infrastructure resources. The data sources released so far include:

These data sources make it easy to retrieve information about the underlying cloud infrastructure that Encore has provisioned, making it that much easier to combine Encore-managed infrastructure with additional infrastructure for when you need it.

For more information on how to use the Encore Terraform Provider, check out the docs!

Thanks to all contributors

🙏 We continue to be overwhelmed by your support, feedback, and suggestions!
Together we're building the future of backend development and we couldn't be more excited.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Discord.

New Contributors 🙌

Full Changelog: https://github.com/encoredev/encore/compare/v1.31.0...v1.34.7

encore - Introducing: Test Tracing

Published by DomBlack 9 months ago

We're very excited to announce something the world's never seen before (probably): Test Tracing!

With Encore v1.31.0, encore test now automatically captures a trace of every test, providing much more visibility into what's happening and making it easier to understand why a test failed.

The test traces automatically include everything you expect from Encore's automatic tracing:

  • API calls (including mocked calls with Encore's new mocking support!).
  • Database queries
  • Pub/Sub messages
  • HTTP requests
  • ... and so on

And best of all: it works with all your existing tests.

Upgrade to Encore v1.31 to try it out: encore version update

image

image

✨ Local Development Dashboard Enhancements

We've made several quality-of-life improvements to the local development dashboard. These enhancements include the ability to view all Encore apps via the local dashboard, regardless of whether they are currently running or not. We've also made several UI improvements to the dashboard, including displaying request logs when an API call is made, notifications when the app is compiling, and notifications when the app has just restarted.

📆 Roadmap

We're currently pushing to get TypeScript support out the door and hope to release the first general availability in the next few weeks. We've also been working on some smaller features based on your comments on Slack which will drop in the next few days: cloud cost insights and the ability to pause and trigger cron jobs from the Cloud Dashboard.

Check out the roadmap and leave your comments!

Thanks to all contributors

🙏 We continue to be overwhelmed by your support, feedback, and suggestions!
Together we're building the future of backend development and we couldn't be more excited.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Slack.

Full Changelog: https://github.com/encoredev/encore/compare/v1.30.0...v1.31.0

encore - Mock it till you drop it: API and Service mocking support is here

Published by marcuskohlberg 9 months ago

With v1.30.0 we're now introducing support for mocking APIs and services! This makes it much simpler to test your application in isolation.

Let's look at an example:

You have an endpoint that calls an external API in our products service:

//encore:api private
func GetPrice(ctx context.Context, p *PriceParams) (*PriceResponse, error) {
    // Call external API to get the price
}

When testing this function, you don't want to call the real external API since that would be slow and cause your tests to fail if the API is down. Instead, you want to mock out the API call and return a fake response.

You can now do this in Encore by adding a mock implementation of the endpoint using the et.MockEndpoint function inside your test:

package shoppingcart

import (
	"context"
	"testing"
	
	"encore.dev/et" // Encore's test support package
	
	"your_app/products"
)


func Test_Something(t *testing.T) {
	t.Parallel() // Run this test in parallel with other tests without the mock implementation interfering
	
	// Create a mock implementation of pricing API which will only impact this test and any sub-tests
	et.MockEndpoint(products.GetPrice, func(ctx context.Context, p *products.PriceParams) (*products.PriceResponse, error) {
		return &products.PriceResponse{Price: 100}, nil
	})
	
	// ... the rest of your test code here ...
} 

In addition to mocking individual APIs, you can also mock entire services. This can be useful if you want to inject a different set of dependencies into your service for testing, or a service that your code depends on.

When mocking services, Encore will automatically generate an Interface interface for every service, which contains all the APIs defined in the service. This makes it possible to automatically generate mock objects for your services using either Mockery or GoMock.

📚 Check out the docs for all the details.

👉 Remember to update using: encore version update and go get encore.dev@latest

Improved docs search

We've updated the docs search functionality to make it easier to find what you're looking for. Search now has improved relevancy, snippets are much improved, and results can now link directly to sub-sections of individual pages.

Roadmap

We're currently pushing to get TypeScript support out the door and hope to release the first general availability in the next few weeks.
We've also been working on some smaller features based on your comments on Slack which will drop in the next few days: cloud cost insights and the ability to pause and trigger cron jobs from the Cloud Dashboard.

Check out the roadmap and leave your comments!

Thanks to all contributors

🙏 We continue to be overwhelmed by your support, feedback, and suggestions!
Together we're building the future of backend development and we couldn't be more excited.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Slack.

Full Changelog: https://github.com/encoredev/encore/compare/v1.29.7...v1.30.0

encore - TypeScript (and winter) is coming!

Published by eandre 11 months ago

Encore v1.29 is out with a whole bunch of quality-of-life improvements and bugfixes.

As always, get the latest version with encore version update!

TypeScript update

We're making rapid progress on Encore's TypeScript support, and plan to have an initial release out in the coming weeks. In the meantime, join us on Slack and let us know if you're interested in participating in the private beta.

API Schema Validation & Autocomplete

Encore now validates and autocompletes request payloads via the API Explorer and Service Catalog! Check it out in action:

https://github.com/encoredev/encore/assets/425456/4206b292-b479-4934-ab3e-708731e5d2c8

Streaming Traces

Encore now streams traces to the Encore Platform as they're happening, instead of waiting for the request to complete. This dramatically improves trace ingestion latency and reduces the memory usage of Encore applications. The new functionality is automatically enabled, starting with your next deploy. (See #944 and #976)

Go Workspaces

Encore now supports Go workspaces! This enables more seamless development of multi-module applications. (See #975)

CORS Improvements

Encore's CORS handling now automatically allows User-Agent to be allowed for incoming requests. (See #956)

Deleted environment handling

The Encore Platform now supports viewing environments that have been deleted. This is particularly useful for Preview Environments since they're automatically deleted on PR merge.

Shadow Databases

Encore now supports creating "shadow databases" for use with tools like Atlas and Prisma Migrate. A shadow database is an empty database that can be used by migration tools to compare the current state with the desired state.

Encore supports using shadow databases with the encore db commands you already know by passing in the --shadow flag. For example, encore db reset --shadow --all resets all shadow databases back to their empty state, while encore db conn-uri --shadow provides a connection string for use in tools like Atlas and Prisma Migrate.

We've updated the docs to use this functionality for a better integration with Atlas.

(See #949)

Bugfixes

Beyond this, a whole slew of bugfixes and other improvements:

  • Fixed initialization race in metrics (#978)
  • Fixed new traces incorrectly appearing in the local developer dashboard when running multiple applications (#960)
  • Fixed metrics collection on startup and shutdown (#953)
  • Fixed duplicate trace spans for stdlib queries (#952)
  • Fixed error reporting when having multiple migrations with the same migration number (#945)
  • Improved graceful pod termination when running in Kubernetes (#938)
  • Added support for having an empty migration directory (#936)
  • Fixed code rewriting edge case with a file containing nothing but "package " (#979)
  • Members are now correctly allowed to manually trigger deployments
  • Links to code viewer now work correctly with a custom app root directory
  • Fixed trace replay pane scrolling
  • Improved Connect Cloud documentation and copy to make it clearer
  • Infrastructure Edit panel for Cloud Run now supports setting min==max

Thanks to all contributors

🙏 We continue to be overwhelmed by your support, feedback, and suggestions!
Together we're building the future of backend development and we couldn't be more excited.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Slack.

Full Changelog: https://github.com/encoredev/encore/compare/v1.28.0...v1.29.2

encore - AWS Kubernetes Support + Command Menu

Published by marcuskohlberg 12 months ago

Amazon EKS Support

We're happy to share that Encore now supports deploying to Amazon Elastic Kubernetes Service (EKS)! 🎉
This also means you can now deploy your app to Kubernetes on both GCP and AWS.

Encore uses EKS AWS Fargate (which is a very confusing name — Thanks Amazon!) to run your Kubernetes applications using serverless compute. This removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design.

To deploy your app to EKS: Go to Create Environment, select Amazon Web Services as the cloud, then select Kubernetes: EKS Fargate.

aws eks

Command Menu

As we add more and more features to Encore, we also want to make navigation simpler and faster. We're now introducing the Command Menu as a new lightning-fast method of moving around the Cloud Dashboard (coming soon to Local Dev Dash!).⚡️

Try it out yourself by opening your app in the Cloud Dashboard and pressing ⌘+K (Mac) or Ctrl+K!

In this first release, Command Menu lets you search for pages in the Cloud Dashboard and Docs. Soon we'll add much more functionality, like the ability to search for apps, services, endpoints, and more.

We'd love to hear your feedback and ideas for how to improve it — jump on Slack and share your thoughts!

https://github.com/encoredev/encore/assets/78424526/2504ea8d-b83f-42de-bd93-d97a763cb525

Thanks to all contributors

🙏 We continue to be overwhelmed by your support, feedback, and suggestions!
Together we're building the future of backend development and we couldn't be more excited.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Slack.

Full Changelog: https://github.com/encoredev/encore/compare/v1.27.7...v1.28.0

encore - Local Dev Dash 2.0 and kubectl Support

Published by marcuskohlberg about 1 year ago

Local Dev Dash 2.0

🎉 We're happy to share that the Local Dev Dash has received a big upgrade!

The main improvement is in the API explorer. It now features multiple tabs so you can work on multiple endpoints more easily, and lets you store and re-use custom requests. You can now also share these with your team members to create your own internal repository of often-used requests.

We hope these improvements will make your local development workflow smoother and faster than ever before!

Ready to try it out?
👉 Remember to update your CLI first: encore version update

https://github.com/encoredev/encore/assets/78424526/f1138146-8c2a-4cdc-a5dd-2eebbb3dde97

kubectl Support

Kubernetes provides the command line tool kubectl for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.

If your Encore application has environments using Kubernetes, application Admins can now configure your local kubectl to access your cluster automatically, without needing to fuss with IP allow lists, port forwarding, or firewall rules.

From your application directory, run encore kubernetes configure -env=[ENV_NAME]. Then you can immediately run kubectl get deployments or your next favourite kubectl command.

👉 Remember to update your CLI: encore version update

Thanks to all contributors

🙏 We continue to be overwhelmed by your support, feedback, and suggestions!
Together we're building the future of backend development and we couldn't be more excited.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Slack.

Full Changelog: https://github.com/encoredev/encore/compare/v1.26.0...v1.27.0

encore - Neon Databases for Preview Environments + Open in Editor

Published by marcuskohlberg about 1 year ago

Neon Databases for Preview Environments

As a first step toward full support for Neon SQL databases, we've updated Preview Environments to now provision databases using Neon. The only noticeable impact for your application is that Preview Environments are now faster to provision and start-up.

Soon we'll add support for configuring which type of database you want to use in each environment so that you can take advantage of Neon's scalable, and cost-efficient, SQL offering for all your environments.

Jump straight to your IDE from API explorer

In this release, we've rolled out a quality-of-life feature that's a real boost for your development workflow: the Open in Editor functionality.

This new feature is integrated into the local dev dashboard API explorer. It lets you jump directly to your code editor — and even better — to the exact line of code where the currently selected API endpoint is defined.

No more manual searching, no more juggling between windows. With a single click, you'll be taken straight to the relevant piece of code, so you can get right back to coding.

Have multiple editors installed? No problem! You can easily configure which code editor you'd like to use as your default.

We hope this small feature will improve your development experience starting today!

open in editor

Bugfixes and improvements

New Contributors

Full Changelog: https://github.com/encoredev/encore/compare/v1.25.2...v1.26.0

encore - Build & Test Performance Improvements

Published by marcuskohlberg about 1 year ago

We've just released Encore v1.25 which comes with several large build & test performance improvements!
As always, update with encore version update.

Improved CI Build & Test Speeds

Encore's CI system now uses a brand-new streaming cache system. Previously Encore tar and untar-ed the build & test cache, adding to the build time and leading to an unfortunate trade-off between cache hit rate and cache restore/save times.

With this release, Encore now uses a streaming cache that on-demand downloads and uploads individual cache entries. This entirely removes the cache restore/save steps, leading to a substantial speed-up. Additionally, the improved cache accuracy leads to more parts of the build being cached, further improving build times.

We've seen up to a 70% reduction in build & test times for many real-world applications, depending on the nature of the change.

Improved Local Development Performance

We've further optimized how Encore's code generation works, leading to improved build & test times, particularly when the changes are small (compared to the previous build). Depending on the change this new release should offer a 10% to 100% reduction in build times (yes, you heard that right!), and similar improvements to test execution speeds through improved test caching.

Additionally, we've further improved the Live Reload speed by improving the graceful shutdown process. More on that below.

Graceful Shutdown Improvements

Encore now implements a more optimized graceful shutdown process, reducing shutdown times when there are no outstanding requests being processed. Encore also provides the encore.dev/shutdown package that allows services to opt-in to more detailed information about the shutdown process, by implementing shutdown.Handler on a service struct.
The old signature (func (*Service) Shutdown(force context.Context)) is still supported for backward compatibility.

❤️ As always, we're excited to hear what you think!
Please share your feedback on Slack.

encore - Service Bundling, Go 1.21, encore rand, and more!

Published by eandre about 1 year ago

We're excited to announce Encore v1.24 which comes with several new features! As always, upgrade with encore version update.

Service Bundling

Encore now supports configurable bundling/unbundling of services when deploying to your own cloud. When creating a new cloud environment you can decide whether all services should be bundled together into a single deployment, or split into one deployment per service.

Bundling services improves API call performance and reduces latency between them, but removes the ability to scale them independently. Typically for Kubernetes and AWS Fargate you'll want each service deployed separately, whereas for GCP Cloud Run to bundle them together, but it depends on the use case.

Under the hood Encore already supports mixing and matching between these two modes, enabling specific services to be co-located in whatever ways you wish according to performance requirements. In the future these knobs will be exposed directly in the UI, but let us know if you want to customize the setup until then.

Go 1.21

Encore v1.24 includes support for the newly released Go 1.21, which includes a whole slew of improvements. Check out the official release notes for more information.

Database users & passwords

The infrastructure page now lists database users and allows decrypting and viewing the database password (for admins).

encore rand

Encore now contains a set of CLI utilities for generating random data of various kinds. This is useful for generating cryptographically secure random data for things like secrets. For example:

  • Random bytes: encore rand bytes 32 (in various formats with -f hex|base32|base64|etc)
  • Random words: encore rand words 8 (for passphrases or such)
  • Random UUID: encore rand uuid (defaults to v4, override with -1|-4|-6|-7)

What’s next

Right now we're working on adding support for deploying to Kubernetes on AWS, gRPC, and much more. Remember to vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or just email us at [email protected].
We’re excited to hear your feedback! ❤️

Catch you in the cloud,
The Encore team

encore - Infrastructure Namespaces

Published by eandre about 1 year ago

We're excited to announce Encore v1.23 with several new features! As always, upgrade with encore version update.

Infrastructure Namespaces

Encore now allows you to create and switch between multiple, independent infrastructure namespaces. Infrastructure namespaces are isolated from each other, and each namespace contains its own independent data.

Create and switch to a new namespace with encore ns switch --create NAME . Commands like encore run, encore db shell and so on automatically use the active infrastructure namespace (override this with -n).

Infrastructure namespaces makes it trivial to switch tasks, confident your old state and data will be waiting for you when you return. If you've ever worked on a new feature that involves making changes to the database schema, only to context switch to reviewing a Pull Request and had to reset your database, you know the feeling.

Read the docs to learn more about infrastructure namespaces, and let us know what you think over on Slack!

nspic

pgvector + PostGIS support

Databases provisioned by Encore now support the popular pgvector and PostGIS extensions! This is powered by the new encoredotdev/postgres:15 docker image. The extensions are supported across the board: for local development; in Encore's CI/CD pipeline when running tests; in new databases provisioned in Encore Cloud; and in cloud databases in AWS and GCP.

Let us know on Slack if there are any more extensions you would like to see!

Bugfixes and other improvements

  • Support for defining databases outside of service folders with sqldb.NewDatabase (#822
  • Support for creating empty apps from the CLI with --example=empty (#821)
  • Increased the timeout for encore gen wrappers to better work with first-time use during CI/CD workloads (#815)
  • Fixed missing "missing secret" warning (#818)

Thanks to all contributors!

We rely on the community to improve Encore, and we continue to be overwhelmed by your support and encouragement.
Thank you Juan Álvarez, Will Demaine, Jakob Nordfeldt, MaxD, and Jamie MacLeod for your ideas in the new #suggestions Slack channel! ✨

What’s next

Right now we're working on adding support for deploying to Kubernetes on AWS, gRPC, and much more. Remember to vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or just email us at [email protected].
We’re excited to hear your feedback! ❤️

Catch you in the cloud,
The Encore team

encore - Import existing Kubernetes Clusters (GKE) and Webhooks Support

Published by marcuskohlberg over 1 year ago

importk8s

Encore now supports deploying to existing Kubernetes clusters on Google Cloud Platform. 🎉
This means, if you have a pre-existing Kubernetes cluster, it is now much easier to adopt Encore. You can simply deploy your Encore application to your pre-existing cluster alongside your other applications.

To import a cluster: Go to Create Environment in the Cloud Dashboard, select Kubernetes: Existing GKE Cluster as the compute platform, and finally specify your cluster's Project ID, Region, and Cluster Name.

Webhooks Support

webhooks

We've finally added support for receiving webhooks from the Encore Platform!
Admins can manage webhooks by going to: Settings > Integrations > Webhooks in the Cloud Dashboard.

The initial set of webhooks center around rollouts, providing notifications related to builds, infra provisioning, and deployments. Use cases for these events include:

  • Setting up alerts for build/deploy failures
  • Notifications for when a deploy is awaiting infrastructure approval
  • Seeding Preview Environments with test data

To make it easier to consume webhooks, we've published a Go module (go.encore.dev/webhooks) that provides type definitions and documentation of the various events. We'll keep this updated over time as we add support for additional webhook events. For security reasons, Encore provisions a dedicated secret key for every webhook and signs every webhook request with said key. The provided webhooks.ParseEvent validates the webhook signature as part of its processing, ensuring the webhooks are coming from Encore and not elsewhere.

Learn more in the docs

Thanks to all contributors!

We rely on the community to improve Encore, and we continue to be overwhelmed by your support and encouragement.
Thank you Juan Álvarez, Will Demaine, Jakob Nordfeldt, MaxD, and Jamie MacLeod for your ideas in the new #suggestions Slack channel! ✨

What’s next

Right now we're working on adding support for deploying to Kubernetes on AWS, gRPC, and much more. Remember to vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or just email us at [email protected].
We’re excited to hear your feedback! ❤️

Catch you in the cloud,
The Encore team

Full Changelog: https://github.com/encoredev/encore/compare/v1.21.2...v1.22.0

kubernetes support

As with all things Kubernetes, this release took a lot of work!
Finally, we're happy to share that Encore now supports deploying to Kubernetes on GCP (AWS is coming soon).

Here's what you need to know:

  • When you create a new GCP environment, you can now choose your desired compute platform: Cloud Run, GKE Autopilot, or GKE Standard.
  • As you would expect, Encore provisions all the necessary infrastructure, IAM, and orchestrates deployments to Kubernetes.
  • We'll soon add support for importing self-managed Kubernetes clusters, letting you deploy Encore applications to your existing Kubernetes clusters.

As always, remember to update your CLI: encore version update

– We're looking forward to hearing your feedback on Slack!

Improved Infrastructure Approval Flow

In case you didn't know, Encore lets you require admin approval for deploys that make changes to infrastructure.
We've just shipped some improvements to make this workflow better:

  • The infrastructure provisioning UI now gives you more information about the infrastructure changes, including the specific properties being modified.
  • If any changes will require downtime (like modifying certain properties on database clusters) there's a new dialog to avoid any nasty surprises.

Remote Device Login Support

The Encore CLI now supports logging in from a different device than where your browser is running, using encore auth login. (The new flow is powered by OAuth2's device authorization standard.) This adds better support for use cases like developing over SSH, and using WSL, GitHub Codespaces/Gitpod, etc.

Remember to update your CLI: encore version update

Improved Pub/Sub Concurrency

Encore now supports configurable Pub/Sub concurrency on a per-subscriber basis, using the MaxConcurrency field in the pubsub.SubscriptionConfig. The default value, if not set, is a reasonable default based on the cloud provider. See the package docs for more information.

Thanks to all contributors!

We rely on the community to improve Encore, and we're overwhelmed by your support and encouragement. Thanks to Neal Lathia, Peter Stewart, Luka Giorgadze, Simon Vans-Colina, Phakorn Kiong, Hussein Badakhchani, Brent Dillingham, Jakob Nordfeldt, and Will Demaine for your ideas, bug reports, and feedback!

What’s next

Right now we're working on adding support for deploying to existing Kubernetes clusters, Kubernetes on AWS, gRPC, and much more. Remember to vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or just email us at [email protected].
We’re excited to hear your feedback! ❤️

Catch you in the cloud,
Marcus & the Encore team

Full Changelog: https://github.com/encoredev/encore/compare/v1.21.0...v1.21.1

It's been a long time coming, but it's finally here: Infrastructure configuration directly from the Encore Cloud Dashboard!

You can now easily configure your AWS and GCP environments' infrastructure settings, including: compute instances, database clusters, and Redis clusters. When you make changes Encore automatically validates the configuration according to each cloud provider's constraints and applies the configuration during the next deploy. This makes it much simpler to manage and track changes as your needs evolve.

https://github.com/encoredev/encore/assets/78424526/577b252a-a62e-4b19-be47-d9d7ae04fb9b

Local Development Dashboard Refresh

It's about time the local dev dash got some care and attention. We've made some major upgrades behind the scenes and it now shares most of its components with the Cloud Dashboard. This means it's now also got the latest and greatest functionality like the improved API Explorer and Service Catalog. It'll also make it faster to release further improvements, so expect more to come!

local dev dash

Tracing improvements

As part of our ongoing work to add support for gRPC (more on that soon!), we've taken the opportunity to make some quality-of-life improvements to tracing:

  • Traces are now color-coded (e.g. Pub/Sub is always green, and database queries are always yellow)
  • Traces with Pub/Sub publish events now link to the corresponding traces for the subscribers

https://github.com/encoredev/encore/assets/78424526/c1f31126-c853-4802-9fc3-96e3e5c83884

GraphQL Tutorial

We get many questions about using GraphQL in Encore applications. So we've recently published a tutorial on how to build a GraphQL API. We hope you enjoy trying it, and find it helpful when using GraphQL. There is also a GraphQL example app in the example apps repo.

Other improvements & bugfixes

This release brings several other significant improvements:

  • Added support for customizing the fetch options in the generated TypeScript/JavaScript clients (#737). Thanks @PhakornKiong for the contribution!
  • Added support for defining Pub/Sub subscription handlers as methods (pubsub.MethodHandler) (#739)
  • Fixed emitting metrics from Pub/Sub subscription handlers (#738)
  • Fixed handling of encore:"optional" in the generated clients (TypeScript, JavaScript, OpenAPI) (#726)

What’s next

Right now we're working on adding support for deploying to Kubernetes, gRPC, and much more.

Stay tuned and please vote on your favorite feature on the roadmap!

As always, if you have questions, tell us on Slack or post on the Community Forum.

We’re excited to hear your feedback! ❤️

Full Changelog: https://github.com/encoredev/encore/compare/v1.19.0...v1.20.0

encore - Pub/Sub message ordering

Published by eandre over 1 year ago

We're excited to announce Encore v1.19.0 which brings a highly requested feature: support for message ordering in Pub/Sub!

Ordered topics ensure messages are delivered to subscribers in the order they were delivered (for messages that share the same ordering key). This can make it easier to implement certain use cases where message ordering is important.

Message ordering is not a free lunch and reduces message delivery throughput. To maintain topic order, messages with the same ordering key aren't delivered until the earliest message is processed or dead-lettered, potentially causing delays due to head-of-line blocking. For more information see the docs.

To create an ordered topic, define a message attribute to be used as the ordering attribute. For example:

import "encore.dev/pubsub"

type CartEvent struct {
	ShoppingCartID int `pubsub-attr:"cart_id"`
	Event          string
}

var CartEvents = pubsub.NewTopic[*CartEvent]("cart-events", pubsub.TopicConfig{
	DeliveryGuarantee: pubsub.AtLeastOnce,
	OrderingAttribute: "cart_id",
})

Remember to first update to the latest version of Encore using encore version update, and update your dependency on encore.dev within your app so your IDE sees the new configuration option, using go get -u encore.dev@latest.

What’s next

We're working on adding more flexibility in controlling underlying infra for individual services, deploying to Kubernetes, and much more. We're also working on bringing a bunch of improvements to the local development dashboard.

Stay tuned and please vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or post on the Community Forum.

We’re excited to hear your feedback, and happy Pub/Subbing! ❤️

encore - Exactly-once support for Pub/Sub

Published by marcuskohlberg over 1 year ago

We've been hard at work for a little bit on this one, and it's finally here!
Now when you create a Pub/Sub topic, you can specify an exactly-once delivery guarantee:

var Signups = pubsub.NewTopic[*SignupEvent]("signups", pubsub.TopicConfig{
    DeliveryGuarantee: pubsub.ExactlyOnce,
})

This provides a much stronger guarantee, backed by the cloud infrastructure used to run your app, that a message published will not be delivered multiple times to your application's subscriptions if processed without an error.
For more information checkout the docs.

Remember to first update to the latest version of Encore using encore version update, and update your dependency on encore.dev within your app so your IDE sees the new option using go get -u encore.dev@latest.

What's next for Pub/Sub

We plan to add support for ordered topics in the coming releases, which will allow you to process events in the order they were published based on a grouping key (e.g. user ID or order ID).

Full Changelog: https://github.com/encoredev/encore/compare/v1.17.0...v1.18.0

encore - Outboxes, Dashboards & Databases

Published by eandre over 1 year ago

May is here and here in Sweden we survived the yearly ritual bonfire night unscathed. We're excited to announce Encore v1.17.0 which brings even more features! As always, update with encore version update, or head over to the install docs to install Encore.

Transactional Outbox

One of the hardest parts of building an event-driven application is ensuring consistency between services. A common pattern is for each service to have its own database and use Pub/Sub to notify other systems of business events. Inevitably this leads to inconsistencies since the Pub/Sub publishing is not transactional with the database writes.

To better handle such use cases, Encore now provides a utility package for implementing the Transactional Outbox pattern. To use it make sure you're on Encore v1.17.0 (this release), then read up on the docs.

Code viewer 2.0

We've spruced up the code viewer over on the Cloud Dashboard. With this update, you now get cross-links to jump between code and the Service Catalog and Tracing. This makes it super quick to navigate between code and API Docs / Traces to see how everything connects. Check out the video below, or head over to the Uptime demo app to see it for yourself.

https://user-images.githubusercontent.com/425456/235785049-1dd4ec7b-0866-448a-87f1-5737be6a490e.mp4

Improved database management

Encore now supports creating databases using the new sqldb.NewDatabase, bringing the encore.dev/storage/sqldb package in line with the other infrastructure resources. This approach to creating databases is more explicit and better allows for future extensibility than the previous behavior (which implicitly created a database based on the presence of a migrations folder).

Test-only infrastructure

Encore now supports defining most infrastructure resources in _test.go files, allowing tests to declare their own infrastructure resources. This allows library code that operates on infrastructure resources to be more easily tested (normal infrastructure resources can only be defined within Encore services). For an example of such a use case see the new transactional outbox tests.

On a related note, most encore db commands now take an optional --test flag to connect to test databases.

Client generation service filter

The encore gen client command now supports filtering which services to be included in the output with the new --services flag. Thanks @jdbann for the suggestion!

Thanks to all contributors!

We rely on the community to improve Encore, and we continue to be humbled by your incredible support and encouragement. We've had a huge influx of suggestions and feedback recently, so a huge thank you to everyone. In particular, thanks to John Bannister, Juha Ristolainen, Che Sampat, Vilhelm Melkstam, Steven Edwards, Rafal Glowka, George Arscott, and George Antoniadis!

What’s next

We're working on adding more flexibility in controlling underlying infra for individual services, deploying to Kubernetes, and much more. We're also working on bringing a bunch of improvements to the local development dashboard.
Stay tuned and please vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or post on the Community Forum.

We’re excited to hear your feedback! ❤️

encore - Cookies, Pub/Sub, test execution speed, and more!

Published by eandre over 1 year ago

Spring is here and you know what that means! We're excited to announce a series of quality-of-life improvements to the Encore developer experience!

🍪 Cookie support

Cookies can now be used in auth handlers, offering an easy way to authenticate requests via cookies:

type MyAuthParams struct {
	// SessionCookie is set to the value of the "session" cookie.
	// If the cookie is not set it's nil.
	SessionCookie string `cookie:"session"`
}

//encore:authhandler
func AuthHandler(ctx context.Context, p *MyAuthParams) (auth.UID, error) {
    // ...
}

To set and read cookies in Encore APIs, use a raw endpoint.

Pub/Sub Topic references

Encore uses static analysis to determine which services are publishing messages to what topics. That information is used to provision infrastructure correctly, render architecture diagrams, and configure IAM permissions. This means that *pubsub.Topic objects can't be passed around however you'd like, as it makes static analysis impossible in many cases.

To better support use cases like passing topics to library code or using them with dependency injection, Encore now supports the ability
to get a Topic Reference that can be passed around any way you want:

var Signups = pubsub.NewTopic[*SignupEvent]("signups", pubsub.TopicConfig{
    DeliveryGuarantee: pubsub.AtLeastOnce,
})

// Create a topic reference that can be passed around arbitrarily
ref := pubsub.TopicRef[pubsub.Publisher[*SignupEvent]](Signups)

For more information see the docs

Fallback routes

Encore now supports defining fallback routes. Fallback routes are similar to wildcard routes,
but they are only matched if no other route matches the request. The primary use case for
fallback routes is to simplify migrating existing backends over to Encore.

With fallback routes you can define a catch-all endpoint that forwards requests to your existing
HTTP router with Encore, and then gradually move over endpoints one by one while preserving
the behavior for the remaining routes. For example:

//encore:api public raw path=/!fallback
func FallbackRoute(w http.ResponseWriter, req *http.Request) {
    // Forward the request to the existing router
    existingRouter.ServeHTTP(w, req)
}

Test speed

As a side effect of how Encore generated code for running tests the Go compiler ended up needing
to re-link binaries for every package being tested. This caused slow compilation times and slow tests.

We've tweaked Encore's code generation to handle this better, resulting in as much as a 2-3x improvement in test execution speed in many cases!

Panic stack traces

When your API handler panics Encore now displays a much nicer stack trace compared to before, allowing you to more easily pinpoint the issue. This works both in local development (encore run as well as the local trace viewer) as well as traces in cloud environments.

OpenAPI generator (experimental)

Encore now supports generating an OpenAPI specification for an API, using encore gen client --lang openapi <app-id>. Let us know what you think about the output and if you'd like to see something improved!

Bugfixes & other improvements

  • sqldb.DriverConn now offers a way to get the underlying *pgx.Conn from a standard library *database/sql.Conn.
  • The new Encore parser and runtime is now used everywhere and the old parser and runtime have been deleted, offering better performance and powering many of the features listed above

Thanks to all contributors!

We rely on the community to improve Encore, and we continue to be humbled by your incredible support and encouragement. A massive thank you to Brent Dillingham, Luka Giorgadze, Simon Vans-Colina, Otar Adamia, Phakorn Kiong, George Antoniadis, Jan Brucek, and more!

What’s next

We're working on adding more flexibility in controlling underlying infra for individual services, deploying to Kubernetes, and much more. We're also working on bringing a bunch of improvements to the local development dashboard.
Stay tuned and please vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or post on the Community Forum.

We’re excited to hear your feedback! ❤️

encore - Introducing API Explorer 2.0

Published by marcuskohlberg over 1 year ago

https://user-images.githubusercontent.com/78424526/231777223-af00a75e-d925-4479-8c78-9cdf2be4213d.mp4

Thanks to your feedback, we've made these changes for a more seamless workflow:

  • Fuzzy search endpoints with ⌘ + K - find what you need, fast!
  • Enhanced sidebar navigation - get a better overview at a glance
  • Upgraded endpoint testing - save authentication data with ease
  • Handy cross-links - view pre-filtered traces & flow diagrams per service/endpoint
  • UI facelift & bugfixes - enjoy a cleaner look and smoother experience
  • Services & endpoints now get dedicated urls - preparing for future content

Here's some of what we're considering next — let us know if it sounds valuable (or not):

  • Cross-linking to code for easy lookups
  • A widget displaying the last few traces per endpoint
  • Stats & metrics per service/endpoint

Bug-fixes and other improvements

Thanks to all contributors!

We rely on the community to improve Encore, and we continue to be humbled by your incredible support and encouragement. A massive thank you to Patryk Siemiński, Paweł Słomka, Brent Dillingham, Emily Rymer, John Bannister, Mason Stewart, Simon Vans-Colina, Ohm Patel, Jakob Nordfeldt, and many more!

What’s next

We're very close to releasing Encore's V2 parser and major speed improvements to running tests.
We're also working on adding more flexibility in controlling underlying infra for individual services, deploying to Kubernetes, and much more. Stay tuned and please vote on your favorite feature on the roadmap!

As always, if you have questions or feedback, tell us on Slack or post on the Community Forum.

We’re excited to hear your feedback! ❤️

Full Changelog: https://github.com/encoredev/encore/compare/v1.14.5...v1.15.0

encore - Introducing: Metrics

Published by marcuskohlberg over 1 year ago

Having easy access to metrics is a critical part of application observability. Encore now automatically provides metrics for your application for everyday use cases such as Request rate, Memory usage, and Goroutines. These work in all environments and are accessible from the Encore Platform.

By default, Encore also exports metrics data to your cloud provider's built-in monitoring service, so you can easily use your preferred observability tools.

Encore also makes it simple to define custom metrics for your application, which automatically display in the built-in metrics dashboard. Learn more in the docs.

metricspop

Grafana integration

Many teams already use observability tools like Grafana, so we've added an easy integration to help you get all your metrics in one place. (For fans of Datadog, an integration is coming very soon!)

Other improvements

There's a huge list of improvements since the last release announcement. Here are some highlights:

  • Added support for CORS Expose-Headers
  • Trace Logs now display as JSON
  • Local Dev Dash alerts if the app is not running
  • And many smaller improvements and bug-fixes

Full Changelog: https://github.com/encoredev/encore/compare/v1.13.0...v1.14.4