Announcement

Announcing the AssemblyAI Starter App for Encore

Learn how to quickly get started developing Speech AI applications using Encore and the new AssemblyAI starter app for Go.

Announcing the AssemblyAI Starter App for Encore

Do you have an idea for a Speech AI app, but you don't want to start from scratch? Are you curious about how to use AssemblyAI in a production-like environment?

In this post, you'll learn how you can deploy a ready-made Speech AI application to the cloud, using Encore and the new AssemblyAI starter app for Go. The app lets you transcribe local audio files of conversations with Speaker Diarization enabled, so that you can follow what each speaker said, and when.

What is Encore?

Encore is a development platform that makes it easier to build and operate APIs and event-driven systems.

Encore has a generous free tier for developers building prototypes or hobby projects. It's a great way to get your Speech AI app up and running and share it with your friends and team members.

Introducing the AssemblyAI starter app for Encore

Encore has a wide range of example apps that you can use as starting points when creating your own. With the recently added assemblyai-starter example, you can now bootstrap your very own Speech AI app with a single command.

If you're not already using Encore, you first need to install the Encore CLI with one of the following commands:

  • macOS: brew install encoredev/tap/encore
  • Windows: iwr https://encore.dev/install.ps1 | iex
  • Linux: curl -L https://encore.dev/install.sh | bash

With the Encore CLI installed, create your Encore app from the AssemblyAI starter template. Later we’ll look at how to use it, and what the architecture looks like.

encore app create assemblyai-app --example=assemblyai-starter

If you haven't used Encore before, follow the instructions to create a free account.

Before we deploy the app, let's configure the app to use your AssemblyAI API key.

In your terminal, run the following command to configure a secret called AssemblyAIAPIKey for both your local and cloud environments.

encore secret set --type dev,local AssemblyAIAPIKey

Next, you should also configure a secret for authenticating webhooks. Set AssemblyAIWebhookSecret to a value that AssemblyAI should return in the HTTP header of every webhook request. The backend verifies that all webhook deliveries contain this value.

encore secret set --type dev,local AssemblyAIWebhookSecret

Finally, to deploy the app, push the code to Encore using Git:

cd assemblyai-app
git push encore

Your app should be live about now. Visit the Encore dashboard and select your app to find the public URL.

Open the app in your browser. The starter app comes with a frontend that you can access by adding /frontend to the app URL.

https://staging-{{ ENCORE_APP_NAME }}.encr.app/frontend

How to use the app

The starter app lets you upload local audio files for transcription. All transcriptions have Speaker Diarization enabled to detect who said what, and when.

To transcribe an audio file from the UI:

  1. In the upper-left corner, click Browse, and select the audio file you want to transcribe.
  2. Click Upload to start uploading the audio to AssemblyAI's servers. Once the file has been uploaded, you'll see the transcription in the list below with a Waiting status.

Once the transcription status changes from Waiting to Completed, you can click the transcript to view the transcribed conversation.

You can also manually sync the transcript by selecting a transcript in the list and then clicking Sync.

If you don't have any audio files at hand, here's a couple you can use:

Overview of the app architecture

The starter app consists of three components:

  • A frontend built with React and Tailwind CSS
  • A backend built with Go and the AssemblyAI Go SDK
  • A PostgreSQL database to store finished transcripts

To better understand what the app is doing, here's the main flow:

  1. Uploading an audio file through the frontend calls the /api/upload endpoint in the backend.
  2. The API uploads the audio to AssemblyAI, submits it for transcription, and then records it in the database.
  3. When the transcription has finished, AssemblyAI calls the /api/webhook endpoint to let the backend know the transcript is ready.
  4. The backend stores the transcript in the database.
  5. The frontend calls the /api/transcript/:id endpoint to get the transcribed conversation.

To avoid having to poll AssemblyAI when the transcript has finished, the app instead configures a webhook for every transcription. This means that we can safely wait for AssemblyAI to let us know when the transcript is ready.

Developing locally

To run the application locally, you’ll also need to install Docker. Then run the following command in the app directory:

encore run

Encore provisions a local Docker-based environment that replicates your cloud environment.

Browse to https://localhost:4000/frontend to test while you develop.

Any changes to the backend will build and restart the service automatically. If you make changes to the frontend, you'll need to run npm run build to rebuild the frontend assets.

Note that since AssemblyAI can't access your app when it's running locally, webhooks are disabled by default.

Summary

The starter app is a great place for Go developers to start experimenting with the AssemblyAI API.

We encourage you to try out the new starter app for Go. If you have any questions, or run into any issues with the app, you can either submit an issue or ask us in our Discord community.