Skip to content

encoredev/example-app-uptime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encore - The Backend Development Engine

Uptime Monitoring System

This is an Encore application that continuously monitors the uptime of a list of websites.

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

Frontend Encore Flow

This took about 4 hours to build from scratch, including tests using Encore. It took 2 minutes to deploy, including databases, Pub/Sub topics, and cron jobs.

Tutorial

Check out the written tutorial (30 min) to learn how to build this application from scratch!

Install

You will need the Encore CLI to run and deploy this application.

To install Encore, run:

# macOS 
brew install encoredev/tap/encore

# Windows
iwr https://encore.dev/install.ps1 | iex

# Linux
curl -L https://encore.dev/install.sh | bash

Clone and run the app locally:

git clone git@github.com:encoredev/example-app-uptime.git
cd example-app-uptime

# Log in to Encore
encore auth login

# Set the Slack webhook secret (see tutorial above)
encore secret set SlackWebhookURL

# Run the app
encore run

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/checkall'

# Get the current status of all tracked sites
curl 'http://localhost:4000/sites'

Deployment

encore app create my-oncall-app-name
git push origin main

Then head over to https://app.encore.dev to find out your production URL, and off you go into the clouds!

Testing

encore test ./...

Contributing

All contributions are welcome! All we ask is that you adhere to the Code of Conduct