Skip to main content

Member dining app

Goal: A small Next.js app that signs a member in with Blackbird, lists restaurants, and shows their passport — built from @flynetdev/core and @flynetdev/react.
Prep time: ~15 minutes

Mise en place

  • @flynetdev/core — OAuth (with PKCE) and server-side Discovery
  • @flynetdev/reactFlynetProvider, ConnectWithBlackbird, RestaurantList, UserPassport
Build the authorize URL on the server. FlynetOAuth adds the PKCE code_challenge; stash the matching verifier and CSRF state in an httpOnly cookie for the callback.
app/connect/route.ts
app/page-connect.tsx

Second course — the restaurant list

Discovery uses the API key, which stays on the server. RestaurantList is presentational — hand it the data you fetched.
app/page.tsx

Main course — the passport

Exchange the code for tokens, then render the member component under FlynetProvider with a member client.
app/callback/route.ts
app/passport.tsx
Chef’s warning — The API key and CLIENT_SECRET are server-only; never ship them to the browser. PKCE is required on authorize — FlynetOAuth adds the code_challenge, and the matching code_verifier must reach exchangeCode (so it has to survive the redirect, hence the cookie).
From the kitchenFlynetProvider owns the TanStack Query client; don’t construct your own. Give it a FlynetMemberClient for member components, and a FlynetDiscoveryClient too if you render discovery components on the client.
Next: Build with AI — build the next one with an AI agent.