TL;DR
In this short guide we'll deploy the foundation for an appointment booking app (similar to Calendly) in Go using Encore.
We'll use an example project to get started, and in just a few minutes you will have an app running in Encore's free development cloud β ready for you to keep building on top of.
If you want to build it yourself step-by-step, check out the complete tutorial here.
The finished appointment booking app will look like this:
π What's on deck
- Install Encore
- Create your app
- Run locally
- Save SendGrid API key using Encore's secret manager
- Deploy to Encore's free development cloud
π Let's go!
π½ 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
Let's create our app from a starter template by running:
encore app create my-app --example=booking-system
This will create an Encore app using a template for an Appointment Booking System.
It has both a user facing section (finding and booking appointments) and an admin section (setting availability and managing scheduled appointments).
The frontend is a React app and the backend is a Go microservices application with an event-driven architecture using Pub/Sub.
When a new appointment is booked, the backend sends a confirmation email to the user (using a Sendgrid integration).
Not implemented in the example:
- Calendar integration with e.g. Google Calendar
- Authentication for admin login
Here's the architecture diagram, generated by Encore:
(White boxes are services, and the black box is a Pub/Sub topic.)
π Run the app locally
To run locally you need to have Docker installed and running.
Then run your application:
encore run
You should see this:
π Open the Local Development Dashboard
While encore run
is running, open http://localhost:9400/ to access Encore's local development dashboard.
Here you can see API docs, make requests in the API explorer, and view traces of the responses.
π₯ Open the app in your browser
While encore run
is running, head over to http://localhost:4000/frontend/ to view the frontend for your appointment booking system.
π Set SendGrid API Key
Before we deploy our app to the cloud, we need to set an API key for the SendGrid integration. We can use Encore's built-in secrets manager to securely store our key.
You will need an API key from SendGrid to use this package. You can get one by signing up for a free account at https://sendgrid.com/.
(Or if you just want to test out the deployment flow, you can just use any random string.)
Once you have the API key, set it as a secret using the name SendGridAPIKey
.
encore secret set --dev SendGridAPIKey
This sets the key for development environments. It is good practice to separate API keys for development and production environments, so for prod we can set a separate key using:
encore secret set --prod SendGridAPIKey
Please note that emails will only be sent in the production environment to avoid spending your email sending limits.
PS. You can also use the Secret Manager UI in Encore's Cloud Dashboard.
π Deploy to the cloud
Simply push to deploy your application to a staging environment in Encore's free development cloud:
git add -A .
git commit -m 'First commit'
git push encore
Then head over to the Cloud Dashboard to monitor your deployment.
Encore will automatically provision all the necessary infrastructure, including compute instances, databases, Pub/Sub, and more.
Once the deploy is completed, you can find your app's URL by opening the staging
environment in the Cloud Dashboard, it will be something like:
https://staging-my-app-gfoi.encr.app/frontend/
π Great job, you're done!
You now have a scalable Go based app running in the cloud, ready for you to extend further or use as inspiration for your next project.
Explore the Cloud Dashboard
From the Cloud Dashboard you can also connect your own AWS or GCP account to use for production deployment, connect GitHub, and view traces, metrics, and API docs for your cloud environments.
Wrapping up
- βοΈ Support the project by starring Encore on GitHub.
- Learn more about building Go apps with Encore using these Tutorials.π
- Find inspiration on what to build with these Open Source App Templates.π
- If you have questions or want to share your work, join the developers hangout in Encore's community on Discord.π
Top comments (3)
What a joke! What you do is just to run an Encore template but the title of the post like you gonna teach people something new and valuable
Hey @louisquach, yes this guide was condensed for a few reasons.
If you're interested in a more comprehensive tutorial, here's a longer version: encore.dev/docs/tutorials/booking-...
I will update the article and include this at the start.
Great article, Thanks for Sharing!