Openstatus
www.openstatus.dev
1import * as z from "zod";
2
3const schema = z.object({
4 stargazers_count: z.number(),
5});
6
7export async function getGitHubStars() {
8 const res = await fetch(
9 "https://api.github.com/repos/openstatusHQ/openstatus",
10 { next: { revalidate: 600 } }, // 10min
11 );
12 const json = await res.json();
13 const github = schema.safeParse(json);
14
15 if (!github.success) return 0;
16 return github.data.stargazers_count;
17}