Next.js Component Templates

Build OASIS components for Next.js 13+ with App Router and Server Components.

Server Component Template

// app/components/ServerComponent.tsx
import { OASISServerClient } from '@oasis/webui-devkit-nextjs/server';

interface Props {
  avatarId: string;
}

export default async function ServerComponent({ avatarId }: Props) {
  const client = new OASISServerClient();
  const data = await client.getData(avatarId);

  return (
    <div className="oasis-server-component">
      <h3>{data.title}</h3>
      <pre>{JSON.stringify(data, null, 2)}</pre>
    </div>
  );
}

Client Component Template

Server Actions Template

API Route Template

Middleware Template

Priority Components

1. Server: AvatarDetailServer

2. Client: KarmaManagement

3. Hybrid: NFTGallery

Layout with Providers

Streaming and Suspense

Remaining Components

Server Components:

  • KarmaLeaderboardServer

  • NFTGalleryServer

  • SocialFeedServer

Client Components:

  • AvatarSSO (client)

  • Messaging (client)

  • DataManagement (client)

  • ProviderManagement (client)

  • OASISSettings (client)

  • Notifications (client)

  • ChatWidget (client)

  • GeoNFTMap (client)

Hybrid Components:

  • AchievementsDisplay

  • FriendsList

  • GroupManagement

Last updated