DEV Community

Cover image for Build a GenAI Text-to-Speech App in TypeScript
Marcus Kohlberg for Encore

Posted on • Edited on

11 4 4 4 4

Build a GenAI Text-to-Speech App in TypeScript

Try your hand at AI app development with this Encore for TypeScript example app, implementing an AI powered text-to-speech generator.

This fun app project lets you create your own text-to-speech app, powered by ElevenLabs' cutting-edge API for generative voice AI.

It's a great way to experiment with the latest in AI technology and enhance your developer skills.

GenAI App

In a few short minutes, you'll learn how to:

  • Create apps with Encore
  • Run your app locally
  • Get your free ElevenLabs API key and store it using Encore's Secret manager
  • Deploy your app to the cloud for free

Ready to bring your text to life?

💽 Install Encore

Install the Encore CLI to run your local environment:

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

Create your app

Create your Encore app and clone the start template with this command:



encore app create my-app --example=ts/elevenlabs


Enter fullscreen mode Exit fullscreen mode

Get your API key and store it using Secrets

You will need an API key from ElevenLabs to use this package. You can get one by signing up for a free account at: https://elevenlabs.io/

Once you have the API key, set it as an Encore secret using the name ElevenLabsAPIKey, using this command:



encore secret set --type dev,prod,local,pr ElevenLabsAPIKey


Enter fullscreen mode Exit fullscreen mode

This sets the secret for all types of Encore environments dev, prod, local, and pr (preview environments). If you prefer, you can later use different API keys in different environments.

Run your app locally

To start your app locally, you only need to run one command to start all your local infrastructure:



encore run


Enter fullscreen mode Exit fullscreen mode

🕹 Try it out: While encore run is running, open http://localhost:4000/ to see the frontend.

💡You can also access Encore's local developer dashboard on http://localhost:9400/ to view traces, API documentation, and more.

encore local dev dash

🚀 Deploy to the cloud

It's super simple to deploy your app to the cloud using Encore, it automatically provisions all the necessary infrastructure in your AWS or GCP account.

You can also deploy your application to a staging environment in Encore's free development cloud by using git push encore:



git add -A .
git commit -m 'Commit message'
git push encore


Enter fullscreen mode Exit fullscreen mode

Then head over to the Cloud Dashboard to monitor your deployment and find your cloud URL.

From there you can also connect your own AWS or GCP account to use for deployment.

🚀 Now you have a working GenAI app running in the cloud, great job!

Wrapping up

Image of Stellar post

From Hackathon to Funded - Stellar Dev Diaries Ep. 1 🎥

Ever wondered what it takes to go from idea to funding? In episode 1 of the Stellar Dev Diaries, we hear how the Freelii team did just that. Check it out and follow along to see the rest of their dev journey!

Watch the video

Top comments (0)

Tiugo image

Fast, Lean, and Fully Extensible

CKEditor 5 is built for developers who value flexibility and speed. Pick the features that matter, drop the ones that don’t and enjoy a high-performance WYSIWYG that fits into your workflow

Start now

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay