You are browsing as a guest. Sign up (or log in) to start making projects!

CloudNext Dashboard

  • 1 Devlogs
  • 1 Total hours

A custom, Next.JS based CloudFlare dashboard using the existing CloudFlare API, with an authentication system to keep your data safe. It will hopefully have a DNS record viewer, cloudflare worker status, and site metrics.

Open comments for this post

1h 2m 48s logged

Devlog 1 - API Building!

Hey! This is my first devlog for CloudNext, a Next.js-based dashboard using the Cloudflare API. I’m building this because I wanted something simple to check my Cloudflare stats without having to dig through all the menus.

Most of my time was spent creating and debugging the four API endpoints I’ve made so far. The debugging took much longer than expected because, in my infinite wisdom, I created the wrong type of API token (an Account Token instead of a User Token). No matter what I tried, every request was blocked. (I know… I’m so smart.)

The four endpoints I have working at the moment are:

  • Zones Endpoint – Shows information about your Cloudflare-managed domains.
  • DNS Endpoint – Lists all of your DNS records, and maybe in the future I’ll add the ability to create or edit records.
  • Analytics Endpoint – Displays information like DNS query counts and other traffic analytics for your domains.
  • SSL Endpoint – Shows your current SSL/TLS encryption mode and whether your certificates are active or valid.

Now that I have a working API, the next step is to build a nice-looking dashboard using placeholder data. Once the UI is finished, I’ll hook everything up to the live Cloudflare data.

The logic itself is actually pretty simple. Each endpoint just makes a request to the Cloudflare API and returns the response as JSON. I tested everything in Insomnia first because it gives really nice output for debugging. Here’s the Zones endpoint:

import { NextResponse } from "next/server";
import cf from "@/lib/cloudflare/client"; // This just imports the Cloudflare API Client 

export async function GET() {
  try {
    const zones = await cf.zones.list();
    return NextResponse.json(zones);
  } catch (error) {
    return NextResponse.json(
      { error: "Failed to fetch zones" },
      { status: 500 }
    );
  }
}

Anyway, thanks for reading this Devlog! Maybe the next one will be a bit shorter lol

0
0
14

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…