Skip to content

marcuskohlberg/demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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 5 minutes:

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 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 ./...

About

An Encore demo app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages