Skip to content

Latest commit

 

History

History
 
 

uptime

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Event-Driven Architecture Starter

This is an event-driven microservices application using Pub/Sub for asynchronous communication between services.

The example in this starter is an Uptime Monitoring System that continuously monitors the uptime of a list of websites.

When it detects a website is down, it posts a Slack message notifying that the website is down, and another message when the website is back up again.

It has a react frontend and you can try a demo version here.

Frontend Architecture

Build from scratch with a tutorial

If you prefer, check out the tutorial to learn how to build this application from scratch.

Developing locally

When you have installed Encore, you can create a new Encore application and clone this example with this command.

encore app create my-app-name --example=uptime

Running locally

Run your application:

encore run

To use the Slack integration, set the Slack Webhook URL (see tutorial above):

encore secret set SlackWebhookURL

Note that to avoid confusion, Cron Jobs do not execute when running locally.

Local Development Dashboard

While encore run is running, open http://localhost:9400/ to access Encore's local developer dashboard.

Here you can see API docs, make requests in the API explorer, and view traces of the responses.

View the frontend

While encore run is running, head over to http://localhost:4000/frontend/ to view the frontend for your uptime monitor.

Using the API

Check if a given site is up (defaults to 'https://' if left out):

curl 'http://localhost:4000/ping/google.com'

Add a site to be automatically pinged every 1 hour:

curl 'http://localhost:4000/site' -d '{"url":"google.com"}'

Check all tracked sites immediately:

curl -X POST 'http://localhost:4000/check-all'

Get the current status of all tracked sites:

curl 'http://localhost:4000/status'

Deployment

Deploy your application to a staging environment in Encore's free development cloud:

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

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

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

Now off you go into the clouds!

Testing

encore test ./...