Skip to content

fahreddinozcan/upstats

Repository files navigation


Uptime Monitor with QStash

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.

Project Details

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.

Stack

Deployment

Deploy with Vercel

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.

Vercel Credentials

Alternatively, you can fork this repository and deploy it to any other platform of choice.

To gather the credentials, please follow:

  1. Redis Secrets Navigate to Upstash Console, and create a database. Then, copy the UPSTASH_REDIS_NEXT_URL and UPSTASH_REDIS_NEXT_TOKEN variables to necessary fields in .env.local file.

    Redis Credentials

  2. QStash Secrets Again in the Upstash Console, navigate to QStash section. And copy the necessary fields.

    QStash Credentials

  3. App URL Finally, fill in the destination URL for your uptime monitor.

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

    Create Schedule

If you have any questions related to the process, please visit Upstash Documentation, or get in touch via mail

Learn More

To learn more about Upstash and its services, check out the following resources: