Create an serverless uptime monitoring service using QStash and Upstash Redis
Welcome! This example showcases a uptime monitoring system to observe the stability of your API endpoints and web applications. It uses QStash for task scheduling, Upstash Redis as state store and Next.js, combined with beautiful ShadnUI.
The goal of this project is to create a serverless uptime status checker, without any long running server. To achieve this, we deploy Vercel Edge functions with Next.js, and schedule a job to this endpoints with QStash. Within these functions, we perform the ping operation and write the results to Upstash Redis using the proper data structures. On visit, we retrieve the data in Redis and render the page with Server Side Rendering.
- App logic: Next.js
- Job scheduling: QStash
- State store and database: Upstash Redis
- UI Library: ShadcnUI
You can deploy the project using the Deploy with Vercel button located above. After logging in to vercel, you can start the configuration of the project by filling in the credentials. This is rather a simple process, and you'll have your own deployment under several minutes.
Alternatively, you can fork this repository and deploy it to any other platform of choice.
To gather the credentials, please follow:
-
Redis Secrets Navigate to Upstash Console, and create a database. Then, copy the
UPSTASH_REDIS_NEXT_URL
andUPSTASH_REDIS_NEXT_TOKEN
variables to necessary fields in.env.local
file. -
QStash Secrets Again in the Upstash Console, navigate to QStash section. And copy the necessary fields.
-
App URL Finally, fill in the destination URL for your uptime monitor.
-
Creating the schedule Then, head over to Upstash Console, and create a job without a body to your project url. We'll implement this project with a frequency of half an hour. The destination of this schedule should be
https://<YOUR_DOMAIN>/edge/check
. In the body of the request, we'll provide the url.
If you have any questions related to the process, please visit Upstash Documentation, or get in touch via mail
To learn more about Upstash and its services, check out the following resources: