Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Cleanup and Organize Project Structure #282

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/blog/2023-01-13-edge-rate-limiting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Refresh the page, you should be redirected to the blocked page after 3 times.

### Less Remote Call with Caching

It is not efficient to make a remote call with each request. A useful feature of the @uptash/ratelimit package is that it caches data as long as the edge function is "hot". This means that data is only fetched from Redis when the function is "cold", reducing the number of remote calls. Caching can be implemented by declaring the `ratelimit` object outside the handler `function middleware`.
It is not efficient to make a remote call with each request. A useful feature of the @upstash/ratelimit package is that it caches data as long as the edge function is "hot". This means that data is only fetched from Redis when the function is "cold", reducing the number of remote calls. Caching can be implemented by declaring the `ratelimit` object outside the handler `function middleware`.

### Rate Limiting Algorithms

Expand Down
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
23 changes: 13 additions & 10 deletions src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import Bg from "@/components/bg";
import Container from "@/components/container";
import * as AboutIcon from "@/components/investor/icons";
import Investors from "@/components/investor/investors";
import PageBodyGradient from "@/components/page-body-gradient";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import { Metadata } from "next";

import Balancer from "react-wrap-balancer";

import { Investors, InvestorsIcons } from "@/components/investor";
import {
Bg,
Container,
PageBodyGradient,
PageHeaderDesc,
PageHeaderTitle,
} from "@/components";

export const metadata: Metadata = {
title: "About",
description: "We manage everything for you.",
Expand Down Expand Up @@ -86,21 +89,21 @@ const MISSIONS = [
title: "Fast",
desc: "We understand that every millisecond matters to you.",
icon: (
<AboutIcon.Fast className="text-[60px] text-emerald-400 md:text-[70px]" />
<InvestorsIcons.Fast className="text-[60px] text-emerald-400 md:text-[70px]" />
),
},
{
title: "Simple",
desc: "Keep the things as simple as possible but not simpler.",
icon: (
<AboutIcon.Simple className="text-[60px] text-emerald-400 md:text-[70px]" />
<InvestorsIcons.Simple className="text-[60px] text-emerald-400 md:text-[70px]" />
),
},
{
title: "Robust",
desc: "We aim to earn your trust with robust solutions.",
icon: (
<AboutIcon.Robust className="text-[60px] text-emerald-400 md:text-[70px]" />
<InvestorsIcons.Robust className="text-[60px] text-emerald-400 md:text-[70px]" />
),
},
];
20 changes: 11 additions & 9 deletions src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import Bg from "@/components/bg";
import Container from "@/components/container";
import PageBodyGradient from "@/components/page-body-gradient";
import Clap from "@/components/post/claps";
import PostHeader from "@/components/post/header";
import { Mdx } from "@/components/post/mdx";
import OtherPostCard from "@/components/post/other-post";
import PostTags from "@/components/post/tags";
import { notFound } from "next/navigation";

// import { generateBlogSchema } from "@/utils/structured-schema-generators";
import type { Post } from "@content";
import { allPosts } from "@content";
import { notFound } from "next/navigation";

import {
Clap,
Mdx,
OtherPostCard,
PostHeader,
PostTags,
} from "@/components/post";
import { Bg, Container, PageBodyGradient } from "@/components";

type Props = {
params: {
Expand Down
9 changes: 4 additions & 5 deletions src/app/blog/all/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Bg from "@/components/bg";
import PostListCard from "@/components/blog/list-item";
import Container from "@/components/container";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import type { Post } from "@content";

import { PostListCard } from "@/components/blog";
import { Bg, Container, PageHeaderDesc, PageHeaderTitle } from "@/components";

import { getData } from "../utils/helpers";

export default async function BlogPage() {
Expand Down
11 changes: 6 additions & 5 deletions src/app/blog/author/[author]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Bg from "@/components/bg";
import PostGridCard from "@/components/blog/grid-item";
import Container from "@/components/container";
import PageHeaderTitle from "@/components/page-header-title";
import Link from "next/link";

import type { Post } from "@content";
import { uniq } from "lodash";
import Link from "next/link";

import { PostGridCard } from "@/components/blog";
import { Bg, Container, PageHeaderTitle } from "@/components";

import { getData } from "../../utils/helpers";

type Props = {
Expand Down
13 changes: 6 additions & 7 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import Bg from "@/components/bg";
import PostGridCard from "@/components/blog/grid-item";
import PopularTag from "@/components/blog/popular-tag";
import Container from "@/components/container";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import Link from "next/link";

import { BANNED_TAGS } from "@/utils/const";
import type { Post } from "@content";
import { countBy, flatten, omit } from "lodash";
import Link from "next/link";

import { PopularTag, PostGridCard } from "@/components/blog";
import { Bg, Container, PageHeaderDesc, PageHeaderTitle } from "@/components";

import { getData } from "./utils/helpers";

export default async function BlogPage() {
Expand Down
11 changes: 6 additions & 5 deletions src/app/blog/tag/[tag]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Bg from "@/components/bg";
import PostGridCard from "@/components/blog/grid-item";
import Container from "@/components/container";
import PageHeaderTitle from "@/components/page-header-title";
import Link from "next/link";

import type { Post } from "@content";
import { uniq } from "lodash";
import Link from "next/link";

import { PostGridCard } from "@/components/blog";
import { Bg, Container, PageHeaderTitle } from "@/components";

import { getData } from "../../utils/helpers";

type Props = {
Expand Down
11 changes: 5 additions & 6 deletions src/app/brand/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import Bg from "@/components/bg";
import Container from "@/components/container";
import CopyButton from "@/components/copy-button";
import PageHeaderTitle from "@/components/page-header-title";
import cx from "@/utils/cx";
import { Metadata } from "next";
import { HTMLAttributes } from "react";
import { Metadata } from "next";

import cx from "@/utils/cx";

import {Bg, Container, CopyButton, PageHeaderTitle} from "@/components";

export const metadata: Metadata = {
title: "Brand Assets",
Expand Down
12 changes: 6 additions & 6 deletions src/app/careers/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Bg from "@/components/bg";
import CareerHeader from "@/components/career/header";
import Container from "@/components/container";
import PageBodyGradient from "@/components/page-body-gradient";
import { Mdx } from "@/components/post/mdx";
import { notFound } from "next/navigation";

import { SITE_URL } from "@/utils/const";
import { allJobs } from "@content";
import type { Job } from "@content";
import { notFound } from "next/navigation";

import CareerHeader from "@/components/career/header";
import { Mdx } from "@/components/post";
import { Bg, Container, PageBodyGradient } from "@/components";

type Props = {
params: {
Expand Down
9 changes: 4 additions & 5 deletions src/app/careers/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import Bg from "@/components/bg";
import Container from "@/components/container";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import { allJobs } from "@content";
import { Metadata } from "next";
import Link from "next/link";

import { allJobs } from "@content";

import {Bg, Container, PageHeaderDesc, PageHeaderTitle} from "@/components";

const description =
"Help us build the cutting edge data platform for the serverless era.";

Expand Down
10 changes: 6 additions & 4 deletions src/app/customers/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Container from "@/components/container";
import { Mdx } from "@/components/post/mdx";
import { allCustomers } from "@content";
import type { Customer } from "@content";
import Image from "next/image";
import Link from "next/link";
import { notFound } from "next/navigation";

import { allCustomers } from "@content";
import type { Customer } from "@content";

import { Mdx } from "@/components/post";
import { Container } from "@/components";

type Props = {
params: {
slug: string;
Expand Down
16 changes: 10 additions & 6 deletions src/app/customers/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"use client";

import Bg from "@/components/bg";
import Button from "@/components/button";
import Container from "@/components/container";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import { allCustomers } from "@content";
import Image from "next/image";
import Link from "next/link";

import { allCustomers } from "@content";

import {
Bg,
Button,
Container,
PageHeaderDesc,
PageHeaderTitle,
} from "@/components";

export default function CustomerPage() {
let customers = allCustomers.filter((o) => !o.draft);
customers = customers.sort((a, b) => (a.order || 99) - (b.order || 99));
Expand Down
16 changes: 8 additions & 8 deletions src/app/examples/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Button from "@/components/button";
import Container from "@/components/container";
import { ICON_NAMES } from "@/components/icon";
import IconQStash from "@/components/icon-qstash";
import IconRedis from "@/components/icon-redis";
import { authors } from "@/utils/authors";
import markdownToHtml from "@/utils/markdownToHtml";
import { HTMLProps } from "react";
import Link from "next/link";
import { notFound } from "next/navigation";
import { HTMLProps } from "react";

import { authors } from "@/utils/authors";
import markdownToHtml from "@/utils/markdownToHtml";
import Balancer from "react-wrap-balancer";

import { ICON_NAMES } from "@/components/icon";
import { Button, Container, IconQStash, IconRedis } from "@/components";

import { getData, type Example } from "../get-data";

type Props = {
Expand Down
9 changes: 4 additions & 5 deletions src/app/examples/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Bg from "@/components/bg";
import Container from "@/components/container";
import { Client } from "@/components/example/client";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import React from "react";

import { Client } from "@/components/example/client";
import { Bg, Container, PageHeaderDesc, PageHeaderTitle } from "@/components";

import { getData, type Example } from "./get-data";

// TODO: set canonical url
Expand Down
8 changes: 5 additions & 3 deletions src/app/fast/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Container from "@/components/container";
import FastResult from "@/components/fast/result";
import cx from "@/utils/cx";
import { Metadata } from "next";
import dynamic from "next/dynamic";
import Link from "next/link";

import cx from "@/utils/cx";

import {Container} from "@/components";
import FastResult from "@/components/fast/result";

const Globe = dynamic(() => import("@/components/home/fast/globe2"), {
ssr: false,
});
Expand Down
59 changes: 12 additions & 47 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import "@upstash/claps/style.css";
import "./globals.css";
import Analytics from "@/components/Analytics";
import Footer from "@/components/master/footer";
import Header from "@/components/master/header";
import HeaderMobile from "@/components/master/header-mobile";
import { PHProvider } from "@/lib/posthog";
import { SegmentProvider } from "@/lib/segment/provider";
import { SITE_URL } from "@/utils/const";
import cx from "@/utils/cx";

import { ReactNode, Suspense } from "react";
import dynamic from "next/dynamic";
import { Inter, Inter_Tight } from "next/font/google";
import Script from "next/script";
import { ReactNode, Suspense } from "react";

import { SITE_URL } from "@/utils/const";
import cx from "@/utils/cx";

import { PHProvider } from "@/lib/posthog";
import { SegmentProvider } from "@/lib/segment/provider";

import { Footer, Header, HeaderMobile } from "@/components/master";
import { Analytics, ThirdPartyScripts } from "@/components";

const PostHogPageView = dynamic(() => import("@/lib/posthog/page-view"), {
ssr: false,
Expand Down Expand Up @@ -51,43 +52,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
{children}
<Footer />
</SegmentProvider>

{process.env.NODE_ENV !== "development" && (
<>
<Script
id="ph_referral_track"
strategy="beforeInteractive"
dangerouslySetInnerHTML={{
__html: `
function removeTrailingSlash(url) {
return url.endsWith('/') ? url.slice(0, -1) : url;
}

(function() {
var referrer = document.referrer;
if (!referrer.includes('upstash.com')) {
document.cookie = 'ph_referral_track=' + removeTrailingSlash(referrer) + '; domain=.upstash.com';
}
})();
`,
}}
/>
<Script
strategy="afterInteractive"
src={`https://www.googletagmanager.com/gtag/js?id=G-QW5KRSTDM0`}
/>
<Script
id="ga"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: ` window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-QW5KRSTDM0');`,
}}
/>
</>
)}
<ThirdPartyScripts />
</body>
</PHProvider>
</html>
Expand Down
9 changes: 4 additions & 5 deletions src/app/pricing/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import "./page.css";
import Bg from "@/components/bg";
import Container from "@/components/container";
import PageHeaderDesc from "@/components/page-header-desc";
import PageHeaderTitle from "@/components/page-header-title";
import { Metadata } from "next";

import { ReactNode } from "react";
import { Metadata } from "next";

import { Bg, Container, PageHeaderDesc, PageHeaderTitle } from "@/components";

export const metadata: Metadata = {
title: "Pricing",
Expand Down
Loading