How kubowania/airbnb-sanity-backend works
Project Type & Purpose
• This is a headless-CMS backend for an AirBnB-style clone, built with Sanity.io.
• Its sole responsibility is to define/content-model your data (properties, users, reviews, images), expose it via Sanity’s Content Lake, and be consumed by a Next.js front end.
File Structure
• Top-level config directory holds Sanity Studio configuration (layouts, logins, form-builder).
• schemas/ defines all document and object types: Host, Traveller, Person, Property, PropertyImage, Review, plus the root schema.
• sanity.json and package.json define the project’s Sanity CLI settings, Studio plugins, scripts and dependencies.
• static/ is for any static assets you might surface in Studio.
• tsconfig.json for TypeScript typing in your schema code.
README for Additional Insights
• The README describes the tutorial flow: schema creation, Studio data entry, then a separate Next.js front-end that queries these schemas via GROQ and the Sanity SDK.
• External dependencies include Google Maps API for geolocation and marker clustering on the front end.
Main Components & Their Relationships
a. Developer Machine & Sanity Studio (local)
• Schema JS/TS files + config → Sanity Studio UI
• Studio’s “Deploy” or “Start” commands push schemas to Sanity’s managed Content Lake
b. Sanity Content Lake (hosted)
• Stores Documents (properties, users, reviews, images)
• Enforces schema validations & types
c. Next.js Front-end (separate repo)
• Uses @sanity/client SDK to run GROQ queries against Content Lake
• Renders pages via getServerSideProps/getStaticProps and React hooks
d. External Services
• Google Maps API: used by front end for geolocation, clustering, map display
Architectural Patterns & Design Principles
• Headless CMS pattern: content modeling (backend) decoupled from presentation (frontend)
• Single source of truth for data in Content Lake
• Clear separation of concerns:
• Schema code & Studio config in this repo
• Presentation & data-fetching logic in the Next.js repo
• Type-safe schemas via TypeScript