How shubhsk88/realbnb-frontend works
Project type and purpose
• This is a front-end for a vacation-rental platform (“Realbnb”) built with Next.js (React + TypeScript).
• It communicates with a GraphQL backend (Express + Prisma) and integrates external services (Stripe for payments, Twilio for phone verification, Algolia for search, Google OAuth for login).
File structure
• Top-level:
• pages/ — Next.js routes (SSR/SSG entry points).
• components/ — React UI components (Auth, Algolia, Booking, common UI primitives).
• graphql/ — .graphql query/mutation files, organized by domain (user, room, reservation, list).
• generated/ — GraphQL Codegen output (typed hooks, schema).
• lib/ — Apollo Client setup, auth helpers, cache config.
• utils/ — shared utilities (date formatting, custom hooks).
• Configs: next.config.js, tsconfig.json, codegen.yml, .eslintrc, package.json.
• No server code here—this repo is purely the front-end that calls out to an external GraphQL API.
README for additional insights
• Confirms React/Next.js front-end talking to GraphQL + Prisma + Express backend.
• Lists external integrations: Stripe, Twilio, Algolia, Google Sign‐In.
• Highlights features (search, booking, payments, save listings).
a. Main components
• Client Browser (Next.js pages + React components)
• Next.js App Server (SSR/SSG, routing, rendering)
• Apollo Client (GraphQL queries/mutations)
• GraphQL API Server (Express + Apollo Server + Prisma)
• Database (PostgreSQL or similar)
• External Services:
– Stripe (payment processing)
– Twilio (phone verification)
– Algolia (search index)
– Google OAuth (social login)
b. Relationships & interactions
1. User’s browser requests a Next.js page → Next.js server renders or hydrates React.
2. React/Apollo issues GraphQL queries → GraphQL API server.
3. GraphQL resolvers use Prisma to read/write the database.
4. For payments, GraphQL server calls Stripe’s API.
5. For phone login, GraphQL server calls Twilio.
6. For full-text search/autocomplete, Next.js invokes Algolia client in browser.
c. Architectural patterns/principles
– Component-based UI (atomic common components under components/common).
– Domain-organized GraphQL queries (graphql/lists, graphql/room, graphql/user…).
– API client abstraction (lib/apolloClient, lib/auth, context providers).
– Codegen for type safety (generated/ folder via codegen.yml).
– SSR/SSG benefits for SEO and performance.
d. Key technologies/frameworks
– Next.js + React + TypeScript
– Chakra UI for styling
– Apollo Client for GraphQL
– GraphQL + Apollo Server + Prisma on backend
– Stripe, Twilio, Algolia, Google OAuth
Essential elements
• Search: browser directly to Algolia vs. GraphQL-mediated data.
• SSR/SSG roles of Next.js and where Apollo cache is used.