[{"data":1,"prerenderedAt":8881},["ShallowReactive",2],{"content-navigation":3,"$fY4mAj2l3kRkTDttxn6FGzqBc2O9HAJ2qp-_8LmMX7aw":1825,"/tutorials/projects/build-an-hotel-booking-platform-with-next-js-stripe-and-directus-automate":1830},[4,112,119,224,333,429,481,1087,1113,1142],{"title":5,"path":6,"stem":7,"children":8,"page":89},"Partials","/_partials","_partials",[9,15,20,25,29,33,38,42,47,51,56,60,64,68,90,94,98,103,108],{"title":10,"path":11,"stem":12,"description":13,"icon":14,"links":14},"Advanced Field Creation Mode","/_partials/advanced-field-creation-mode","_partials/advanced-field-creation-mode","You can use these advanced options to automatically set the values of fields at specific events by clicking on \"Continue in Advanced Field Creation Mode\".",null,{"title":16,"path":17,"stem":18,"description":19,"icon":14,"links":14},"Authentication","/_partials/authentication","_partials/authentication","While the Public role can be configured to make data available without authentication, anything that is not public requires a user to authenticate their requests.",{"title":21,"path":22,"stem":23,"description":24,"icon":14,"links":14},"Config Env Vars","/_partials/config-env-vars","_partials/config-env-vars","",{"title":26,"path":27,"stem":28,"description":24,"icon":14,"links":14},"Deployment Public Instance","/_partials/deployment-public-instance","_partials/deployment-public-instance",{"title":30,"path":31,"stem":32,"description":24,"icon":14,"links":14},"Engine Studio Box","/_partials/engine-studio-box","_partials/engine-studio-box",{"title":34,"path":35,"stem":36,"description":37,"icon":14,"links":14},"Extension Hook Footguns","/_partials/extension-hook-footguns","_partials/extension-hook-footguns","Directus reads system collections to operate. Be careful when modifying the output of system collection read or query events. Also ensure not to directly or indirectly emit the same event your hook is handling or you will create an infinite loop.",{"title":39,"path":40,"stem":41,"description":24,"icon":14,"links":14},"Extension Hook System Collections","/_partials/extension-hook-system-collections","_partials/extension-hook-system-collections",{"title":43,"path":44,"stem":45,"description":46,"icon":14,"links":14},"Extensions Api","/_partials/extensions-api","_partials/extensions-api","This extension type is loaded into the Directus process. They can use the provided services exported by the @directus/extensions-sdk package and can be written in JavaScript or TypeScript.",{"title":48,"path":49,"stem":50,"description":24,"icon":14,"links":14},"Extensions Api Internals","/_partials/extensions-api-internals","_partials/extensions-api-internals",{"title":52,"path":53,"stem":54,"description":55,"icon":14,"links":14},"Extensions App","/_partials/extensions-app","_partials/extensions-app","This extension type is loaded into the Directus Data Studio. They are are built with Vue 3, and can use the provided composables exported by the @directus/extensions-sdk package. Extensions can be written in JavaScript or TypeScript.",{"title":57,"path":58,"stem":59,"description":24,"icon":14,"links":14},"Extensions App Internals","/_partials/extensions-app-internals","_partials/extensions-app-internals",{"title":61,"path":62,"stem":63,"description":24,"icon":14,"links":14},"Extensions Theme","/_partials/extensions-theme","_partials/extensions-theme",{"title":65,"path":66,"stem":67,"description":24,"icon":14,"links":14},"Extensions Uid","/_partials/extensions-uid","_partials/extensions-uid",{"title":69,"path":70,"stem":71,"children":72,"page":89},"Home Hero","/_partials/home-hero","_partials/home-hero",[73,77,81,85],{"title":74,"path":75,"stem":76,"description":24,"icon":14,"links":14},"Auth","/_partials/home-hero/auth","_partials/home-hero/auth",{"title":78,"path":79,"stem":80,"description":24,"icon":14,"links":14},"Data","/_partials/home-hero/data","_partials/home-hero/data",{"title":82,"path":83,"stem":84,"description":24,"icon":14,"links":14},"File","/_partials/home-hero/file","_partials/home-hero/file",{"title":86,"path":87,"stem":88,"description":24,"icon":14,"links":14},"Realtime","/_partials/home-hero/realtime","_partials/home-hero/realtime",false,{"title":91,"path":92,"stem":93,"description":24,"icon":14,"links":14},"Json Function","/_partials/json-function","_partials/json-function",{"title":95,"path":96,"stem":97,"description":24,"icon":14,"links":14},"License","/_partials/license","_partials/license",{"title":99,"path":100,"stem":101,"description":102,"icon":14,"links":14},"Query Functions","/_partials/query-functions","_partials/query-functions","Functions accept a field and return a modified value. Functions can be used in any query parameter you'd normally supply a field key, including fields, aggregation, and filters.",{"title":104,"path":105,"stem":106,"description":107,"icon":14,"links":14},"Quickstart Making Calls","/_partials/quickstart-making-calls","_partials/quickstart-making-calls","You can use a visual API testing tool like Postman or Hoppscotch, a terminal-based based tool like curl or HTTPie, or make HTTP requests directly in a script written in your programming language of choice.",{"title":109,"path":110,"stem":111,"description":24,"icon":14,"links":14},"Snippet Auth Token","/_partials/snippet-auth-token","_partials/snippet-auth-token",{"title":113,"path":114,"stem":115,"children":116,"description":118,"icon":14,"links":14},"Directus API Reference","/api","api/index",[117],{"title":113,"path":114,"stem":115,"description":118,"icon":14,"links":14},"Learn how to use our API",{"title":120,"path":121,"stem":122,"children":123,"page":89},"Cloud","/cloud","cloud",[124,144,174,204],{"title":125,"path":126,"stem":127,"children":128,"page":89},"Getting Started","/cloud/getting-started","cloud/1.getting-started",[129,134,139],{"title":130,"path":131,"stem":132,"description":133,"icon":14,"links":14},"Introduction","/cloud/getting-started/introduction","cloud/1.getting-started/1.introduction","Whether you're a hobbyist, startup, or enterprise, our flexible Directus Cloud platform lets you get up and running with Directus quickly.",{"title":135,"path":136,"stem":137,"description":138,"icon":14,"links":14},"Cloud Teams","/cloud/getting-started/teams","cloud/1.getting-started/2.teams","A team is an organizational system that groups accounts together as team members and provides consolidated billing for projects.",{"title":140,"path":141,"stem":142,"description":143,"icon":14,"links":14},"Managing Cloud Accounts","/cloud/getting-started/accounts","cloud/1.getting-started/3.accounts","An account is your portal to Directus Cloud. You can use it to manage your teams, team members, projects and billing.",{"title":145,"path":146,"stem":147,"children":148,"page":89},"Projects","/cloud/projects","cloud/2.projects",[149,154,159,164,169],{"title":150,"path":151,"stem":152,"description":153,"icon":14,"links":14},"Create a Project","/cloud/projects/create","cloud/2.projects/1.create","Create a project in Directus Cloud.",{"title":155,"path":156,"stem":157,"description":158,"icon":14,"links":14},"Destroy a Project","/cloud/projects/destroy","cloud/2.projects/2.destroy","Destroy a Directus Cloud project and cancel your subscription.",{"title":160,"path":161,"stem":162,"description":163,"icon":14,"links":14},"Version Upgrades","/cloud/projects/version-upgrades","cloud/2.projects/3.version-upgrades","Learn about automatic upgrades and version locking in Directus Cloud.",{"title":165,"path":166,"stem":167,"description":168,"icon":14,"links":14},"Monitoring Projects","/cloud/projects/monitoring","cloud/2.projects/4.monitoring","Learn how to monitor your Directus Cloud project.",{"title":170,"path":171,"stem":172,"description":173,"icon":14,"links":14},"Backups","/cloud/projects/backups","cloud/2.projects/5.backups","Learn about automatic backups in Directus Cloud.",{"title":175,"path":176,"stem":177,"children":178,"page":89},"Configuration","/cloud/configuration","cloud/3.configuration",[179,184,189,194,199],{"title":180,"path":181,"stem":182,"description":183,"icon":14,"links":14},"Custom Domains","/cloud/configuration/custom-domains","cloud/3.configuration/1.custom-domains","Learn how to set up a custom domain for your Directus Enterprise Cloud project.",{"title":185,"path":186,"stem":187,"description":188,"icon":14,"links":14},"Environment Variables","/cloud/configuration/environment-variables","cloud/3.configuration/2.environment-variables","Learn about environment variables in Directus Cloud.",{"title":190,"path":191,"stem":192,"description":193,"icon":14,"links":14},"Direct Database Access","/cloud/configuration/direct-database-access","cloud/3.configuration/3.direct-database-access","Learn how to directly access your Directus Cloud project's database.",{"title":195,"path":196,"stem":197,"description":198,"icon":14,"links":14},"Custom Extensions","/cloud/configuration/custom-extensions","cloud/3.configuration/4.custom-extensions","Learn how to deploy custom extensions to your Directus Cloud project.",{"title":200,"path":201,"stem":202,"description":203,"icon":14,"links":14},"Datacenter Regions","/cloud/configuration/datacenter-regions","cloud/3.configuration/5.datacenter-regions","Learn where datacenters for cloud projects are located.",{"title":205,"path":206,"stem":207,"children":208,"page":89},"Billing","/cloud/billing","cloud/4.billing",[209,214,219],{"title":210,"path":211,"stem":212,"description":213,"icon":14,"links":14},"Manage Billing","/cloud/billing/manage-billing","cloud/4.billing/1.manage-billing","Learn how to manage billing for your Directus Cloud project.",{"title":215,"path":216,"stem":217,"description":218,"icon":14,"links":14},"Changing Your Tier","/cloud/billing/changing-tier","cloud/4.billing/2.changing-tier","Learn how to change the tier of your Directus Cloud project.",{"title":220,"path":221,"stem":222,"description":223,"icon":14,"links":14},"Cancel Your Subscription","/cloud/billing/cancel-subscription","cloud/4.billing/3.cancel-subscription","Learn how to cancel your Directus Cloud project subscription.",{"title":225,"path":226,"stem":227,"children":228,"page":89},"Community","/community","community",[229,249,274,293,318],{"title":230,"path":231,"stem":232,"children":233,"page":89},"Overview","/community/overview","community/1.overview",[234,239,244],{"title":235,"path":236,"stem":237,"description":238,"icon":14,"links":14},"Welcome","/community/overview/welcome","community/1.overview/1.welcome","Welcome to the Directus community!",{"title":240,"path":241,"stem":242,"description":243,"icon":14,"links":14},"Code of Conduct","/community/overview/conduct","community/1.overview/2.conduct","Our standards, responsibilities, and enforcement guidelines to create a positive community.",{"title":245,"path":246,"stem":247,"description":248,"icon":14,"links":14},"Moderation Guidelines","/community/overview/moderation","community/1.overview/3.moderation","Guidelines we give to community moderators.",{"title":250,"path":251,"stem":252,"children":253,"page":89},"Contribution","/community/contribution","community/2.contribution",[254,259,264,269],{"title":255,"path":256,"stem":257,"description":258,"icon":14,"links":14},"Translations","/community/contribution/translations","community/2.contribution/1.translations","How to contribute to translating the Data Studio.",{"title":260,"path":261,"stem":262,"description":263,"icon":14,"links":14},"Documentation","/community/contribution/documentation","community/2.contribution/2.documentation","How to contribute to the Directus documentation.",{"title":265,"path":266,"stem":267,"description":268,"icon":14,"links":14},"Feature Requests","/community/contribution/feature-requests","community/2.contribution/3.feature-requests","How to add feature requests, and our process for reviewing them.",{"title":270,"path":271,"stem":272,"description":273,"icon":14,"links":14},"Pull Requests","/community/contribution/pull-requests","community/2.contribution/4.pull-requests","Our process for contributing pull requests to Directus.",{"title":275,"path":276,"stem":277,"children":278,"page":89},"Codebase","/community/codebase","community/3.codebase",[279,283,288],{"title":275,"path":280,"stem":281,"description":282,"icon":14,"links":14},"/community/codebase/overview","community/3.codebase/1.overview","Overview of the Directus codebase for new contributors",{"title":284,"path":285,"stem":286,"description":287,"icon":14,"links":14},"Development Environment","/community/codebase/dev-environment","community/3.codebase/2.dev-environment","How to set up and run a development environment for Directus so that you can work on the platform's source code.",{"title":289,"path":290,"stem":291,"description":292,"icon":14,"links":14},"Testing","/community/codebase/testing","community/3.codebase/3.testing","How to run unit and blackbox tests in the Directus codebase.",{"title":294,"path":295,"stem":296,"children":297,"page":89},"Reporting And Support","/community/reporting-and-support","community/4.reporting-and-support",[298,303,308,313],{"title":299,"path":300,"stem":301,"description":302,"icon":14,"links":14},"Troubleshooting Steps","/community/reporting-and-support/troubleshooting-steps","community/4.reporting-and-support/1.troubleshooting-steps","If you're experiencing issues or think you have found a problem in Directus, be sure to follow these steps.",{"title":304,"path":305,"stem":306,"description":307,"icon":14,"links":14},"Bug Reporting","/community/reporting-and-support/bug-reporting","community/4.reporting-and-support/2.bug-reporting","How to report bugs in Directus.",{"title":309,"path":310,"stem":311,"description":312,"icon":14,"links":14},"Security Reporting","/community/reporting-and-support/security-reporting","community/4.reporting-and-support/3.security-reporting","How to report security issues in Directus.",{"title":314,"path":315,"stem":316,"description":317,"icon":14,"links":14},"Customer Support","/community/reporting-and-support/customer-support","community/4.reporting-and-support/4.customer-support","How to get help with Directus as a user and customer.",{"title":319,"path":320,"stem":321,"children":322,"page":89},"Programs","/community/programs","community/5.programs",[323,328],{"title":324,"path":325,"stem":326,"description":327,"icon":14,"links":14},"Guest Authors","/community/programs/guest-authors","community/5.programs/1.guest-authors","Our guest author program invites authors to join and get paid to write tutorials for the Directus community.",{"title":329,"path":330,"stem":331,"description":332,"icon":14,"links":14},"Directus Labs","/community/programs/directus-labs","community/5.programs/2.directus-labs","Directus Labs is the official organization for Directus templates, settings and experimental projects.",{"title":175,"path":334,"stem":335,"children":336,"page":89},"/configuration","configuration",[337,341,346,351,356,361,366,371,376,381,386,391,396,401,406,410,415,420,425],{"title":130,"path":338,"stem":339,"description":340,"icon":14,"links":14},"/configuration/intro","configuration/0.intro","Environment variables are used for all configuration within a Directus project. These variables can be defined in a number of ways, which we cover below.",{"title":342,"path":343,"stem":344,"description":345,"icon":14,"links":14},"General","/configuration/general","configuration/1.general","Configuration for the general system, server, first admin user, and telemetry.",{"title":347,"path":348,"stem":349,"description":350,"icon":14,"links":14},"AI","/configuration/ai","configuration/ai","Configuration for AI Assistant and Model Context Protocol (MCP) features.",{"title":352,"path":353,"stem":354,"description":355,"icon":14,"links":14},"Auth & SSO","/configuration/auth-sso","configuration/auth-sso","Configuration for authentication methods, including local email/password, OAuth 2.0, OpenID, LDAP, and SAML.",{"title":357,"path":358,"stem":359,"description":360,"icon":14,"links":14},"Cache","/configuration/cache","configuration/cache","Configuration for internal and output caching.",{"title":362,"path":363,"stem":364,"description":365,"icon":14,"links":14},"Database","/configuration/database","configuration/database","Configuration for database connections.",{"title":367,"path":368,"stem":369,"description":370,"icon":14,"links":14},"Email","/configuration/email","configuration/email","Configuration for email settings and templates.",{"title":372,"path":373,"stem":374,"description":375,"icon":14,"links":14},"Extensions","/configuration/extensions","configuration/extensions","Configuration for extensions and the Directus Marketplace.",{"title":377,"path":378,"stem":379,"description":380,"icon":14,"links":14},"Files","/configuration/files","configuration/files","Configuration for storage locations, metadata, upload limits, and transformations.",{"title":382,"path":383,"stem":384,"description":385,"icon":14,"links":14},"Flows","/configuration/flows","configuration/flows","Configure environment variables, memory, and timeout for Flows.",{"title":387,"path":388,"stem":389,"description":390,"icon":14,"links":14},"Logging","/configuration/logging","configuration/logging","Configuration for general and Realtime logging.",{"title":392,"path":393,"stem":394,"description":395,"icon":14,"links":14},"Metrics","/configuration/metrics","configuration/metrics","Configuration for metrics.",{"title":397,"path":398,"stem":399,"description":400,"icon":14,"links":14},"Migrations","/configuration/migrations","configuration/migrations","Creation of custom migration files to automate database changes.",{"title":402,"path":403,"stem":404,"description":405,"icon":14,"links":14},"PM2","/configuration/pm2","configuration/pm2","Configuration for PM2, the process manager for Directus.",{"title":86,"path":407,"stem":408,"description":409,"icon":14,"links":14},"/configuration/realtime","configuration/realtime","Configuration for WebSockets and GraphQL Subscriptions.",{"title":411,"path":412,"stem":413,"description":414,"icon":14,"links":14},"Security & Limits","/configuration/security-limits","configuration/security-limits","Configuration for access tokens, cookies, CSP, hashing, CORS, rate limiting, and request limits.",{"title":416,"path":417,"stem":418,"description":419,"icon":14,"links":14},"Synchronization","/configuration/synchronization","configuration/synchronization","Configuration around synchronization and Redis.",{"title":421,"path":422,"stem":423,"description":424,"icon":14,"links":14},"Theming","/configuration/theming","configuration/theming","Configuration of the Data Studio's theming engine and appearance settings.",{"title":255,"path":426,"stem":427,"description":428,"icon":14,"links":14},"/configuration/translations","configuration/translations","Directus supports translations for both the Data Studio UI and authored content.",{"title":125,"description":14,"icon":14,"links":14,"path":430,"stem":431,"children":432,"page":89},"/getting-started","getting-started",[433,437,442,446,451,456,461,466,471,476],{"title":230,"path":434,"stem":435,"description":436,"icon":14,"links":14},"/getting-started/overview","getting-started/1.overview","Learn about the Directus Data Engine and Studio, when to use it, and a how it works.",{"title":438,"path":439,"stem":440,"description":441,"icon":14,"links":14},"Accessibility","/getting-started/accessibility","getting-started/10.accessibility","We are always looking for ways to make Directus Studio more accessible. Here are some of the methods we currently support.",{"title":150,"path":443,"stem":444,"description":445,"icon":14,"links":14},"/getting-started/create-a-project","getting-started/2.create-a-project","Learn about how to create a managed Directus project or self-host with Docker.",{"title":447,"path":448,"stem":449,"description":450,"icon":14,"links":14,"label":447},"Configure a Data Model","/getting-started/data-model","getting-started/3.data-model","This guide will cover creating a collection in Directus via the Data Studio, creating fields, and configuring relationships.",{"title":452,"path":453,"stem":454,"description":455,"icon":14,"links":14},"Use the API","/getting-started/use-the-api","getting-started/4.use-the-api","Get started with Directus APIs. Learn to interact with collections, fetch, and create data.",{"title":457,"path":458,"stem":459,"description":460,"icon":14,"links":14},"Authenticate a User","/getting-started/authenticate-user","getting-started/5.authenticate-user","Get started with Directus Auth. Learn how to register, login, create users, and make authenticated requests.",{"title":462,"path":463,"stem":464,"description":465,"icon":14,"links":14},"Upload & Access Files","/getting-started/upload-files","getting-started/6.upload-files","This guide will cover importing a file via URL, requesting assets, and using transformation parameters.",{"title":467,"path":468,"stem":469,"description":470,"icon":14,"links":14},"Create an Automation","/getting-started/create-an-automation","getting-started/7.create-an-automation","Get started using flows, triggers, operations and the data chain in Directus Automate.",{"title":472,"path":473,"stem":474,"description":475,"icon":14,"links":14},"Connect to Realtime Data","/getting-started/connect-to-realtime","getting-started/8.connect-to-realtime","This guide will cover connecting to Directus via WebSockets on the web, subscribing to changes, and creating new items over the connection.",{"title":477,"path":478,"stem":479,"description":480,"icon":14,"links":14},"Resources & Links","/getting-started/resources","getting-started/9.resources","Key links across the Directus ecosystem.",{"title":482,"path":483,"stem":484,"children":485,"page":89},"Guides","/guides","guides",[486,512,595,642,677,707,732,756,771,886,899,988],{"title":487,"description":14,"icon":488,"links":14,"path":489,"stem":490,"children":491,"page":89},"Data Model","directus-explore","/guides/data-model","guides/01.data-model",[492,497,502,507],{"title":493,"path":494,"stem":495,"description":496,"icon":14,"links":14},"Collections","/guides/data-model/collections","guides/01.data-model/1.collections","Directus collections help you manage your data. Create custom collections, define fields, configure relationships, and leverage features like content versioning and access control. Learn how to create, configure, and manage collections in Directus.",{"title":498,"path":499,"stem":500,"description":501,"icon":14,"links":14},"Fields","/guides/data-model/fields","guides/01.data-model/2.fields","Directus fields let you define how your data is stored and displayed. Learn about creating fields, data types, interfaces, validations, relationships, and more. Discover how to configure fields to perfectly suit your data modeling needs in Directus.",{"title":503,"path":504,"stem":505,"description":506,"icon":14,"links":14},"Interfaces","/guides/data-model/interfaces","guides/01.data-model/3.interfaces","Manage your data effectively with Directus fields. Discover various field types, interfaces, validations, and relationships to perfectly suit your data modeling needs.",{"title":508,"path":509,"stem":510,"description":511,"icon":14,"links":14},"Relationships","/guides/data-model/relationships","guides/01.data-model/4.relationships","Leverage Directus relationships to create powerful data connections. Explore Many to One, One to Many, Many to Many, and Many to Any relationships, along with Translations for multilingual content management.",{"title":513,"description":14,"icon":514,"links":14,"path":515,"stem":516,"children":517,"page":89},"Content","directus-editor","/guides/content","guides/02.content",[518,523,528,533,538,543,548,552,574],{"title":519,"path":520,"stem":521,"description":522,"icon":14,"links":14},"Collection Explorer","/guides/content/explore","guides/02.content/1.explore","Learn to filter, layout, batch edit and more with collections in the collection explorer.",{"title":524,"path":525,"stem":526,"description":527,"icon":14,"links":14},"Item Editor","/guides/content/editor","guides/02.content/2.editor","Learn to create, duplicate, archive and perform other actions with items using Directus.",{"title":529,"path":530,"stem":531,"description":532,"icon":14,"links":14},"Layouts","/guides/content/layouts","guides/02.content/3.layouts","Learn to use layouts for viewing and interacting with items in a collection using Directus.",{"title":534,"path":535,"stem":536,"description":537,"icon":14,"links":14},"Import & Export","/guides/content/import-export","guides/02.content/4.import-export","Learn to import and export multiple items stored as files using Directus.",{"title":539,"path":540,"stem":541,"description":542,"icon":14,"links":14},"Live Preview","/guides/content/live-preview","guides/02.content/5.live-preview","Learn to set up your project for live previewing items from your application.",{"title":544,"path":545,"stem":546,"description":547,"icon":14,"links":14},"Content Versioning","/guides/content/content-versioning","guides/02.content/6.content-versioning","This guide covers the process of enabling and utilizing Content Versioning in Directus.",{"title":255,"path":549,"stem":550,"description":551,"icon":14,"links":14},"/guides/content/translations","guides/02.content/7.translations","Both content and the data studio can be translated into multiple languages.",{"title":553,"path":554,"stem":555,"children":556,"description":558,"icon":14,"links":14},"Visual Editor","/guides/content/visual-editor","guides/02.content/8.visual-editor/0.index",[557,559,564,569],{"title":553,"path":554,"stem":555,"description":558,"icon":14,"links":14},"The Directus visual editor module allows you to visually edit the content of your website directly in-place.",{"title":560,"path":561,"stem":562,"description":563,"icon":14,"links":14},"Frontend Library","/guides/content/visual-editor/frontend-library","guides/02.content/8.visual-editor/1.frontend-library","A library that allows your website to communicate with your Directus project and enables Visual Editing.",{"title":565,"path":566,"stem":567,"description":568,"icon":14,"links":14},"Studio Module","/guides/content/visual-editor/studio-module","guides/02.content/8.visual-editor/2.studio-module","Learn how to edit your website's content in place from within the Directus Studio.",{"title":570,"path":571,"stem":572,"description":573,"icon":14,"links":14},"Customization","/guides/content/visual-editor/customization","guides/02.content/8.visual-editor/3.customization","Customize the styling of your Visual Editing experience to suit your brand or website theming.",{"title":575,"path":576,"stem":577,"children":578,"description":580,"icon":14,"links":14},"Collaborative Editing","/guides/content/collaborative-editing","guides/02.content/9.collaborative-editing/0.index",[579,581,585,590],{"title":575,"path":576,"stem":577,"description":580,"icon":14,"links":14},"Directus Collaborative Editing enables real-time data synchronization and collaborative editing across collections, allowing multiple users to edit content simultaneously without conflicts.",{"title":175,"path":582,"stem":583,"description":584,"icon":14,"links":14},"/guides/content/collaborative-editing/configuration","guides/02.content/9.collaborative-editing/1.configuration","Learn how to configure Collaborative Editing in your Directus project.",{"title":586,"path":587,"stem":588,"description":589,"icon":14,"links":14},"Usage Guide","/guides/content/collaborative-editing/usage","guides/02.content/9.collaborative-editing/2.usage","Learn how to use Collaborative Editing for real-time collaboration on content in your Directus project.",{"title":591,"path":592,"stem":593,"description":594,"icon":14,"links":14},"Development & Custom Extensions","/guides/content/collaborative-editing/development","guides/02.content/9.collaborative-editing/3.development","Learn how Custom Interfaces integrate with Collaborative Editing in Directus.",{"title":74,"description":14,"icon":596,"links":14,"path":597,"stem":598,"children":599,"page":89},"directus-auth","/guides/auth","guides/03.auth",[600,605,610,615,620,625,630],{"title":601,"path":602,"stem":603,"description":604,"icon":14,"links":14},"Access Tokens","/guides/auth/tokens-cookies","guides/03.auth/1.tokens-cookies","Learn how to authenticate requests & explore standard, session, and static token types.",{"title":606,"path":607,"stem":608,"description":609,"icon":14,"links":14},"Access Control","/guides/auth/access-control","guides/03.auth/2.access-control","Manage user and role permissions and policies for interacting with data in Directus.",{"title":611,"path":612,"stem":613,"description":614,"icon":14,"links":14},"Creating Users","/guides/auth/creating-users","guides/03.auth/3.creating-users","Learn about creating users in directus, including API creation, inviting users, and seamless invites.",{"title":616,"path":617,"stem":618,"description":619,"icon":14,"links":14},"Email Login","/guides/auth/email-login","guides/03.auth/4.email-login","Learn about user registration, login with standard/session tokens, refresh, logout, and resetting passwords.",{"title":621,"path":622,"stem":623,"description":624,"icon":14,"links":14},"Two-Factor Auth","/guides/auth/2fa","guides/03.auth/5.2fa","Secure your logins with one-time codes! Learn how to generate secrets, enable/disable 2FA.",{"title":626,"path":627,"stem":628,"description":629,"icon":14,"links":14},"Accountability","/guides/auth/accountability","guides/03.auth/6.accountability","Learn to audit user activity and enforce accountability using the activity feed.",{"title":631,"path":632,"stem":633,"children":634,"description":636,"icon":14,"links":14},"Single Sign-On","/guides/auth/sso","guides/03.auth/7.sso/1.index",[635,637],{"title":631,"path":632,"stem":633,"description":636,"icon":14,"links":14},"Single Sign-On is a mechanism which allows to use external providers to login into systems.",{"title":638,"path":639,"stem":640,"description":641,"icon":14,"links":14},"Seamless SSO","/guides/auth/sso/seamless","guides/03.auth/7.sso/2.seamless","Seamless SSO is a setup to allow logging in without the user ever seeing Directus' login page.",{"title":643,"description":14,"icon":644,"links":14,"path":645,"stem":646,"children":647,"page":89},"Connect","directus-connect","/guides/connect","guides/04.connect",[648,652,657,662,667,672],{"title":16,"path":649,"stem":650,"description":651,"icon":14,"links":14},"/guides/connect/authentication","guides/04.connect/1.authentication","Discover how to authenticate Directus Connect requests using authorization headers, session cookies, or query parameters.",{"title":653,"path":654,"stem":655,"description":656,"icon":14,"links":14},"Filter Rules","/guides/connect/filter-rules","guides/04.connect/2.filter-rules","Learn about filter rules in Directus - available operators, filter syntax, relational fields, dynamic variables, logical operators, and functions parameters. Understand how to build complex filters for permissions, validations, and automations.",{"title":658,"path":659,"stem":660,"description":661,"icon":14,"links":14},"Query Parameters","/guides/connect/query-parameters","guides/04.connect/3.query-parameters","Learn about Directus query parameters - fields, filter, search, sort, limit, offset, page, aggregate, groupBy, deep, alias, and export. Understand how to customize your API requests and retrieve specific data from your collections.",{"title":663,"path":664,"stem":665,"description":666,"icon":14,"links":14},"Relational Data","/guides/connect/relations","guides/04.connect/4.relations","Directus enables you to manage and interact with relational data. This section will guide you through the different types of relationships and how to work with them.",{"title":668,"path":669,"stem":670,"description":671,"icon":14,"links":14},"Error Codes","/guides/connect/errors","guides/04.connect/5.errors","Learn about Directus error codes - understand what each code means, from validation failures to rate limits exceeded. Troubleshoot issues with your API requests and resolve errors efficiently.",{"title":673,"path":674,"stem":675,"description":676,"icon":14,"links":14},"Directus SDK","/guides/connect/sdk","guides/04.connect/6.sdk","A JavaScript and TypeScript library that simplifies working with Directus.",{"title":377,"description":14,"icon":678,"links":14,"path":679,"stem":680,"children":681,"page":89},"directus-files","/guides/files","guides/05.files",[682,687,692,697,702],{"title":683,"path":684,"stem":685,"description":686,"icon":14,"links":14},"Upload Files","/guides/files/upload","guides/05.files/1.upload","Learn to upload files to Directus via both the data studio or API.",{"title":688,"path":689,"stem":690,"description":691,"icon":14,"links":14},"Download Files","/guides/files/download","guides/05.files/2.download","Learn to download content from the File Library",{"title":693,"path":694,"stem":695,"description":696,"icon":14,"links":14},"Manage Files","/guides/files/manage","guides/05.files/3.manage","Learn to view, modify, edit and set files' focal points.",{"title":698,"path":699,"stem":700,"description":701,"icon":14,"links":14},"Access Files","/guides/files/access","guides/05.files/4.access","Learn how to access uploaded files, authenticate, provide optional filenames and directly download them.",{"title":703,"path":704,"stem":705,"description":706,"icon":14,"links":14},"Transform Files","/guides/files/transform","guides/05.files/5.transform","Learn how to transform files and set custom presets for these transformations.",{"title":708,"description":14,"icon":709,"links":14,"path":710,"stem":711,"children":712,"page":89},"Automate","directus-automate","/guides/automate","guides/06.automate",[713,717,722,727],{"title":382,"path":714,"stem":715,"description":716,"icon":14,"links":14},"/guides/automate/flows","guides/06.automate/1.flows","Flows enable custom, event-driven data processing and task automation within Directus.",{"title":718,"path":719,"stem":720,"description":721,"icon":14,"links":14},"Data Chain","/guides/automate/data-chain","guides/06.automate/2.data-chain","Data chains are created by each flow and hold information that can be accessed within different operations.",{"title":723,"path":724,"stem":725,"description":726,"icon":14,"links":14},"Triggers","/guides/automate/triggers","guides/06.automate/3.triggers","Triggers define the action or events that start flows.",{"title":728,"path":729,"stem":730,"description":731,"icon":14,"links":14},"Operations","/guides/automate/operations","guides/06.automate/4.operations","Operations are individual customizable actions in a flow.",{"title":86,"description":14,"icon":733,"links":14,"path":734,"stem":735,"children":736,"page":89},"directus-realtime","/guides/realtime","guides/07.realtime",[737,741,746,751],{"title":16,"path":738,"stem":739,"description":740,"icon":14,"links":14},"/guides/realtime/authentication","guides/07.realtime/1.authentication","Learn to implement the three authentication modes.",{"title":742,"path":743,"stem":744,"description":745,"icon":14,"links":14},"Subscriptions","/guides/realtime/subscriptions","guides/07.realtime/2.subscriptions","Learn to manage realtime subscriptions with both websockets and GraphQL.",{"title":747,"path":748,"stem":749,"description":750,"icon":14,"links":14},"Actions","/guides/realtime/actions","guides/07.realtime/3.actions","Learn to execute CRUD actions via websockets.",{"title":752,"path":753,"stem":754,"description":755,"icon":14,"links":14},"Custom WebSocket Handlers","/guides/realtime/custom-handlers","guides/07.realtime/4.custom-handlers","Build custom WebSocket message handlers, push messages to connected clients, and react to WebSocket events using hook extensions.",{"title":757,"description":14,"icon":758,"links":14,"path":759,"stem":760,"children":761,"page":89},"Insights","directus-insights","/guides/insights","guides/08.insights",[762,766],{"title":230,"path":763,"stem":764,"description":765,"icon":14,"links":14},"/guides/insights/overview","guides/08.insights/1.overview","Insights is a module in Directus that allows rapid, no-code build-out of analytics dashboards.",{"title":767,"path":768,"stem":769,"description":770,"icon":14,"links":14},"Panels","/guides/insights/panels","guides/08.insights/2.panels","Panels are the building-blocks you can add onto insights dashboards to create, save and display data analytics.",{"title":372,"description":14,"icon":772,"links":14,"path":773,"stem":774,"children":775,"page":89},"directus-marketplace","/guides/extensions","guides/09.extensions",[776,780,785,817,864,869,881],{"title":230,"path":777,"stem":778,"description":779,"icon":14,"links":14},"/guides/extensions/overview","guides/09.extensions/0.overview","Extensions are used to extend the functionality of Directus.",{"title":781,"path":782,"stem":783,"description":784,"icon":14,"links":14},"Quickstart","/guides/extensions/quickstart","guides/09.extensions/1.quickstart","This guide will cover how to get started with developing an extension for Directus.",{"title":786,"path":787,"stem":788,"children":789,"description":791,"icon":14,"links":14},"API Extensions","/guides/extensions/api-extensions","guides/09.extensions/2.api-extensions/0.index",[790,792,797,802,807,812],{"title":786,"path":787,"stem":788,"description":791,"icon":14,"links":14},"API Extensions extend the functionality of the API.",{"title":793,"path":794,"stem":795,"description":796,"icon":14,"links":14},"Event Hooks","/guides/extensions/api-extensions/hooks","guides/09.extensions/2.api-extensions/1.hooks","Hooks allow running code when during the Directus lifecycle or database events.",{"title":798,"path":799,"stem":800,"description":801,"icon":14,"links":14},"API Endpoints","/guides/extensions/api-extensions/endpoints","guides/09.extensions/2.api-extensions/2.endpoints","Endpoints allow you to register new API routes in your Directus project.",{"title":803,"path":804,"stem":805,"description":806,"icon":14,"links":14},"Flow Operations","/guides/extensions/api-extensions/operations","guides/09.extensions/2.api-extensions/3.operations","Operations are single steps in a Flow - the no-code automation tool part of Directus Automate.",{"title":808,"path":809,"stem":810,"description":811,"icon":14,"links":14},"Services","/guides/extensions/api-extensions/services","guides/09.extensions/2.api-extensions/4.services","When building extensions, you may use internal Directus services directly.",{"title":813,"path":814,"stem":815,"description":816,"icon":14,"links":14},"Sandbox","/guides/extensions/api-extensions/sandbox","guides/09.extensions/2.api-extensions/5.sandbox","Sandboxed Extensions run in an isolated environment and must request permission scopes.",{"title":818,"path":819,"stem":820,"children":821,"description":823,"icon":14,"links":14},"App Extensions","/guides/extensions/app-extensions","guides/09.extensions/3.app-extensions/0.index",[822,824,829,834,839,844,849,854,859],{"title":818,"path":819,"stem":820,"description":823,"icon":14,"links":14},"App Extensions extend the functionality of the Data Studio.",{"title":825,"path":826,"stem":827,"description":828,"icon":14,"links":14},"Editor Interfaces","/guides/extensions/app-extensions/interfaces","guides/09.extensions/3.app-extensions/1.interfaces","Interfaces are form inputs used primarily inside of the Directus Editor.",{"title":830,"path":831,"stem":832,"description":833,"icon":14,"links":14},"Inline Displays","/guides/extensions/app-extensions/displays","guides/09.extensions/3.app-extensions/2.displays","Displays are used to display a single value throughout the Data Studio.",{"title":835,"path":836,"stem":837,"description":838,"icon":14,"links":14},"Explore Layouts","/guides/extensions/app-extensions/layouts","guides/09.extensions/3.app-extensions/3.layouts","Layouts are used to display a list of items in Explore pages in different ways.",{"title":840,"path":841,"stem":842,"description":843,"icon":14,"links":14},"Dashboard Panels","/guides/extensions/app-extensions/panels","guides/09.extensions/3.app-extensions/4.panels","Panels are customizable components within Directus Insights dashboards.",{"title":845,"path":846,"stem":847,"description":848,"icon":14,"links":14},"Custom Modules","/guides/extensions/app-extensions/modules","guides/09.extensions/3.app-extensions/5.modules","Modules are top-level areas of the Data Studio, navigated to from the left-hand module bar.",{"title":850,"path":851,"stem":852,"description":853,"icon":14,"links":14},"Custom Themes","/guides/extensions/app-extensions/themes","guides/09.extensions/3.app-extensions/6.themes","Themes are used to style elements of the Data Studio including colors and fonts.",{"title":855,"path":856,"stem":857,"description":858,"icon":14,"links":14},"UI Library","/guides/extensions/app-extensions/ui-library","guides/09.extensions/3.app-extensions/7.ui-library","Directus offers globally-registered UI components for building extensions.",{"title":860,"path":861,"stem":862,"description":863,"icon":14,"links":14},"Composables","/guides/extensions/app-extensions/composables","guides/09.extensions/3.app-extensions/8.composables","Vue composables for working with Directus services when building extensions.",{"title":865,"path":866,"stem":867,"description":868,"icon":14,"links":14},"Bundling Extensions","/guides/extensions/bundles","guides/09.extensions/4.bundles","Bundles are a way to group extensions together as a single distributable package.",{"title":870,"path":871,"stem":872,"children":873,"description":875,"icon":14,"links":14},"Marketplace Beta","/guides/extensions/marketplace","guides/09.extensions/5.marketplace/0.index",[874,876],{"title":870,"path":871,"stem":872,"description":875,"icon":14,"links":14},"The Directus Marketplace provides a way for users to install extensions in their projects directly the Data Studio.",{"title":877,"path":878,"stem":879,"description":880,"icon":14,"links":14},"Publishing Extensions","/guides/extensions/marketplace/publishing","guides/09.extensions/5.marketplace/1.publishing","Publish extensions to the Directus Marketplace via npm, including required metadata, best practices, and author profile setup.",{"title":882,"path":883,"stem":884,"description":885,"icon":14,"links":14},"CLI","/guides/extensions/cli","guides/09.extensions/6.cli","Using the create-directus-extension to build, validate and manage extensions.",{"title":887,"path":888,"stem":889,"children":890,"description":14,"icon":898,"links":14},"Deployments","/guides/deployments","guides/10.deployments/0.index",[891,893],{"title":230,"path":888,"stem":889,"description":892,"icon":14,"links":14},"Trigger, monitor, and manage frontend deployments directly from Directus.",{"title":894,"path":895,"stem":896,"description":897,"icon":14,"links":14},"Security","/guides/deployments/security","guides/10.deployments/1.security","Access control, permissions, and credential protection for the Deployment module.","directus-deployments",{"title":347,"path":900,"stem":901,"children":902,"description":14,"icon":987,"links":14},"/guides/ai","guides/11.ai/0.index",[903,906,937],{"title":904,"path":900,"stem":901,"description":905,"icon":14,"links":14},"AI + Directus","Use AI to interact with Directus - either through the built-in AI Assistant or by connecting external AI tools via MCP.",{"title":907,"path":908,"stem":909,"children":910,"description":14,"icon":14,"links":14},"AI Assistant","/guides/ai/assistant","guides/11.ai/1.assistant/0.index",[911,913,918,923,928,933],{"title":230,"path":908,"stem":909,"description":912,"icon":14,"links":14},"Chat with an AI assistant directly inside Directus. Create content, manage your schema, trigger automations, and explore your data through natural conversation.",{"title":914,"path":915,"stem":916,"description":917,"icon":14,"links":14},"Setup","/guides/ai/assistant/setup","guides/11.ai/1.assistant/1.setup","Configure AI Assistant by adding your AI provider API keys and customizing assistant behavior.",{"title":919,"path":920,"stem":921,"description":922,"icon":14,"links":14},"Usage","/guides/ai/assistant/usage","guides/11.ai/1.assistant/2.usage","Learn how to use AI Assistant to interact with your Directus instance through natural conversation.",{"title":924,"path":925,"stem":926,"description":927,"icon":14,"links":14},"Tools","/guides/ai/assistant/tools","guides/11.ai/1.assistant/3.tools","Reference of all tools available to AI Assistant for interacting with your Directus instance.",{"title":929,"path":930,"stem":931,"description":932,"icon":14,"links":14},"Best Practices","/guides/ai/assistant/tips","guides/11.ai/1.assistant/4.tips","Get the most out of AI Assistant with practical tips, example prompts, and common pitfalls to avoid.",{"title":894,"path":934,"stem":935,"description":936,"icon":14,"links":14},"/guides/ai/assistant/security","guides/11.ai/1.assistant/5.security","Security considerations for using AI Assistant safely with your Directus data.",{"title":938,"path":939,"stem":940,"children":941,"description":14,"icon":14,"links":14},"MCP Server","/guides/ai/mcp","guides/11.ai/2.mcp/0.index",[942,944,949,954,958,963,968,972],{"title":230,"path":939,"stem":940,"description":943,"icon":14,"links":14},"Connect AI assistants directly to your Directus instance. Let Claude, ChatGPT, and other AI tools manage your content without manual copy-pasting.",{"title":945,"path":946,"stem":947,"description":948,"icon":14,"links":14},"Installation","/guides/ai/mcp/installation","guides/11.ai/2.mcp/1.installation","Set up the Directus MCP server and connect your AI tools in under 5 minutes.",{"title":950,"path":951,"stem":952,"description":953,"icon":14,"links":14},"Use Cases","/guides/ai/mcp/use-cases","guides/11.ai/2.mcp/2.use-cases","Real examples of how to use AI with your Directus content to save time and reduce repetitive work.",{"title":924,"path":955,"stem":956,"description":957,"icon":14,"links":14},"/guides/ai/mcp/tools","guides/11.ai/2.mcp/3.tools","Learn about the tools available in the Directus remote MCP server and how they enable AI-powered content management.",{"title":959,"path":960,"stem":961,"description":962,"icon":14,"links":14},"Prompts","/guides/ai/mcp/prompts","guides/11.ai/2.mcp/4.prompts","Learn how to configure and use stored prompts with the Directus MCP Server.",{"title":964,"path":965,"stem":966,"description":967,"icon":14,"links":14},"Troubleshooting","/guides/ai/mcp/troubleshooting","guides/11.ai/2.mcp/5.troubleshooting","Common issues and solutions when setting up and using the Directus MCP server.",{"title":894,"path":969,"stem":970,"description":971,"icon":14,"links":14},"/guides/ai/mcp/security","guides/11.ai/2.mcp/6.security","Practical security guidelines for using the Directus MCP server safely and protecting your data.",{"title":973,"path":974,"stem":975,"children":976,"description":14,"icon":14,"links":14},"Local MCP","/guides/ai/mcp/local-mcp","guides/11.ai/2.mcp/7.local-mcp/0.index",[977,979,983],{"title":945,"path":974,"stem":975,"description":978,"icon":14,"links":14},"The Directus Content MCP Server allows you to interact with your Directus data through AI tools using the Model Context Protocol.",{"title":924,"path":980,"stem":981,"description":982,"icon":14,"links":14},"/guides/ai/mcp/local-mcp/tools","guides/11.ai/2.mcp/7.local-mcp/1.tools","Learn about the tools available in the local Directus Content MCP Server and how to configure them.",{"title":959,"path":984,"stem":985,"description":986,"icon":14,"links":14},"/guides/ai/mcp/local-mcp/prompts","guides/11.ai/2.mcp/7.local-mcp/2.prompts","Configure stored prompts with the local MCP server using environment variables and manual collection setup.","directus-ai",{"title":989,"description":14,"icon":990,"links":14,"path":991,"stem":992,"children":993},"Integrations","directus-integrations","/guides/integrations","guides/12.integrations/index",[994,996,1003,1024,1046,1065,1076],{"title":989,"path":991,"stem":992,"description":995,"icon":14,"links":14},"Connect Directus with third-party tools and services to extend functionality and automate workflows.",{"title":997,"path":998,"stem":999,"children":1000,"description":14,"icon":14,"links":14},"Framer","/guides/integrations/framer","guides/11.integrations/6.framer/0.index",[1001],{"title":997,"path":998,"stem":999,"description":1002,"icon":14,"links":14},"Connect your Directus collections to Framer's CMS to sync content in both directions using the Directus Framer plugin.",{"title":1004,"path":1005,"stem":1006,"children":1007,"description":14,"icon":14,"links":14},"n8n","/guides/integrations/n8n","guides/12.integrations/1.n8n/0.index",[1008,1011,1015,1020],{"title":1009,"path":1005,"stem":1006,"description":1010,"icon":14,"links":14},"Integration","Connect Directus with n8n to automate workflows, sync data, and integrate your CMS with other services using the Directus community node.",{"title":747,"path":1012,"stem":1013,"description":1014,"icon":14,"links":14},"/guides/integrations/n8n/directus-n8n-actions","guides/12.integrations/1.n8n/directus-n8n-actions","Complete guide for using Directus actions in n8n workflows, including working with items, users, and files.",{"title":1016,"path":1017,"stem":1018,"description":1019,"icon":14,"links":14},"Advanced","/guides/integrations/n8n/directus-n8n-advanced","guides/12.integrations/1.n8n/directus-n8n-advanced","Advanced guide for using Directus raw CRUD operations in n8n, including raw JSON operations, complex filters, relational queries, and query parameters.",{"title":723,"path":1021,"stem":1022,"description":1023,"icon":14,"links":14},"/guides/integrations/n8n/directus-n8n-triggers","guides/12.integrations/1.n8n/directus-n8n-triggers","Complete guide for using Directus triggers in n8n workflows to automate workflows when events happen in Directus.",{"title":1025,"path":1026,"stem":1027,"children":1028,"description":14,"icon":14,"links":14},"Clay","/guides/integrations/clay","guides/12.integrations/2.clay/0.index",[1029,1031,1036,1041],{"title":1009,"path":1026,"stem":1027,"description":1030,"icon":14,"links":14},"Connect Directus with Clay to automate data enrichment and sync content between platforms using webhooks and HTTP API templates.",{"title":1032,"path":1033,"stem":1034,"description":1035,"icon":14,"links":14},"Data Operations","/guides/integrations/clay/directus-clay-data-operations","guides/12.integrations/2.clay/directus-clay-data-operations","Advanced techniques for working with Directus data in Clay, including filters, pagination, common use cases, and best practices.",{"title":1037,"path":1038,"stem":1039,"description":1040,"icon":14,"links":14},"Templates","/guides/integrations/clay/use-clay-templates-with-directus","guides/12.integrations/2.clay/use-clay-templates-with-directus","Learn how to use Clay's pre-built HTTP API templates to connect with Directus for data enrichment and synchronization.",{"title":1042,"path":1043,"stem":1044,"description":1045,"icon":14,"links":14},"Webhooks","/guides/integrations/clay/use-directus-webhooks-with-clay","guides/12.integrations/2.clay/use-directus-webhooks-with-clay","Learn how to set up Directus Flows to automatically send data to Clay webhooks for real-time data synchronization.",{"title":1047,"path":1048,"stem":1049,"children":1050,"description":14,"icon":14,"links":14},"Zapier","/guides/integrations/zapier","guides/12.integrations/3.zapier/0.index",[1051,1053,1057,1061],{"title":1009,"path":1048,"stem":1049,"description":1052,"icon":14,"links":14},"Connect Directus with Zapier to automate workflows, sync data, and integrate your CMS with thousands of other apps using the Directus Zapier integration.",{"title":747,"path":1054,"stem":1055,"description":1056,"icon":14,"links":14},"/guides/integrations/zapier/actions","guides/12.integrations/3.zapier/actions","Complete guide for using Directus actions in Zapier workflows, including working with items, users, and files.",{"title":1016,"path":1058,"stem":1059,"description":1060,"icon":14,"links":14},"/guides/integrations/zapier/advanced","guides/12.integrations/3.zapier/advanced","Advanced guide for using Directus API features in Zapier, including raw request actions, advanced filtering, and custom API calls.",{"title":723,"path":1062,"stem":1063,"description":1064,"icon":14,"links":14},"/guides/integrations/zapier/triggers","guides/12.integrations/3.zapier/triggers","Complete guide for using Directus triggers in Zapier workflows to automatically start Zaps when events happen in Directus.",{"title":1066,"path":1067,"stem":1068,"children":1069,"description":14,"icon":14,"links":14},"Vercel","/guides/integrations/vercel","guides/12.integrations/4.vercel/0.index",[1070,1072],{"title":1066,"path":1067,"stem":1068,"description":1071,"icon":14,"links":14},"Connect Directus with Vercel to trigger deployments, monitor build status, and manage your frontend projects directly from your Directus instance.",{"title":887,"path":1073,"stem":1074,"description":1075,"icon":14,"links":14},"/guides/integrations/vercel/deployments","guides/12.integrations/4.vercel/deployments","Complete guide for triggering deployments, monitoring build status, and viewing logs for your Vercel projects from Directus.",{"title":1077,"path":1078,"stem":1079,"children":1080,"description":14,"icon":14,"links":14},"Netlify","/guides/integrations/netlify","guides/12.integrations/5.netlify/0.index",[1081,1083],{"title":1077,"path":1078,"stem":1079,"description":1082,"icon":14,"links":14},"Integrate Directus with Netlify to deploy your sites, track build progress, and manage frontend projects from within your Directus instance.",{"title":887,"path":1084,"stem":1085,"description":1086,"icon":14,"links":14},"/guides/integrations/netlify/deployments","guides/12.integrations/5.netlify/deployments","Full guide for triggering builds, tracking deployment progress, and viewing logs for your Netlify sites from Directus.",{"title":230,"path":1088,"stem":1089,"children":1090,"description":1092,"icon":14,"links":14},"/releases","releases/1.index",[1091,1093,1098],{"title":230,"path":1088,"stem":1089,"description":1092,"icon":14,"links":14},"Releases are how we roll out new features, updates, and fixes to Directus.",{"title":1094,"path":1095,"stem":1096,"description":1097,"icon":14,"links":14},"Changelog","/releases/changelog","releases/2.changelog","A monthly summary of what's new from the Directus team.",{"title":1099,"path":1100,"stem":1101,"children":1102,"description":1104,"icon":14,"links":14},"Breaking Changes","/releases/breaking-changes","releases/3.breaking-changes/0.index",[1103,1105,1109],{"title":1099,"path":1100,"stem":1101,"description":1104,"icon":14,"links":14},"Breaking changes may require action on your part before upgrading.",{"title":1106,"path":1107,"stem":1108,"description":1104,"icon":14,"links":14},"Version 10","/releases/breaking-changes/version-10","releases/3.breaking-changes/1.version-10",{"title":1110,"path":1111,"stem":1112,"description":1104,"icon":14,"links":14},"Version 11","/releases/breaking-changes/version-11","releases/3.breaking-changes/2.version-11",{"title":1114,"description":14,"icon":14,"links":14,"path":1115,"stem":1116,"children":1117,"page":89},"Self-Hosting","/self-hosting","self-hosting",[1118,1122,1127,1132,1137],{"title":230,"path":1119,"stem":1120,"description":1121,"icon":14,"links":14},"/self-hosting/overview","self-hosting/1.overview","Self-hosting Directus means running the Directus software on your own infrastructure.",{"title":1123,"path":1124,"stem":1125,"description":1126,"icon":14,"links":14},"Requirements","/self-hosting/requirements","self-hosting/2.requirements","This page outlines the requirements for self-hosting Directus.",{"title":1128,"path":1129,"stem":1130,"description":1131,"icon":14,"links":14},"Deployment","/self-hosting/deploying","self-hosting/3.deploying","This section covers the deployment process of Directus, including environment variables, versioning, persistence, and initial admin user setup.",{"title":1133,"path":1134,"stem":1135,"description":1136,"icon":14,"links":14},"Upgrading","/self-hosting/upgrading","self-hosting/4.upgrading","Learn how to upgrade Directus to the latest version.",{"title":1138,"path":1139,"stem":1140,"description":1141,"icon":14,"links":14},"Including Extensions","/self-hosting/including-extensions","self-hosting/5.including-extensions","Learn how to include extensions in your self-hosted Directus project.",{"title":1143,"path":1144,"stem":1145,"children":1146},"Tutorials","/tutorials","tutorials",[1147,1150,1370,1530,1576,1602,1719,1749],{"title":1143,"path":1144,"stem":1148,"description":1149,"icon":14,"links":14},"tutorials/index","This is a collection of step-by-step guides and practical examples to help you get the most out of our platform. Whether you're a beginner or an experienced user, our tutorials are designed to provide you with the knowledge and skills you need to succeed.",{"title":125,"path":1151,"stem":1152,"children":1153,"description":24,"icon":14,"links":14},"/tutorials/getting-started","tutorials/1.getting-started/index",[1154,1155,1160,1165,1170,1175,1180,1185,1190,1195,1200,1205,1210,1215,1220,1225,1230,1235,1240,1245,1250,1255,1260,1265,1270,1275,1280,1285,1290,1295,1300,1305,1310,1315,1320,1325,1330,1335,1340,1345,1350,1355,1360,1365],{"title":125,"path":1151,"stem":1152,"description":24,"icon":14,"links":14},{"title":1156,"path":1157,"stem":1158,"description":1159,"icon":14,"links":14},"Create Reusable Blocks with Many-to-Any Relationships","/tutorials/getting-started/create-reusable-blocks-with-many-to-any-relationships","tutorials/1.getting-started/create-reusable-blocks-with-many-to-any-relationships","Learn how to data model for multiple, repeating sections of content.",{"title":1161,"path":1162,"stem":1163,"description":1164,"icon":14,"links":14},"Fetch Data from Directus in Android with Kotlin","/tutorials/getting-started/fetch-data-from-directus-in-android-with-kotlin","tutorials/1.getting-started/fetch-data-from-directus-in-android-with-kotlin","Learn how to integrate Directus in your Android app with Kotlin.",{"title":1166,"path":1167,"stem":1168,"description":1169,"icon":14,"links":14},"Fetch Data from Directus in iOS with Swift","/tutorials/getting-started/fetch-data-from-directus-in-ios-with-swift","tutorials/1.getting-started/fetch-data-from-directus-in-ios-with-swift","Learn how to integrate Directus in your iOS app with Swift.",{"title":1171,"path":1172,"stem":1173,"description":1174,"icon":14,"links":14},"Fetch Data from Directus with Angular","/tutorials/getting-started/fetch-data-from-directus-with-angular","tutorials/1.getting-started/fetch-data-from-directus-with-angular","Learn how to integrate Directus in your Angular web application.",{"title":1176,"path":1177,"stem":1178,"description":1179,"icon":14,"links":14},"Fetch Data from Directus with Astro","/tutorials/getting-started/fetch-data-from-directus-with-astro","tutorials/1.getting-started/fetch-data-from-directus-with-astro","Learn how to integrate Directus in your Astro web application.",{"title":1181,"path":1182,"stem":1183,"description":1184,"icon":14,"links":14},"Fetch Data from Directus with Django","/tutorials/getting-started/fetch-data-from-directus-with-django","tutorials/1.getting-started/fetch-data-from-directus-with-django","Learn how to integrate Directus in your Django web application.",{"title":1186,"path":1187,"stem":1188,"description":1189,"icon":14,"links":14},"Fetch Data from Directus with Eleventy 3","/tutorials/getting-started/fetch-data-from-directus-with-eleventy-3","tutorials/1.getting-started/fetch-data-from-directus-with-eleventy-3","Learn how to integrate Directus in your 11ty web application.",{"title":1191,"path":1192,"stem":1193,"description":1194,"icon":14,"links":14},"Fetch Data from Directus with Flask","/tutorials/getting-started/fetch-data-from-directus-with-flask","tutorials/1.getting-started/fetch-data-from-directus-with-flask","Learn how to integrate Directus in your Flask web application.",{"title":1196,"path":1197,"stem":1198,"description":1199,"icon":14,"links":14},"Fetch Data from Directus with Flutter","/tutorials/getting-started/fetch-data-from-directus-with-flutter","tutorials/1.getting-started/fetch-data-from-directus-with-flutter","Learn how to integrate Directus in your Flutter app with Dart.",{"title":1201,"path":1202,"stem":1203,"description":1204,"icon":14,"links":14},"Fetch Data from Directus with Laravel","/tutorials/getting-started/fetch-data-from-directus-with-laravel","tutorials/1.getting-started/fetch-data-from-directus-with-laravel","Learn how to integrate Directus in your Laravel web application.",{"title":1206,"path":1207,"stem":1208,"description":1209,"icon":14,"links":14},"Fetch Data from Directus with Next.js","/tutorials/getting-started/fetch-data-from-directus-with-nextjs","tutorials/1.getting-started/fetch-data-from-directus-with-nextjs","Learn how to integrate Directus in your Next.js web application.",{"title":1211,"path":1212,"stem":1213,"description":1214,"icon":14,"links":14},"Fetch Data from Directus with Nuxt","/tutorials/getting-started/fetch-data-from-directus-with-nuxt","tutorials/1.getting-started/fetch-data-from-directus-with-nuxt","Learn how to integrate Directus in your Nuxt web application.",{"title":1216,"path":1217,"stem":1218,"description":1219,"icon":14,"links":14},"Fetch Data from Directus with SolidStart","/tutorials/getting-started/fetch-data-from-directus-with-solidstart","tutorials/1.getting-started/fetch-data-from-directus-with-solidstart","Learn how to integrate Directus in your SolidStart web application.",{"title":1221,"path":1222,"stem":1223,"description":1224,"icon":14,"links":14},"Fetch Data from Directus with Spring Boot","/tutorials/getting-started/fetch-data-from-directus-with-spring-boot","tutorials/1.getting-started/fetch-data-from-directus-with-spring-boot","Learn how to integrate Directus in your Spring Boot web application.",{"title":1226,"path":1227,"stem":1228,"description":1229,"icon":14,"links":14},"Fetch Data from Directus with SvelteKit","/tutorials/getting-started/fetch-data-from-directus-with-sveltekit","tutorials/1.getting-started/fetch-data-from-directus-with-sveltekit","Learn how to integrate Directus in your SvelteKit web application.",{"title":1231,"path":1232,"stem":1233,"description":1234,"icon":14,"links":14},"Implement Directus Auth with iOS","/tutorials/getting-started/implement-directus-auth-with-ios","tutorials/1.getting-started/implement-directus-auth-with-ios","Learn how to register, login, and protect content in your iOS app.",{"title":1236,"path":1237,"stem":1238,"description":1239,"icon":14,"links":14},"Implement Multilingual Content with Directus and SvelteKit","/tutorials/getting-started/implement-multilingual-content-with-directus-and-svelte-kit","tutorials/1.getting-started/implement-multilingual-content-with-directus-and-svelte-kit","Learn how to handle internationalization in your SvelteKit application.",{"title":1241,"path":1242,"stem":1243,"description":1244,"icon":14,"links":14},"Implementing Live Preview in Astro","/tutorials/getting-started/implementing-live-preview-in-astro","tutorials/1.getting-started/implementing-live-preview-in-astro","Learn how to setup Directus live preview with Astro.",{"title":1246,"path":1247,"stem":1248,"description":1249,"icon":14,"links":14},"Implementing Live Preview in Next.js","/tutorials/getting-started/implementing-live-preview-in-next-js","tutorials/1.getting-started/implementing-live-preview-in-next-js","Learn how to setup Directus live preview with Next.js.",{"title":1251,"path":1252,"stem":1253,"description":1254,"icon":14,"links":14},"Implementing Live Preview in Nuxt","/tutorials/getting-started/implementing-live-preview-in-nuxt","tutorials/1.getting-started/implementing-live-preview-in-nuxt","Learn how to setup Directus live preview with Nuxt.",{"title":1256,"path":1257,"stem":1258,"description":1259,"icon":14,"links":14},"Implementing Live Preview in React","/tutorials/getting-started/implementing-live-preview-in-react","tutorials/1.getting-started/implementing-live-preview-in-react","Learn how to setup Directus live preview with React.",{"title":1261,"path":1262,"stem":1263,"description":1264,"icon":14,"links":14},"Implementing Live Preview in SvelteKit","/tutorials/getting-started/implementing-live-preview-in-sveltekit","tutorials/1.getting-started/implementing-live-preview-in-sveltekit","Learn how to setup Directus live preview with SvelteKit.",{"title":1266,"path":1267,"stem":1268,"description":1269,"icon":14,"links":14},"Implementing Multilingual Content using Directus and Astro","/tutorials/getting-started/implementing-multilingual-content-using-directus-and-astro","tutorials/1.getting-started/implementing-multilingual-content-using-directus-and-astro","Learn how to access multilingual Directus content using Astro.",{"title":1271,"path":1272,"stem":1273,"description":1274,"icon":14,"links":14},"Implementing Multilingual Content using Directus and Next.js","/tutorials/getting-started/implementing-multilingual-content-using-directus-and-next","tutorials/1.getting-started/implementing-multilingual-content-using-directus-and-next","Learn how to access multilingual Directus content using Next.js.",{"title":1276,"path":1277,"stem":1278,"description":1279,"icon":14,"links":14},"Implementing Multilingual Content using Directus and Nuxt","/tutorials/getting-started/implementing-multilingual-content-using-directus-and-nuxt","tutorials/1.getting-started/implementing-multilingual-content-using-directus-and-nuxt","Learn how to access multilingual Directus content using Nuxt.",{"title":1281,"path":1282,"stem":1283,"description":1284,"icon":14,"links":14},"Implementing Multilingual Content using Directus and SvelteKit","/tutorials/getting-started/implementing-multilingual-content-using-directus-and-sveltekit","tutorials/1.getting-started/implementing-multilingual-content-using-directus-and-sveltekit","Learn how to access multilingual Directus content using SvelteKit.",{"title":1286,"path":1287,"stem":1288,"description":1289,"icon":14,"links":14},"Integrating the Directus Visual Editor with Next.js","/tutorials/getting-started/integrating-the-directus-visual-editor-with-nextjs","tutorials/1.getting-started/integrating-the-directus-visual-editor-with-nextjs","Learn how to integrate the Directus Visual Editor with Next.js.",{"title":1291,"path":1292,"stem":1293,"description":1294,"icon":14,"links":14},"Integrating the Directus Visual Editor with Nuxt","/tutorials/getting-started/integrating-the-directus-visual-editor-with-nuxt","tutorials/1.getting-started/integrating-the-directus-visual-editor-with-nuxt","Learn how to integrate the Directus Visual Editor with Nuxt.",{"title":1296,"path":1297,"stem":1298,"description":1299,"icon":14,"links":14},"Integrating the Directus Visual Editor with SvelteKit","/tutorials/getting-started/integrating-the-directus-visual-editor-with-sveltekit","tutorials/1.getting-started/integrating-the-directus-visual-editor-with-sveltekit","Learn how to integrate the Directus Visual Editor with SvelteKit.",{"title":1301,"path":1302,"stem":1303,"description":1304,"icon":14,"links":14},"Rendering Dynamic Blocks Using Astro","/tutorials/getting-started/rendering-dynamic-blocks-using-astro","tutorials/1.getting-started/rendering-dynamic-blocks-using-astro","Learn how to render dynamic blocks using Astro.",{"title":1306,"path":1307,"stem":1308,"description":1309,"icon":14,"links":14},"Rendering Dynamic Blocks Using Next.js","/tutorials/getting-started/rendering-dynamic-blocks-using-next","tutorials/1.getting-started/rendering-dynamic-blocks-using-next","Learn how to render dynamic blocks using Next.js.",{"title":1311,"path":1312,"stem":1313,"description":1314,"icon":14,"links":14},"Rendering Dynamic Blocks Using Nuxt","/tutorials/getting-started/rendering-dynamic-blocks-using-nuxt","tutorials/1.getting-started/rendering-dynamic-blocks-using-nuxt","Learn how to render dynamic blocks using Nuxt.",{"title":1316,"path":1317,"stem":1318,"description":1319,"icon":14,"links":14},"Rendering Dynamic Blocks Using SvelteKit","/tutorials/getting-started/rendering-dynamic-blocks-using-sveltekit","tutorials/1.getting-started/rendering-dynamic-blocks-using-sveltekit","Learn how to render dynamic blocks using SvelteKit.",{"title":1321,"path":1322,"stem":1323,"description":1324,"icon":14,"links":14},"Set Up Live Preview with Next.js","/tutorials/getting-started/set-up-live-preview-with-next-js","tutorials/1.getting-started/set-up-live-preview-with-next-js","Learn how to confgure Live Preview with Next.js' draft mode.",{"title":1326,"path":1327,"stem":1328,"description":1329,"icon":14,"links":14},"Set Up Live Preview with Nuxt","/tutorials/getting-started/set-up-live-preview-with-nuxt","tutorials/1.getting-started/set-up-live-preview-with-nuxt","Learn how to create a Nuxt preview plugin to configure Live Preview.",{"title":1331,"path":1332,"stem":1333,"description":1334,"icon":14,"links":14},"Submit Forms Using Directus and Next.js","/tutorials/getting-started/submit-forms-using-directus-and-nextjs","tutorials/1.getting-started/submit-forms-using-directus-and-nextjs","Learn how to submit forms using Directus and Next.js.",{"title":1336,"path":1337,"stem":1338,"description":1339,"icon":14,"links":14},"Submit Forms Using Directus and Nuxt","/tutorials/getting-started/submit-forms-using-directus-and-nuxt","tutorials/1.getting-started/submit-forms-using-directus-and-nuxt","Learn how to submit forms using Directus and Nuxt.",{"title":1341,"path":1342,"stem":1343,"description":1344,"icon":14,"links":14},"Submit Forms Using Directus and SvelteKit","/tutorials/getting-started/submit-forms-using-directus-and-sveltekit","tutorials/1.getting-started/submit-forms-using-directus-and-sveltekit","Learn how to submit forms using Directus and SvelteKit.",{"title":1346,"path":1347,"stem":1348,"description":1349,"icon":14,"links":14},"Using Authentication in Astro","/tutorials/getting-started/using-authentication-in-astro","tutorials/1.getting-started/using-authentication-in-astro","Learn how to setup Directus authentication with Astro.",{"title":1351,"path":1352,"stem":1353,"description":1354,"icon":14,"links":14},"Using Authentication in Next.js","/tutorials/getting-started/using-authentication-in-next-js","tutorials/1.getting-started/using-authentication-in-next-js","Learn how to setup Directus authentication with Next.js.",{"title":1356,"path":1357,"stem":1358,"description":1359,"icon":14,"links":14},"Using Authentication in Nuxt","/tutorials/getting-started/using-authentication-in-nuxt","tutorials/1.getting-started/using-authentication-in-nuxt","Learn how to setup Directus authentication with Nuxt.",{"title":1361,"path":1362,"stem":1363,"description":1364,"icon":14,"links":14},"Using Authentication in React","/tutorials/getting-started/using-authentication-in-react","tutorials/1.getting-started/using-authentication-in-react","Learn how to setup Directus authentication with React.",{"title":1366,"path":1367,"stem":1368,"description":1369,"icon":14,"links":14},"Using Authentication in SvelteKit","/tutorials/getting-started/using-authentication-in-sveltekit","tutorials/1.getting-started/using-authentication-in-sveltekit","Learn how to setup Directus authentication with SvelteKit.",{"title":145,"path":1371,"stem":1372,"children":1373,"description":24,"icon":14,"links":14},"/tutorials/projects","tutorials/2.projects/index",[1374,1375,1380,1385,1390,1395,1400,1405,1410,1415,1420,1425,1430,1435,1440,1445,1450,1455,1460,1465,1470,1475,1480,1485,1490,1495,1500,1505,1510,1515,1520,1525],{"title":145,"path":1371,"stem":1372,"description":24,"icon":14,"links":14},{"title":1376,"path":1377,"stem":1378,"description":1379,"icon":14,"links":14},"Build a Multi-User Chat with JavaScript and Directus Realtime","/tutorials/projects/build-a-multi-user-chat-with-javascript-and-directus-realtime","tutorials/2.projects/build-a-multi-user-chat-with-javascript-and-directus-realtime","Learn how to send and receive data over a realtime connection with JavaScript.",{"title":1381,"path":1382,"stem":1383,"description":1384,"icon":14,"links":14},"Build a Multi-User Chat with React and Directus Realtime","/tutorials/projects/build-a-multi-user-chat-with-react-and-directus-realtime","tutorials/2.projects/build-a-multi-user-chat-with-react-and-directus-realtime","Learn how to send and receive data over a realtime connection in React applications.",{"title":1386,"path":1387,"stem":1388,"description":1389,"icon":14,"links":14},"Build a Multi-User Chat with Vue.js and Directus Realtime","/tutorials/projects/build-a-multi-user-chat-with-vue-js-and-directus-realtime","tutorials/2.projects/build-a-multi-user-chat-with-vue-js-and-directus-realtime","Learn how to send and receive data over a realtime connection in a Vue.js application.",{"title":1391,"path":1392,"stem":1393,"description":1394,"icon":14,"links":14},"Build a Notebook Chrome Extension with Directus Auth","/tutorials/projects/build-a-notebook-chrome-extension-with-directus-auth","tutorials/2.projects/build-a-notebook-chrome-extension-with-directus-auth","Learn to build and integrate a Chrome Extension with Directus Auth.",{"title":1396,"path":1397,"stem":1398,"description":1399,"icon":14,"links":14},"Build a Realtime Chat App with Directus and Astro","/tutorials/projects/build-a-realtime-chat-app-using-directus-and-astro","tutorials/2.projects/build-a-realtime-chat-app-using-directus-and-astro","Learn how to setup Directus realtime with Astro.",{"title":1401,"path":1402,"stem":1403,"description":1404,"icon":14,"links":14},"Build a Realtime Chat App with Directus and Nuxt","/tutorials/projects/build-a-realtime-chat-app-using-directus-and-nuxt","tutorials/2.projects/build-a-realtime-chat-app-using-directus-and-nuxt","Learn how to setup Directus realtime with Nuxt.",{"title":1406,"path":1407,"stem":1408,"description":1409,"icon":14,"links":14},"Build a Realtime Chat App with Directus and Next.js","/tutorials/projects/build-a-realtime-chat-app-with-directus-and-next","tutorials/2.projects/build-a-realtime-chat-app-with-directus-and-next","Learn how to setup Directus realtime with Next.js.",{"title":1411,"path":1412,"stem":1413,"description":1414,"icon":14,"links":14},"Build a Realtime Chat App with Directus and SvelteKit","/tutorials/projects/build-a-realtime-chat-app-with-directus-and-sveltekit","tutorials/2.projects/build-a-realtime-chat-app-with-directus-and-sveltekit","Learn how to setup Directus realtime with SvelteKit.",{"title":1416,"path":1417,"stem":1418,"description":1419,"icon":14,"links":14},"Build a Testimonial Widget with SvelteKit and Directus","/tutorials/projects/build-a-testimonial-widget-with-sveltekit-and-directus","tutorials/2.projects/build-a-testimonial-widget-with-sveltekit-and-directus","Learn how to set up a testimonial widget using SvelteKit and Directus.",{"title":1421,"path":1422,"stem":1423,"description":1424,"icon":14,"links":14},"Build a User Feedback Widget with Vue.js","/tutorials/projects/build-a-user-feedback-widget-with-vue-js","tutorials/2.projects/build-a-user-feedback-widget-with-vue-js-","Learn how we built our docs feedback widget with Directus.",{"title":1426,"path":1427,"stem":1428,"description":1429,"icon":14,"links":14},"Build a Video Streaming App with SvelteKit and Directus","/tutorials/projects/build-a-video-streaming-app-with-sveltekit-and-directus","tutorials/2.projects/build-a-video-streaming-app-with-sveltekit-and-directus","Learn how to store and retrieve video metadata, and then build a streaming application.",{"title":1431,"path":1432,"stem":1433,"description":1434,"icon":14,"links":14},"Build an Ecommerce Platform with Next.js, Stripe, and Directus Automate","/tutorials/projects/build-an-ecommerce-platform-with-next-js-stripe-and-directus-automate","tutorials/2.projects/build-an-ecommerce-platform-with-next-js-stripe-and-directus-automate","Learn to integrate Stripe with Directus Automate to build an e-commerce website.",{"title":1436,"path":1437,"stem":1438,"description":1439,"icon":14,"links":14},"Build an Hotel Booking Platform with Next.js, Stripe, and Directus Automate","/tutorials/projects/build-an-hotel-booking-platform-with-next-js-stripe-and-directus-automate","tutorials/2.projects/build-an-hotel-booking-platform-with-next-js-stripe-and-directus-automate","Learn to build a hotel booking site with dynamic availability and payments via Stripe.",{"title":1441,"path":1442,"stem":1443,"description":1444,"icon":14,"links":14},"Build Directus Garden - A Passive Collaborative Event Booth Demo","/tutorials/projects/build-directus-garden-a-passive-collaborative-event-booth-demo","tutorials/2.projects/build-directus-garden-a-passive-collaborative-event-booth-demo","Learn how we built our engagement platform for live in-person events with P5.js.",{"title":1446,"path":1447,"stem":1448,"description":1449,"icon":14,"links":14},"Build Forms Dynamically using Directus and Astro","/tutorials/projects/build-forms-dynamically-using-directus-and-astro","tutorials/2.projects/build-forms-dynamically-using-directus-and-astro","Learn how to setup Directus fields with Astro.",{"title":1451,"path":1452,"stem":1453,"description":1454,"icon":14,"links":14},"Build Forms Dynamically using Directus and Next.js","/tutorials/projects/build-forms-dynamically-using-directus-and-next","tutorials/2.projects/build-forms-dynamically-using-directus-and-next","Learn how to setup Directus fields with Next.js.",{"title":1456,"path":1457,"stem":1458,"description":1459,"icon":14,"links":14},"Build Forms Dynamically using Directus and Nuxt","/tutorials/projects/build-forms-dynamically-using-directus-and-nuxt","tutorials/2.projects/build-forms-dynamically-using-directus-and-nuxt","Learn how to setup Directus fields with Nuxt.",{"title":1461,"path":1462,"stem":1463,"description":1464,"icon":14,"links":14},"Build Forms Dynamically using Directus and SvelteKit","/tutorials/projects/build-forms-dynamically-using-directus-and-sveltekit","tutorials/2.projects/build-forms-dynamically-using-directus-and-sveltekit","Learn how to setup Directus fields with SvelteKit.",{"title":1466,"path":1467,"stem":1468,"description":1469,"icon":14,"links":14},"Build the Leap Week Registration and Referral System","/tutorials/projects/build-the-leap-week-registration-and-referral-system","tutorials/2.projects/build-the-leap-week-registration-and-referral-system-","Learn how we built our referral-based ticketing and raffle system with AI-generated rabbitars.",{"title":1471,"path":1472,"stem":1473,"description":1474,"icon":14,"links":14},"Building AIVenture - An AI-Powered Game with Directus","/tutorials/projects/building-ai-venture-an-ai-powered-game-with-directus","tutorials/2.projects/building-ai-venture-an-ai-powered-game-with-directus","Learn the advanced techniques used with Directus Automate to build a game.",{"title":1476,"path":1477,"stem":1478,"description":1479,"icon":14,"links":14},"Create a CMS using Directus and Astro","/tutorials/projects/create-a-cms-using-directus-and-astro","tutorials/2.projects/create-a-cms-using-directus-and-astro","Learn how to create a CMS using Directus and Astro.",{"title":1481,"path":1482,"stem":1483,"description":1484,"icon":14,"links":14},"Create a CMS using Directus and Next.js","/tutorials/projects/create-a-cms-using-directus-and-nextjs","tutorials/2.projects/create-a-cms-using-directus-and-nextjs","Learn how to create a CMS using Directus and Next.js.",{"title":1486,"path":1487,"stem":1488,"description":1489,"icon":14,"links":14},"Create a CMS using Directus and Nuxt","/tutorials/projects/create-a-cms-using-directus-and-nuxt","tutorials/2.projects/create-a-cms-using-directus-and-nuxt","Learn how to create a CMS using Directus and Nuxt.",{"title":1491,"path":1492,"stem":1493,"description":1494,"icon":14,"links":14},"Create a CMS using Directus and SvelteKit","/tutorials/projects/create-a-cms-using-directus-and-sveltekit","tutorials/2.projects/create-a-cms-using-directus-and-sveltekit","Learn how to create a CMS using Directus and SvelteKit.",{"title":1496,"path":1497,"stem":1498,"description":1499,"icon":14,"links":14},"Create Dynamic Pages for a CMS using Directus and Astro","/tutorials/projects/create-dynamic-pages-for-a-cms-using-directus-and-astro","tutorials/2.projects/create-dynamic-pages-for-a-cms-using-directus-and-astro","Learn how to create dynamic pages you can use in your CMS using Directus and Astro.",{"title":1501,"path":1502,"stem":1503,"description":1504,"icon":14,"links":14},"Create Dynamic Pages for a CMS using Directus and Next.js","/tutorials/projects/create-dynamic-pages-for-a-cms-using-directus-and-nextjs","tutorials/2.projects/create-dynamic-pages-for-a-cms-using-directus-and-nextjs","Learn how to create dynamic pages you can use in your CMS using Directus and Next.js.",{"title":1506,"path":1507,"stem":1508,"description":1509,"icon":14,"links":14},"Create Dynamic Pages for a CMS using Directus and Nuxt","/tutorials/projects/create-dynamic-pages-for-a-cms-using-directus-and-nuxt","tutorials/2.projects/create-dynamic-pages-for-a-cms-using-directus-and-nuxt","Learn how to create dynamic pages you can use in your CMS using Directus and Nuxt.",{"title":1511,"path":1512,"stem":1513,"description":1514,"icon":14,"links":14},"Create Dynamic Pages for a CMS using Directus and SvelteKit","/tutorials/projects/create-dynamic-pages-for-a-cms-using-directus-and-sveltekit","tutorials/2.projects/create-dynamic-pages-for-a-cms-using-directus-and-sveltekit","Learn how to create dynamic pages you can use in your CMS using Directus and SvelteKit.",{"title":1516,"path":1517,"stem":1518,"description":1519,"icon":14,"links":14},"How I Built an AI Open Source Santa Roast App with Directus and Nuxt","/tutorials/projects/how-i-built-an-ai-open-source-santa-roast-app-with-directus-and-nuxt","tutorials/2.projects/how-i-built-an-ai-open-source-santa-roast-app-with-directus-and-nuxt","Bryant breaks down how he built an AI-powered app that roasts developers based on their GitHub contributions.",{"title":1521,"path":1522,"stem":1523,"description":1524,"icon":14,"links":14},"Integrate Directus with ESP32 Hardware Sensors","/tutorials/projects/integrate-directus-with-esp-32-hardware-sensors","tutorials/2.projects/integrate-directus-with-esp-32-hardware-sensors","Learn how to integrate Directus with IoT systems by reading and publishing sensor data.",{"title":1526,"path":1527,"stem":1528,"description":1529,"icon":14,"links":14},"Use Directus as a Baby Health Tracker with Owlet and OpsGenie","/tutorials/projects/use-directus-as-a-baby-health-tracker-with-owlet-and-ops-genie","tutorials/2.projects/use-directus-as-a-baby-health-tracker-with-owlet-and-ops-genie","Learn how to integrate Directus with hardware sensors and incident repsonse systems.",{"title":1531,"path":1532,"stem":1533,"children":1534,"description":24,"icon":14,"links":14},"Tips & Tricks","/tutorials/tips-and-tricks","tutorials/3.tips-and-tricks/index",[1535,1536,1541,1546,1551,1556,1561,1566,1571],{"title":1531,"path":1532,"stem":1533,"description":24,"icon":14,"links":14},{"title":1537,"path":1538,"stem":1539,"description":1540,"icon":14,"links":14},"Advanced Types with the Directus SDK","/tutorials/tips-and-tricks/advanced-types-with-the-directus-sdk","tutorials/3.tips-and-tricks/advanced-types-with-the-directus-sdk","Learn how to more-easily work with types and the Directus SDK.",{"title":1542,"path":1543,"stem":1544,"description":1545,"icon":14,"links":14},"Build a Monitoring Pipeline For Flows And Extensions","/tutorials/tips-and-tricks/build-a-monitoring-pipeline-for-flows-and-extensions","tutorials/3.tips-and-tricks/build-a-monitoring-pipeline-for-flows-and-extensions-","Learn how to set up complex pipelines to monitor automations and extensions.",{"title":1547,"path":1548,"stem":1549,"description":1550,"icon":14,"links":14},"Configure Okta as a Single Sign-On Provider","/tutorials/tips-and-tricks/configure-okta-as-a-single-sign-on-provider","tutorials/3.tips-and-tricks/configure-okta-as-a-single-sign-on-provider","Learn how to set up Okta SSO with the SAML authentication mechanism.",{"title":1552,"path":1553,"stem":1554,"description":1555,"icon":14,"links":14},"Implement Pagination and Infinite Scrolling in Next.js","/tutorials/tips-and-tricks/implement-pagination-and-infinite-scrolling-in-next-js","tutorials/3.tips-and-tricks/implement-pagination-and-infinite-scrolling-in-next-js-","Learn various techniques to load paginated data in your Next.js application.",{"title":1557,"path":1558,"stem":1559,"description":1560,"icon":14,"links":14},"Importing Files in Directus Automate","/tutorials/tips-and-tricks/importing-files-in-directus-automate","tutorials/3.tips-and-tricks/importing-files-in-directus-automate","Learn how to use the Request URL operation to import files in Directus Automate.",{"title":1562,"path":1563,"stem":1564,"description":1565,"icon":14,"links":14},"Preview Files in Live Preview with Google Docs Previews","/tutorials/tips-and-tricks/preview-files-in-live-preview-with-google-docs-previews","tutorials/3.tips-and-tricks/preview-files-in-live-preview-with-google-docs-previews","Learn how to use Google Gview to preview many file formats in Directus Editor.",{"title":1567,"path":1568,"stem":1569,"description":1570,"icon":14,"links":14},"Search Engine Optimization Best Practices","/tutorials/tips-and-tricks/search-engine-optimization-best-practices","tutorials/3.tips-and-tricks/search-engine-optimization-best-practices","Learn some best practices for enabling SEO in your projects using Directus.",{"title":1572,"path":1573,"stem":1574,"description":1575,"icon":14,"links":14},"Understanding Kubernetes","/tutorials/tips-and-tricks/understanding-kubernetes","tutorials/3.tips-and-tricks/understanding-kubernetes","Learn about key Kubernetes concepts and how they interact with each other.",{"title":1577,"path":1578,"stem":1579,"children":1580,"description":24,"icon":14,"links":14},"Migration","/tutorials/migration","tutorials/4.migration/index",[1581,1582,1587,1592,1597],{"title":1577,"path":1578,"stem":1579,"description":24,"icon":14,"links":14},{"title":1583,"path":1584,"stem":1585,"description":1586,"icon":14,"links":14},"Migrate from Notion to Directus","/tutorials/migration/migrate-from-notion-to-directus","tutorials/4.migration/migrate-from-notion-to-directus","Learn how to migrate data from Notion databases to Directus.",{"title":1588,"path":1589,"stem":1590,"description":1591,"icon":14,"links":14},"Migrate from Nuxt Content to Directus","/tutorials/migration/migrate-from-nuxt-content-to-directus","tutorials/4.migration/migrate-from-nuxt-content-to-directus","Learn how to move from a flat-file CMS to Directus.",{"title":1593,"path":1594,"stem":1595,"description":1596,"icon":14,"links":14},"Migrate from WordPress to Directus","/tutorials/migration/migrate-from-wordpress-to-directus","tutorials/4.migration/migrate-from-wordpress-to-directus","Learn how to migrate posts and images to Directus, with tips on plugins.",{"title":1598,"path":1599,"stem":1600,"description":1601,"icon":14,"links":14},"Promoting Changes Between Environments in Directus","/tutorials/migration/promoting-changes-between-environments-in-directus","tutorials/4.migration/promoting-changes-between-environments-in-directus","Learn the options to migrate schema and data between Directus projects.",{"title":372,"path":1603,"stem":1604,"children":1605,"description":1607,"icon":14,"links":14},"/tutorials/extensions","tutorials/5.extensions/index",[1606,1608,1613,1618,1623,1628,1633,1638,1643,1650,1657,1664,1669,1674,1679,1684,1689,1694,1699,1704,1709,1714],{"title":372,"path":1603,"stem":1604,"description":1607,"icon":14,"links":14},"All about extensions",{"title":1609,"path":1610,"stem":1611,"description":1612,"icon":14,"links":14},"Check Permissions in a Custom Endpoint","/tutorials/extensions/check-permissions-in-a-custom-endpoint","tutorials/5.extensions/check-permissions-in-a-custom-endpoint","Learn how to use internal Directus permissions when creating a custom endpoint.",{"title":1614,"path":1615,"stem":1616,"description":1617,"icon":14,"links":14},"Create Collection Items in Custom Panels","/tutorials/extensions/create-collection-items-in-custom-panels","tutorials/5.extensions/create-collection-items-in-custom-panels","Learn how to use built-in interfaces and composables to create new collections.",{"title":1619,"path":1620,"stem":1621,"description":1622,"icon":14,"links":14},"Create New Customers in Stripe in a Custom Hook","/tutorials/extensions/create-new-customers-in-stripe-in-a-custom-hook","tutorials/5.extensions/create-new-customers-in-stripe-in-a-custom-hook","Learn how to use the Stripe SDK to create data when actions occur in Directus.",{"title":1624,"path":1625,"stem":1626,"description":1627,"icon":14,"links":14},"Display External API Data From Vonage In Custom Panels","/tutorials/extensions/display-external-api-data-from-vonage-in-custom-panels","tutorials/5.extensions/display-external-api-data-from-vonage-in-custom-panels","Learn how to display records from external systems in Directus Insights.",{"title":1629,"path":1630,"stem":1631,"description":1632,"icon":14,"links":14},"Display External Weather API Data In Custom Panels","/tutorials/extensions/display-external-weather-api-data-in-custom-panels","tutorials/5.extensions/display-external-weather-api-data-in-custom-panels","Learn how to display external data in panels with a bundle and endpoint.",{"title":1634,"path":1635,"stem":1636,"description":1637,"icon":14,"links":14},"Format Dates in a Custom Display Extension","/tutorials/extensions/format-dates-in-a-custom-display-extension","tutorials/5.extensions/format-dates-in-a-custom-display-extension","Learn how to build a custom display to format data in Directus.",{"title":1639,"path":1640,"stem":1641,"description":1642,"icon":14,"links":14},"Implement Navigation in Multipage Custom Modules","/tutorials/extensions/implement-navigation-in-multipage-custom-modules","tutorials/5.extensions/implement-navigation-in-multipage-custom-modules","Learn how to navigate between multiple pages in module extensions.",{"title":1644,"path":1645,"stem":1646,"children":1647,"description":1649,"icon":14,"links":14},"Integrate Algolia Indexing with Custom Hooks","/tutorials/extensions/integrate-algolia-indexing-with-custom-hooks","tutorials/5.extensions/integrate-algolia-indexing-with-custom-hooks",[1648],{"title":1644,"path":1645,"stem":1646,"description":1649,"icon":14,"links":14},"Learn how to maintain an Algolia index when data is created, updated, and deleted.",{"title":1651,"path":1652,"stem":1653,"children":1654,"description":1656,"icon":14,"links":14},"Integrate Elasticsearch Indexing with Custom Hooks","/tutorials/extensions/integrate-elasticsearch-indexing-with-custom-hooks","tutorials/5.extensions/integrate-elasticsearch-indexing-with-custom-hooks",[1655],{"title":1651,"path":1652,"stem":1653,"description":1656,"icon":14,"links":14},"Learn how to maintain an Elasticsearch index when data is created, updated, and deleted.",{"title":1658,"path":1659,"stem":1660,"children":1661,"description":1663,"icon":14,"links":14},"Integrate Meilisearch Indexing with Custom Hooks","/tutorials/extensions/integrate-meilisearch-indexing-with-custom-hooks","tutorials/5.extensions/integrate-meilisearch-indexing-with-custom-hooks",[1662],{"title":1658,"path":1659,"stem":1660,"description":1663,"icon":14,"links":14},"Learn how to maintain an Meilisearch index when data is created, updated, and deleted.",{"title":1665,"path":1666,"stem":1667,"description":1668,"icon":14,"links":14},"Monitor and Error Track with Sentry in Custom Hooks","/tutorials/extensions/monitor-and-error-track-with-sentry-in-custom-hooks","tutorials/5.extensions/monitor-and-error-track-with-sentry-in-custom-hooks","Learn how to integrate Sentry error tracking in both your API and Data Studio.",{"title":1670,"path":1671,"stem":1672,"description":1673,"icon":14,"links":14},"Proxy an External API in a Custom Endpoint Extension","/tutorials/extensions/proxy-an-external-api-in-a-custom-endpoint-extension","tutorials/5.extensions/proxy-an-external-api-in-a-custom-endpoint-extension","Learn how to make external APIs available via Directus in a custom endpoint.",{"title":1675,"path":1676,"stem":1677,"description":1678,"icon":14,"links":14},"Read Collection Data in Custom Layouts","/tutorials/extensions/read-collection-data-in-custom-layouts","tutorials/5.extensions/read-collection-data-in-custom-layouts","Learn how to build your first layout with data from a collection.",{"title":1680,"path":1681,"stem":1682,"description":1683,"icon":14,"links":14},"Send SMS Messages with Twilio in Custom Operations","/tutorials/extensions/send-sms-messages-with-twilio-in-custom-operations","tutorials/5.extensions/send-sms-messages-with-twilio-in-custom-operations","Learn how to build a custom operation that uses the Twilio SDK.",{"title":1685,"path":1686,"stem":1687,"description":1688,"icon":14,"links":14},"Send SMS Messages with Twilio in Custom Panels","/tutorials/extensions/send-sms-messages-with-twilio-in-custom-panels","tutorials/5.extensions/send-sms-messages-with-twilio-in-custom-panels","Learn how to build a form inside a panel extension and use external APIs.",{"title":1690,"path":1691,"stem":1692,"description":1693,"icon":14,"links":14},"Summarize Relational Items in a Custom Display Extension","/tutorials/extensions/summarize-relational-items-in-a-custom-display-extension","tutorials/5.extensions/summarize-relational-items-in-a-custom-display-extension","Learn how to work with relational data in display extensions.",{"title":1695,"path":1696,"stem":1697,"description":1698,"icon":14,"links":14},"Understand Available Slots in Custom Modules","/tutorials/extensions/understand-available-slots-in-custom-modules","tutorials/5.extensions/understand-available-slots-in-custom-modules","Learn about all of the slots available in your custom modules.",{"title":1700,"path":1701,"stem":1702,"description":1703,"icon":14,"links":14},"Use Dynamic Values in Custom Email Templates","/tutorials/extensions/use-dynamic-values-in-custom-email-templates","tutorials/5.extensions/use-dynamic-values-in-custom-email-templates","Learn how to inject dynamic data into liquid templates.",{"title":1705,"path":1706,"stem":1707,"description":1708,"icon":14,"links":14},"Use npm Packages in Custom Operations","/tutorials/extensions/use-npm-packages-in-custom-operations","tutorials/5.extensions/use-npm-packages-in-custom-operations","Learn how to expose an npm package as an operation in Directus Automate.",{"title":1710,"path":1711,"stem":1712,"description":1713,"icon":14,"links":14},"Validate Phone Numbers with Twilio in a Custom Hook","/tutorials/extensions/validate-phone-numbers-with-twilio-in-a-custom-hook","tutorials/5.extensions/validate-phone-numbers-with-twilio-in-a-custom-hook","Learn how to prevent an item from saving if it has an invalid phone number.",{"title":1715,"path":1716,"stem":1717,"description":1718,"icon":14,"links":14},"Validating Third-Party JWTs in Directus (with Okta)","/tutorials/extensions/validating-third-party-jwts-in-directus","tutorials/5.extensions/validating-third-party-jwts-in-directus","Learn how to translate third part JWT's to Directus accountability",{"title":1114,"path":1720,"stem":1721,"children":1722,"description":24,"icon":14,"links":14},"/tutorials/self-hosting","tutorials/6.self-hosting/index",[1723,1724,1729,1734,1739,1744],{"title":1114,"path":1720,"stem":1721,"description":24,"icon":14,"links":14},{"title":1725,"path":1726,"stem":1727,"description":1728,"icon":14,"links":14},"Deploy Directus to an Ubuntu Server","/tutorials/self-hosting/deploy-directus-to-an-ubuntu-server","tutorials/6.self-hosting/deploy-directus-to-an-ubuntu-server","Learn how to deploy Directus on a Docker container on an Ubuntu server.",{"title":1730,"path":1731,"stem":1732,"description":1733,"icon":14,"links":14},"Deploy Directus to AWS EC2","/tutorials/self-hosting/deploy-directus-to-aws-ec2","tutorials/6.self-hosting/deploy-directus-to-aws-ec2","Learn how to deploy a Directus to AWS EC2, with a RDS database and a S3 storage bucket.",{"title":1735,"path":1736,"stem":1737,"description":1738,"icon":14,"links":14},"Deploy Directus to Azure Web Apps","/tutorials/self-hosting/deploy-directus-to-azure-web-apps","tutorials/6.self-hosting/deploy-directus-to-azure-web-apps","Learn how to deploy Directus on a Docker container on Azure.",{"title":1740,"path":1741,"stem":1742,"description":1743,"icon":14,"links":14},"Deploy Directus to Digital Ocean","/tutorials/self-hosting/deploy-directus-to-digital-ocean","tutorials/6.self-hosting/deploy-directus-to-digital-ocean","Learn how to deploy Directus on the Digital Ocean App Platform.",{"title":1745,"path":1746,"stem":1747,"description":1748,"icon":14,"links":14},"Deploy Directus to Google Cloud Platform","/tutorials/self-hosting/deploy-directus-to-google-cloud-platform","tutorials/6.self-hosting/deploy-directus-to-google-cloud-platform","Learn how to deploy Directus on GCP with a Cloud SQL database and Cloud Storage Bucket.",{"title":1750,"path":1751,"stem":1752,"children":1753,"description":24,"icon":14,"links":14},"Workflows","/tutorials/workflows","tutorials/7.workflows/index",[1754,1755,1760,1765,1770,1775,1780,1785,1790,1795,1800,1805,1810,1815,1820],{"title":1750,"path":1751,"stem":1752,"description":24,"icon":14,"links":14},{"title":1756,"path":1757,"stem":1758,"description":1759,"icon":14,"links":14},"Build Content Approval Workflows with Custom Permissions","/tutorials/workflows/build-content-approval-workflows-with-custom-permissions","tutorials/7.workflows/build-content-approval-workflows-with-custom-permissions","Learn how to configure roles and permissions for complex automations.",{"title":1761,"path":1762,"stem":1763,"description":1764,"icon":14,"links":14},"Combine Live Preview and Content Versioning with Next.js","/tutorials/workflows/combine-live-preview-and-content-versioning-with-next-js","tutorials/7.workflows/combine-live-preview-and-content-versioning-with-next-js","Learn how to set up Live Preview with different content versions in your Next.js application.",{"title":1766,"path":1767,"stem":1768,"description":1769,"icon":14,"links":14},"Create GitHub Issues with Directus Automate","/tutorials/workflows/create-github-issues-with-directus-automate","tutorials/7.workflows/create-github-issues-with-directus-automate","Learn how to integrate GitHub with Directus Automate to create new issues.",{"title":1771,"path":1772,"stem":1773,"description":1774,"icon":14,"links":14},"Detect High-Risk Phone Numbers with Vonage and Directus Automate","/tutorials/workflows/detect-high-risk-phone-numbers-with-vonage-and-directus-automate","tutorials/7.workflows/detect-high-risk-phone-numbers-with-vonage-and-directus-automate","Learn how to integrate Vonage's Number Insights API with Directus Automate to validate numbers.",{"title":1776,"path":1777,"stem":1778,"description":1779,"icon":14,"links":14},"Enrich User Data with Clearbit and Directus Automate","/tutorials/workflows/enrich-user-data-with-clearbit-and-directus-automate","tutorials/7.workflows/enrich-user-data-with-clearbit-and-directus-automate","Learn how to integrate Clearbit data enrichment with Directus Automate.",{"title":1781,"path":1782,"stem":1783,"description":1784,"icon":14,"links":14},"Generate Images with DALL•E and Directus Automate","/tutorials/workflows/generate-images-with-dall-e-and-directus-automate","tutorials/7.workflows/generate-images-with-dall-e-and-directus-automate","Learn how to integrate OpenAI's Dall•E models with Directus Automate.",{"title":1786,"path":1787,"stem":1788,"description":1789,"icon":14,"links":14},"Generate Social Posts with GPT-4 and Directus Automate","/tutorials/workflows/generate-social-posts-with-gpt-4-and-directus-automate","tutorials/7.workflows/generate-social-posts-with-gpt-4-and-directus-automate","Learn how to integrate OpenAI's GPT-4 model with Directus Automate.",{"title":1791,"path":1792,"stem":1793,"description":1794,"icon":14,"links":14},"Generate Transcripts with Deepgram and Directus Automate","/tutorials/workflows/generate-transcripts-with-deepgram-and-directus-automate","tutorials/7.workflows/generate-transcripts-with-deepgram-and-directus-automate","Learn how to integrate Deepgram's Speech-to-Text API with Directus Automate.",{"title":1796,"path":1797,"stem":1798,"description":1799,"icon":14,"links":14},"Integrating Multilingual Content with Directus and Crowdin","/tutorials/workflows/integrating-multilingual-content-with-directus-and-crowdin","tutorials/7.workflows/integrating-multilingual-content-with-directus-and-crowdin","Learn how to localize content in Directus using Crowdin's connector with Directus.",{"title":1801,"path":1802,"stem":1803,"description":1804,"icon":14,"links":14},"Invincible AI content workflows with Inngest and Directus","/tutorials/workflows/invincible-ai-content-workflows-with-inngest-and-directus","tutorials/7.workflows/invincible-ai-content-workflows-with-inngest-and-directus","Learn how to configure integration Directus and Inngest to build durable workflows for any scale.",{"title":1806,"path":1807,"stem":1808,"description":1809,"icon":14,"links":14},"Schedule Future Content with Directus Automate","/tutorials/workflows/schedule-future-content-with-directus-automate","tutorials/7.workflows/schedule-future-content-with-directus-automate","Learn how to set content to be scheduled on a future date with Directs Automate.",{"title":1811,"path":1812,"stem":1813,"description":1814,"icon":14,"links":14},"Tag Images with Clarifai and Directus Automate","/tutorials/workflows/tag-images-with-clarifai-and-directus-automate","tutorials/7.workflows/tag-images-with-clarifai-and-directus-automate","Learn how to integrate Clarifai's image recognition APIs with Directus Automate.",{"title":1816,"path":1817,"stem":1818,"description":1819,"icon":14,"links":14},"Trigger Netlify Site Builds with Directus Automate","/tutorials/workflows/trigger-netlify-site-builds-with-directus-automate","tutorials/7.workflows/trigger-netlify-site-builds-with-directus-automate","Learn how to trigger new Netlify website builds through Directus Automate.",{"title":1821,"path":1822,"stem":1823,"description":1824,"icon":14,"links":14},"Trigger Vercel Site Builds with Directus Automate","/tutorials/workflows/trigger-vercel-site-builds-with-directus-automate","tutorials/7.workflows/trigger-vercel-site-builds-with-directus-automate","Learn how to trigger new Vercel website builds through Directus Automate.",{"id":1826,"icon":1827,"content":1828,"link":1829},"812bf73d-ebfb-4246-9538-937a09a0c795","connected_tv","Learn more about our native MCP","https://directus.io/mcp",{"id":1831,"title":1436,"authors":1832,"body":1836,"description":1439,"extension":8873,"headline":14,"icon":14,"links":14,"meta":8874,"navigation":2220,"path":1437,"rawbody":8876,"seo":8877,"stem":1438,"technologies":8878,"__hash__":8880},"content/tutorials/2.projects/build-an-hotel-booking-platform-with-next-js-stripe-and-directus-automate.md",[1833],{"name":1834,"title":1835},"Trust Jamin","Guest Author",{"type":1837,"value":1838,"toc":8856},"minimark",[1839,1843,1846,1851,1854,1901,1905,1910,1924,1931,1954,1957,2122,2130,2134,2145,2181,2192,2561,2565,2575,2585,3134,3140,3230,3236,3478,3486,3490,3493,3509,3512,3699,3702,3727,3731,3741,4598,4620,4627,4764,4770,4774,4787,4796,5328,5357,5363,5367,5373,5398,5419,6095,6149,6152,6156,6173,6411,6414,6420,7299,7304,7349,7355,7706,7712,7719,7725,7728,7737,7744,7876,7882,7886,7892,7895,7908,7913,8627,8630,8673,8677,8680,8693,8696,8714,8717,8762,8765,8768,8783,8786,8792,8796,8799,8807,8810,8852],[1840,1841,1842],"p",{},"In this tutorial, you will build a fully functional hotel booking website, using Next.js for the frontend, Directus as the backend service and Stripe for receiving payments.",[1840,1844,1845],{},"You will create different room types, create and store rooms based on the room types, create new reservations dynamically when a room payment is successful and block the availability for that room based on the check-in and check-out date for the reservation.",[1847,1848,1850],"h2",{"id":1849},"before-you-start","Before You Start",[1840,1852,1853],{},"You will need:",[1855,1856,1857,1868,1881,1890,1898],"ul",{},[1858,1859,1860,1867],"li",{},[1861,1862,1866],"a",{"href":1863,"rel":1864},"https://nodejs.org/",[1865],"nofollow","Node.js"," installed and a code editor on your computer.",[1858,1869,1870,1871,1876,1877,1880],{},"A Directus project - you can use ",[1861,1872,1875],{"href":1873,"rel":1874},"https://directus.cloud/",[1865],"Directus Cloud"," or ",[1861,1878,1879],{"href":443},"run it yourself",".",[1858,1882,1883,1884,1889],{},"A ",[1861,1885,1888],{"href":1886,"rel":1887},"https://stripe.com/",[1865],"Stripe"," account with a business already set up",[1858,1891,1892,1897],{},[1861,1893,1896],{"href":1894,"rel":1895},"https://docs.stripe.com/stripe-cli",[1865],"Stripe CLI"," installed in your computer",[1858,1899,1900],{},"Some knowledge of TypeScript and React.",[1847,1902,1904],{"id":1903},"set-up-directus","Set Up Directus",[1906,1907,1909],"h3",{"id":1908},"data-model-relationships","Data Model Relationships",[1840,1911,1912,1913,1917,1918,1917,1921,1880],{},"Before setting up Directus, let's understand how the different data models you will set up in Directus are related. You need 3 data collections - ",[1914,1915,1916],"code",{},"roomtypes",", ",[1914,1919,1920],{},"rooms",[1914,1922,1923],{},"reservations",[1840,1925,1926],{},[1927,1928],"img",{"alt":1929,"src":1930},"An ER diagram showing the fields and relationships defined below.","/img/d518b80b-1fc0-4151-854f-c1a973aac4b6.webp",[1855,1932,1933,1941,1949],{},[1858,1934,1935,1938,1939,1880],{},[1914,1936,1937],{},"room_types"," are the hotel's different types of rooms and can have multiple ",[1914,1940,1920],{},[1858,1942,1943,1945,1946,1948],{},[1914,1944,1920],{}," are all the rooms the hotel has. A single room can only be of one ",[1914,1947,1937],{}," and can contain multiple reservations.",[1858,1950,1951,1953],{},[1914,1952,1923],{}," are all the reservations made by users from the application's frontend after successfully making a payment.",[1840,1955,1956],{},"In your Directus project, head to Settings -> Data Model  to create these data models with the following fields:",[1855,1958,1959,2002,2049],{},[1858,1960,1961,1963,1964],{},[1914,1962,1937],{},":\n",[1855,1965,1966,1972,1978,1984,1990],{},[1858,1967,1968,1971],{},[1914,1969,1970],{},"id",": the primary field of this collection",[1858,1973,1974,1977],{},[1914,1975,1976],{},"name",": A string field for a room type",[1858,1979,1980,1983],{},[1914,1981,1982],{},"capacity",": An integer input field for the maximum number of guests a room can occupy.",[1858,1985,1986,1989],{},[1914,1987,1988],{},"price",": A string input price of a room",[1858,1991,1992,1994,1995,1998,1999,2001],{},[1914,1993,1920],{},": A ",[1914,1996,1997],{},"One to Many"," relational field related to the ",[1914,2000,1920],{}," collection, signifying that a single room type can have multiple rooms.",[1858,2003,2004,1963,2006],{},[1914,2005,1920],{},[1855,2007,2008,2012,2018,2022,2028,2039],{},[1858,2009,2010,1971],{},[1914,2011,1970],{},[1858,2013,2014,2017],{},[1914,2015,2016],{},"is_available",": A toggle field for a room that indicates whether it is available for booking.",[1858,2019,2020,1983],{},[1914,2021,1982],{},[1858,2023,2024,2027],{},[1914,2025,2026],{},"room_number",": A string input to label a room",[1858,2029,2030,1994,2033,1998,2036,2038],{},[1914,2031,2032],{},"room_type",[1914,2034,2035],{},"Many to One",[1914,2037,1937],{}," collection, signifying that multiple rooms can only have a single room type.",[1858,2040,2041,1994,2043,2045,2046,2048],{},[1914,2042,1923],{},[1914,2044,1997],{}," relational field that is related to the ",[1914,2047,1923],{}," collection, signifying that a single room can have multiple reservations",[1858,2050,2051,1963,2053],{},[1914,2052,1923],{},[1855,2054,2055,2059,2065,2071,2077,2083,2089,2095,2104,2110,2116],{},[1858,2056,2057,1971],{},[1914,2058,1970],{},[1858,2060,2061,2064],{},[1914,2062,2063],{},"first_name",": A string input for the first name",[1858,2066,2067,2070],{},[1914,2068,2069],{},"last_name",": A string input for the last name",[1858,2072,2073,2076],{},[1914,2074,2075],{},"email",": A string input for email address",[1858,2078,2079,2082],{},[1914,2080,2081],{},"phone_number",": A string input for phone number",[1858,2084,2085,2088],{},[1914,2086,2087],{},"check_in_date",": A Datetime input for the check-in date for the reservation",[1858,2090,2091,2094],{},[1914,2092,2093],{},"check_out_date",": A Datetime input for the check-out date for the reservation",[1858,2096,2097,1994,2100,2045,2102,2048],{},[1914,2098,2099],{},"room_id",[1914,2101,2035],{},[1914,2103,1920],{},[1858,2105,2106,2109],{},[1914,2107,2108],{},"nights",": A string input for the number of nights the reservations will last.",[1858,2111,2112,2115],{},[1914,2113,2114],{},"total_price",": A string input for the total cost of the reservation",[1858,2117,2118,2121],{},[1914,2119,2120],{},"payment_id",": A string input for the payment for the reservation that happened on Stripe.",[1840,2123,2124,2125,1880],{},"Create some items in the Room Types and Rooms collections - ",[1861,2126,2129],{"href":2127,"rel":2128},"https://github.com/directus-labs/nextjs-hotel-booking-system/tree/main/sample-data",[1865],"here's some sample data",[1906,2131,2133],{"id":2132},"configure-the-directus-sdk","Configure the Directus SDK",[1840,2135,2136,2137,2140,2141,2144],{},"Open the ",[1914,2138,2139],{},"hotel-resort"," project in a code editor and create a ",[1914,2142,2143],{},".env.local"," file, being sure to place the value with your Directus project URL:",[2146,2147,2151],"pre",{"className":2148,"code":2149,"language":2150,"meta":24,"style":24},"language-bash shiki shiki-themes github-light github-light github-dark","DIRECTUS_URL=YOUR_DIRECTUS_URL\nAPP_URL=http://localhost:3000\n","bash",[1914,2152,2153,2170],{"__ignoreMap":24},[2154,2155,2158,2162,2166],"span",{"class":2156,"line":2157},"line",1,[2154,2159,2161],{"class":2160},"sxrX7","DIRECTUS_URL",[2154,2163,2165],{"class":2164},"s8jYJ","=",[2154,2167,2169],{"class":2168},"sIIMD","YOUR_DIRECTUS_URL\n",[2154,2171,2173,2176,2178],{"class":2156,"line":2172},2,[2154,2174,2175],{"class":2160},"APP_URL",[2154,2177,2165],{"class":2164},[2154,2179,2180],{"class":2168},"http://localhost:3000\n",[1840,2182,2183,2184,2187,2188,2191],{},"Create a new directory called ",[1914,2185,2186],{},"lib",". Inside it, create ",[1914,2189,2190],{},"directus.ts"," to initialize a new Directus SDK instance:",[2146,2193,2197],{"className":2194,"code":2195,"language":2196,"meta":24,"style":24},"language-ts shiki shiki-themes github-light github-light github-dark","import { createDirectus, rest } from \"@directus/sdk\";\n\ntype RoomTypes = {\n  capacity: number;\n  price: string;\n  name: string;\n  rooms: number[];\n};\n\ntype Reservations = {\n  first_name: string;\n  last_name: string;\n  email: string;\n  phone_number: string;\n  check_in_date: string;\n  check_out_date: string;\n  room_id: string;\n  nights: number;\n  total_price: string;\n  payment_id: string\n};\n\ntype Schema = {\n  room_types: RoomTypes[];\n  reservations: Reservations[];\n};\n\nconst directus = createDirectus\u003CSchema>(\n  process.env.DIRECTUS_URL as string\n).with(rest());\n\nexport default directus;\n","ts",[1914,2198,2199,2216,2222,2238,2254,2267,2279,2292,2298,2303,2315,2327,2339,2351,2363,2375,2387,2399,2411,2423,2434,2439,2444,2456,2468,2480,2485,2490,2513,2526,2544,2549],{"__ignoreMap":24},[2154,2200,2201,2204,2207,2210,2213],{"class":2156,"line":2157},[2154,2202,2203],{"class":2164},"import",[2154,2205,2206],{"class":2160}," { createDirectus, rest } ",[2154,2208,2209],{"class":2164},"from",[2154,2211,2212],{"class":2168}," \"@directus/sdk\"",[2154,2214,2215],{"class":2160},";\n",[2154,2217,2218],{"class":2156,"line":2172},[2154,2219,2221],{"emptyLinePlaceholder":2220},true,"\n",[2154,2223,2225,2228,2232,2235],{"class":2156,"line":2224},3,[2154,2226,2227],{"class":2164},"type",[2154,2229,2231],{"class":2230},"snPdu"," RoomTypes",[2154,2233,2234],{"class":2164}," =",[2154,2236,2237],{"class":2160}," {\n",[2154,2239,2241,2245,2248,2252],{"class":2156,"line":2240},4,[2154,2242,2244],{"class":2243},"sP4rz","  capacity",[2154,2246,2247],{"class":2164},":",[2154,2249,2251],{"class":2250},"sBjJW"," number",[2154,2253,2215],{"class":2160},[2154,2255,2257,2260,2262,2265],{"class":2156,"line":2256},5,[2154,2258,2259],{"class":2243},"  price",[2154,2261,2247],{"class":2164},[2154,2263,2264],{"class":2250}," string",[2154,2266,2215],{"class":2160},[2154,2268,2270,2273,2275,2277],{"class":2156,"line":2269},6,[2154,2271,2272],{"class":2243},"  name",[2154,2274,2247],{"class":2164},[2154,2276,2264],{"class":2250},[2154,2278,2215],{"class":2160},[2154,2280,2282,2285,2287,2289],{"class":2156,"line":2281},7,[2154,2283,2284],{"class":2243},"  rooms",[2154,2286,2247],{"class":2164},[2154,2288,2251],{"class":2250},[2154,2290,2291],{"class":2160},"[];\n",[2154,2293,2295],{"class":2156,"line":2294},8,[2154,2296,2297],{"class":2160},"};\n",[2154,2299,2301],{"class":2156,"line":2300},9,[2154,2302,2221],{"emptyLinePlaceholder":2220},[2154,2304,2306,2308,2311,2313],{"class":2156,"line":2305},10,[2154,2307,2227],{"class":2164},[2154,2309,2310],{"class":2230}," Reservations",[2154,2312,2234],{"class":2164},[2154,2314,2237],{"class":2160},[2154,2316,2318,2321,2323,2325],{"class":2156,"line":2317},11,[2154,2319,2320],{"class":2243},"  first_name",[2154,2322,2247],{"class":2164},[2154,2324,2264],{"class":2250},[2154,2326,2215],{"class":2160},[2154,2328,2330,2333,2335,2337],{"class":2156,"line":2329},12,[2154,2331,2332],{"class":2243},"  last_name",[2154,2334,2247],{"class":2164},[2154,2336,2264],{"class":2250},[2154,2338,2215],{"class":2160},[2154,2340,2342,2345,2347,2349],{"class":2156,"line":2341},13,[2154,2343,2344],{"class":2243},"  email",[2154,2346,2247],{"class":2164},[2154,2348,2264],{"class":2250},[2154,2350,2215],{"class":2160},[2154,2352,2354,2357,2359,2361],{"class":2156,"line":2353},14,[2154,2355,2356],{"class":2243},"  phone_number",[2154,2358,2247],{"class":2164},[2154,2360,2264],{"class":2250},[2154,2362,2215],{"class":2160},[2154,2364,2366,2369,2371,2373],{"class":2156,"line":2365},15,[2154,2367,2368],{"class":2243},"  check_in_date",[2154,2370,2247],{"class":2164},[2154,2372,2264],{"class":2250},[2154,2374,2215],{"class":2160},[2154,2376,2378,2381,2383,2385],{"class":2156,"line":2377},16,[2154,2379,2380],{"class":2243},"  check_out_date",[2154,2382,2247],{"class":2164},[2154,2384,2264],{"class":2250},[2154,2386,2215],{"class":2160},[2154,2388,2390,2393,2395,2397],{"class":2156,"line":2389},17,[2154,2391,2392],{"class":2243},"  room_id",[2154,2394,2247],{"class":2164},[2154,2396,2264],{"class":2250},[2154,2398,2215],{"class":2160},[2154,2400,2402,2405,2407,2409],{"class":2156,"line":2401},18,[2154,2403,2404],{"class":2243},"  nights",[2154,2406,2247],{"class":2164},[2154,2408,2251],{"class":2250},[2154,2410,2215],{"class":2160},[2154,2412,2414,2417,2419,2421],{"class":2156,"line":2413},19,[2154,2415,2416],{"class":2243},"  total_price",[2154,2418,2247],{"class":2164},[2154,2420,2264],{"class":2250},[2154,2422,2215],{"class":2160},[2154,2424,2426,2429,2431],{"class":2156,"line":2425},20,[2154,2427,2428],{"class":2243},"  payment_id",[2154,2430,2247],{"class":2164},[2154,2432,2433],{"class":2250}," string\n",[2154,2435,2437],{"class":2156,"line":2436},21,[2154,2438,2297],{"class":2160},[2154,2440,2442],{"class":2156,"line":2441},22,[2154,2443,2221],{"emptyLinePlaceholder":2220},[2154,2445,2447,2449,2452,2454],{"class":2156,"line":2446},23,[2154,2448,2227],{"class":2164},[2154,2450,2451],{"class":2230}," Schema",[2154,2453,2234],{"class":2164},[2154,2455,2237],{"class":2160},[2154,2457,2459,2462,2464,2466],{"class":2156,"line":2458},24,[2154,2460,2461],{"class":2243},"  room_types",[2154,2463,2247],{"class":2164},[2154,2465,2231],{"class":2230},[2154,2467,2291],{"class":2160},[2154,2469,2471,2474,2476,2478],{"class":2156,"line":2470},25,[2154,2472,2473],{"class":2243},"  reservations",[2154,2475,2247],{"class":2164},[2154,2477,2310],{"class":2230},[2154,2479,2291],{"class":2160},[2154,2481,2483],{"class":2156,"line":2482},26,[2154,2484,2297],{"class":2160},[2154,2486,2488],{"class":2156,"line":2487},27,[2154,2489,2221],{"emptyLinePlaceholder":2220},[2154,2491,2493,2496,2499,2501,2504,2507,2510],{"class":2156,"line":2492},28,[2154,2494,2495],{"class":2164},"const",[2154,2497,2498],{"class":2250}," directus",[2154,2500,2234],{"class":2164},[2154,2502,2503],{"class":2230}," createDirectus",[2154,2505,2506],{"class":2160},"\u003C",[2154,2508,2509],{"class":2230},"Schema",[2154,2511,2512],{"class":2160},">(\n",[2154,2514,2516,2519,2521,2524],{"class":2156,"line":2515},29,[2154,2517,2518],{"class":2160},"  process.env.",[2154,2520,2161],{"class":2250},[2154,2522,2523],{"class":2164}," as",[2154,2525,2433],{"class":2250},[2154,2527,2529,2532,2535,2538,2541],{"class":2156,"line":2528},30,[2154,2530,2531],{"class":2160},").",[2154,2533,2534],{"class":2230},"with",[2154,2536,2537],{"class":2160},"(",[2154,2539,2540],{"class":2230},"rest",[2154,2542,2543],{"class":2160},"());\n",[2154,2545,2547],{"class":2156,"line":2546},31,[2154,2548,2221],{"emptyLinePlaceholder":2220},[2154,2550,2552,2555,2558],{"class":2156,"line":2551},32,[2154,2553,2554],{"class":2164},"export",[2154,2556,2557],{"class":2164}," default",[2154,2559,2560],{"class":2160}," directus;\n",[1906,2562,2564],{"id":2563},"create-directus-api-actions","Create Directus API Actions",[1840,2566,2567,2568,2570,2571,2574],{},"In the ",[1914,2569,2186],{}," directory, create a new file called ",[1914,2572,2573],{},"apis.ts",". This file will contain all the API requests the Next.js application will make to Directus.",[1840,2576,2577,2578,2581,2582,2247],{},"Add a ",[1914,2579,2580],{},"getRoomTypes"," function to ",[1914,2583,2584],{},"lib/apis.ts",[2146,2586,2590],{"className":2587,"code":2588,"language":2589,"meta":24,"style":24},"language-tsx shiki shiki-themes github-light github-light github-dark","import directus from \"./directus\";\nimport { readItems, createItem } from \"@directus/sdk\";\n\nexport const getRoomTypes = async (\n  checkInDate: string,\n  checkOutDate: string,\n  capacity: string\n) => {\n  try {\n    const availableRooms = await directus.request(\n      readItems(\"room_types\", {\n        // fetches all fields from room_types\n        fields: [\"*\"],\n        filter: {\n          // check if the capacity is greater than the requested capacity\n          capacity: { _gte: Number(capacity) },\n        },\n        deep: {\n          rooms: {\n            _limit: 1,\n            _filter: {\n              _or: [\n                // check if the room is available and if the check_in_date is empty\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_in_date: { _null: true },\n                      },\n                    },\n                  ],\n                },\n                // check if the room is available and if the check_out_date is empty\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_out_date: { _null: true },\n                      },\n                    },\n                  ],\n                },\n                // check if the check_out_date is less than the requested checkInDate\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_out_date: { _lt: checkInDate },\n                      },\n                    },\n                  ],\n                },\n                // check if the check_in_date is less than the requested checkOutDate\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_in_date: { _gt: checkOutDate },\n                      },\n                    },\n                  ],\n                },\n              ],\n            },\n          },\n        },\n      })\n    );\n    return availableRooms;\n  } catch (error) {\n    console.error(\"Error fetching available room types:\", error);\n  }\n};\n","tsx",[1914,2591,2592,2606,2619,2623,2641,2653,2664,2672,2682,2689,2711,2724,2730,2741,2746,2751,2762,2767,2772,2777,2787,2792,2797,2802,2807,2812,2817,2827,2832,2842,2847,2852,2857,2863,2869,2874,2879,2884,2893,2898,2908,2913,2918,2923,2928,2934,2939,2944,2949,2958,2963,2969,2974,2979,2984,2989,2995,3000,3005,3010,3019,3024,3030,3035,3040,3045,3050,3056,3062,3068,3073,3079,3085,3094,3106,3123,3129],{"__ignoreMap":24},[2154,2593,2594,2596,2599,2601,2604],{"class":2156,"line":2157},[2154,2595,2203],{"class":2164},[2154,2597,2598],{"class":2160}," directus ",[2154,2600,2209],{"class":2164},[2154,2602,2603],{"class":2168}," \"./directus\"",[2154,2605,2215],{"class":2160},[2154,2607,2608,2610,2613,2615,2617],{"class":2156,"line":2172},[2154,2609,2203],{"class":2164},[2154,2611,2612],{"class":2160}," { readItems, createItem } ",[2154,2614,2209],{"class":2164},[2154,2616,2212],{"class":2168},[2154,2618,2215],{"class":2160},[2154,2620,2621],{"class":2156,"line":2224},[2154,2622,2221],{"emptyLinePlaceholder":2220},[2154,2624,2625,2627,2630,2633,2635,2638],{"class":2156,"line":2240},[2154,2626,2554],{"class":2164},[2154,2628,2629],{"class":2164}," const",[2154,2631,2632],{"class":2230}," getRoomTypes",[2154,2634,2234],{"class":2164},[2154,2636,2637],{"class":2164}," async",[2154,2639,2640],{"class":2160}," (\n",[2154,2642,2643,2646,2648,2650],{"class":2156,"line":2256},[2154,2644,2645],{"class":2243},"  checkInDate",[2154,2647,2247],{"class":2164},[2154,2649,2264],{"class":2250},[2154,2651,2652],{"class":2160},",\n",[2154,2654,2655,2658,2660,2662],{"class":2156,"line":2269},[2154,2656,2657],{"class":2243},"  checkOutDate",[2154,2659,2247],{"class":2164},[2154,2661,2264],{"class":2250},[2154,2663,2652],{"class":2160},[2154,2665,2666,2668,2670],{"class":2156,"line":2281},[2154,2667,2244],{"class":2243},[2154,2669,2247],{"class":2164},[2154,2671,2433],{"class":2250},[2154,2673,2674,2677,2680],{"class":2156,"line":2294},[2154,2675,2676],{"class":2160},") ",[2154,2678,2679],{"class":2164},"=>",[2154,2681,2237],{"class":2160},[2154,2683,2684,2687],{"class":2156,"line":2300},[2154,2685,2686],{"class":2164},"  try",[2154,2688,2237],{"class":2160},[2154,2690,2691,2694,2697,2699,2702,2705,2708],{"class":2156,"line":2305},[2154,2692,2693],{"class":2164},"    const",[2154,2695,2696],{"class":2250}," availableRooms",[2154,2698,2234],{"class":2164},[2154,2700,2701],{"class":2164}," await",[2154,2703,2704],{"class":2160}," directus.",[2154,2706,2707],{"class":2230},"request",[2154,2709,2710],{"class":2160},"(\n",[2154,2712,2713,2716,2718,2721],{"class":2156,"line":2317},[2154,2714,2715],{"class":2230},"      readItems",[2154,2717,2537],{"class":2160},[2154,2719,2720],{"class":2168},"\"room_types\"",[2154,2722,2723],{"class":2160},", {\n",[2154,2725,2726],{"class":2156,"line":2329},[2154,2727,2729],{"class":2728},"sCsY4","        // fetches all fields from room_types\n",[2154,2731,2732,2735,2738],{"class":2156,"line":2341},[2154,2733,2734],{"class":2160},"        fields: [",[2154,2736,2737],{"class":2168},"\"*\"",[2154,2739,2740],{"class":2160},"],\n",[2154,2742,2743],{"class":2156,"line":2353},[2154,2744,2745],{"class":2160},"        filter: {\n",[2154,2747,2748],{"class":2156,"line":2365},[2154,2749,2750],{"class":2728},"          // check if the capacity is greater than the requested capacity\n",[2154,2752,2753,2756,2759],{"class":2156,"line":2377},[2154,2754,2755],{"class":2160},"          capacity: { _gte: ",[2154,2757,2758],{"class":2230},"Number",[2154,2760,2761],{"class":2160},"(capacity) },\n",[2154,2763,2764],{"class":2156,"line":2389},[2154,2765,2766],{"class":2160},"        },\n",[2154,2768,2769],{"class":2156,"line":2401},[2154,2770,2771],{"class":2160},"        deep: {\n",[2154,2773,2774],{"class":2156,"line":2413},[2154,2775,2776],{"class":2160},"          rooms: {\n",[2154,2778,2779,2782,2785],{"class":2156,"line":2425},[2154,2780,2781],{"class":2160},"            _limit: ",[2154,2783,2784],{"class":2250},"1",[2154,2786,2652],{"class":2160},[2154,2788,2789],{"class":2156,"line":2436},[2154,2790,2791],{"class":2160},"            _filter: {\n",[2154,2793,2794],{"class":2156,"line":2441},[2154,2795,2796],{"class":2160},"              _or: [\n",[2154,2798,2799],{"class":2156,"line":2446},[2154,2800,2801],{"class":2728},"                // check if the room is available and if the check_in_date is empty\n",[2154,2803,2804],{"class":2156,"line":2458},[2154,2805,2806],{"class":2160},"                {\n",[2154,2808,2809],{"class":2156,"line":2470},[2154,2810,2811],{"class":2160},"                  _and: [\n",[2154,2813,2814],{"class":2156,"line":2482},[2154,2815,2816],{"class":2160},"                    {\n",[2154,2818,2819,2822,2825],{"class":2156,"line":2487},[2154,2820,2821],{"class":2160},"                      is_available: ",[2154,2823,2824],{"class":2250},"true",[2154,2826,2652],{"class":2160},[2154,2828,2829],{"class":2156,"line":2492},[2154,2830,2831],{"class":2160},"                      reservations: {\n",[2154,2833,2834,2837,2839],{"class":2156,"line":2515},[2154,2835,2836],{"class":2160},"                        check_in_date: { _null: ",[2154,2838,2824],{"class":2250},[2154,2840,2841],{"class":2160}," },\n",[2154,2843,2844],{"class":2156,"line":2528},[2154,2845,2846],{"class":2160},"                      },\n",[2154,2848,2849],{"class":2156,"line":2546},[2154,2850,2851],{"class":2160},"                    },\n",[2154,2853,2854],{"class":2156,"line":2551},[2154,2855,2856],{"class":2160},"                  ],\n",[2154,2858,2860],{"class":2156,"line":2859},33,[2154,2861,2862],{"class":2160},"                },\n",[2154,2864,2866],{"class":2156,"line":2865},34,[2154,2867,2868],{"class":2728},"                // check if the room is available and if the check_out_date is empty\n",[2154,2870,2872],{"class":2156,"line":2871},35,[2154,2873,2806],{"class":2160},[2154,2875,2877],{"class":2156,"line":2876},36,[2154,2878,2811],{"class":2160},[2154,2880,2882],{"class":2156,"line":2881},37,[2154,2883,2816],{"class":2160},[2154,2885,2887,2889,2891],{"class":2156,"line":2886},38,[2154,2888,2821],{"class":2160},[2154,2890,2824],{"class":2250},[2154,2892,2652],{"class":2160},[2154,2894,2896],{"class":2156,"line":2895},39,[2154,2897,2831],{"class":2160},[2154,2899,2901,2904,2906],{"class":2156,"line":2900},40,[2154,2902,2903],{"class":2160},"                        check_out_date: { _null: ",[2154,2905,2824],{"class":2250},[2154,2907,2841],{"class":2160},[2154,2909,2911],{"class":2156,"line":2910},41,[2154,2912,2846],{"class":2160},[2154,2914,2916],{"class":2156,"line":2915},42,[2154,2917,2851],{"class":2160},[2154,2919,2921],{"class":2156,"line":2920},43,[2154,2922,2856],{"class":2160},[2154,2924,2926],{"class":2156,"line":2925},44,[2154,2927,2862],{"class":2160},[2154,2929,2931],{"class":2156,"line":2930},45,[2154,2932,2933],{"class":2728},"                // check if the check_out_date is less than the requested checkInDate\n",[2154,2935,2937],{"class":2156,"line":2936},46,[2154,2938,2806],{"class":2160},[2154,2940,2942],{"class":2156,"line":2941},47,[2154,2943,2811],{"class":2160},[2154,2945,2947],{"class":2156,"line":2946},48,[2154,2948,2816],{"class":2160},[2154,2950,2952,2954,2956],{"class":2156,"line":2951},49,[2154,2953,2821],{"class":2160},[2154,2955,2824],{"class":2250},[2154,2957,2652],{"class":2160},[2154,2959,2961],{"class":2156,"line":2960},50,[2154,2962,2831],{"class":2160},[2154,2964,2966],{"class":2156,"line":2965},51,[2154,2967,2968],{"class":2160},"                        check_out_date: { _lt: checkInDate },\n",[2154,2970,2972],{"class":2156,"line":2971},52,[2154,2973,2846],{"class":2160},[2154,2975,2977],{"class":2156,"line":2976},53,[2154,2978,2851],{"class":2160},[2154,2980,2982],{"class":2156,"line":2981},54,[2154,2983,2856],{"class":2160},[2154,2985,2987],{"class":2156,"line":2986},55,[2154,2988,2862],{"class":2160},[2154,2990,2992],{"class":2156,"line":2991},56,[2154,2993,2994],{"class":2728},"                // check if the check_in_date is less than the requested checkOutDate\n",[2154,2996,2998],{"class":2156,"line":2997},57,[2154,2999,2806],{"class":2160},[2154,3001,3003],{"class":2156,"line":3002},58,[2154,3004,2811],{"class":2160},[2154,3006,3008],{"class":2156,"line":3007},59,[2154,3009,2816],{"class":2160},[2154,3011,3013,3015,3017],{"class":2156,"line":3012},60,[2154,3014,2821],{"class":2160},[2154,3016,2824],{"class":2250},[2154,3018,2652],{"class":2160},[2154,3020,3022],{"class":2156,"line":3021},61,[2154,3023,2831],{"class":2160},[2154,3025,3027],{"class":2156,"line":3026},62,[2154,3028,3029],{"class":2160},"                        check_in_date: { _gt: checkOutDate },\n",[2154,3031,3033],{"class":2156,"line":3032},63,[2154,3034,2846],{"class":2160},[2154,3036,3038],{"class":2156,"line":3037},64,[2154,3039,2851],{"class":2160},[2154,3041,3043],{"class":2156,"line":3042},65,[2154,3044,2856],{"class":2160},[2154,3046,3048],{"class":2156,"line":3047},66,[2154,3049,2862],{"class":2160},[2154,3051,3053],{"class":2156,"line":3052},67,[2154,3054,3055],{"class":2160},"              ],\n",[2154,3057,3059],{"class":2156,"line":3058},68,[2154,3060,3061],{"class":2160},"            },\n",[2154,3063,3065],{"class":2156,"line":3064},69,[2154,3066,3067],{"class":2160},"          },\n",[2154,3069,3071],{"class":2156,"line":3070},70,[2154,3072,2766],{"class":2160},[2154,3074,3076],{"class":2156,"line":3075},71,[2154,3077,3078],{"class":2160},"      })\n",[2154,3080,3082],{"class":2156,"line":3081},72,[2154,3083,3084],{"class":2160},"    );\n",[2154,3086,3088,3091],{"class":2156,"line":3087},73,[2154,3089,3090],{"class":2164},"    return",[2154,3092,3093],{"class":2160}," availableRooms;\n",[2154,3095,3097,3100,3103],{"class":2156,"line":3096},74,[2154,3098,3099],{"class":2160},"  } ",[2154,3101,3102],{"class":2164},"catch",[2154,3104,3105],{"class":2160}," (error) {\n",[2154,3107,3109,3112,3115,3117,3120],{"class":2156,"line":3108},75,[2154,3110,3111],{"class":2160},"    console.",[2154,3113,3114],{"class":2230},"error",[2154,3116,2537],{"class":2160},[2154,3118,3119],{"class":2168},"\"Error fetching available room types:\"",[2154,3121,3122],{"class":2160},", error);\n",[2154,3124,3126],{"class":2156,"line":3125},76,[2154,3127,3128],{"class":2160},"  }\n",[2154,3130,3132],{"class":2156,"line":3131},77,[2154,3133,2297],{"class":2160},[1840,3135,3136,3137,3139],{},"Let's break down the ",[1914,3138,2580],{}," object for better understanding:",[1855,3141,3142,3158,3179,3211,3221],{},[1858,3143,3144,3145,3148,3149,3151,3152,3155,3156,1880],{},"The ",[1914,3146,3147],{},"filter"," field uses a filter operator to filter the ",[1914,3150,1937],{}," collection only to show the room types whose capacity is ",[1914,3153,3154],{},"_gte"," (greater than or equal to) the requested ",[1914,3157,1982],{},[1858,3159,3160,3161,3164,3165,3167,3168,3170,3171,3174,3175,3178],{},"Next, we use a ",[1914,3162,3163],{},"deep"," parameter to filter the nested relational dataset in the ",[1914,3166,1937],{}," collection. In the ",[1914,3169,3163],{}," parameter, we use Directus's logic operators ",[1914,3172,3173],{},"_or"," and ",[1914,3176,3177],{},"_and"," to check if any rooms are available and if their reservation date does not conflict with the requested data dates.",[1858,3180,3181,3182,3184,3185,3174,3187,3189,3190,3192,3193,3196,3197,3200,3201,3203,3204,3207,3208,1880],{},"If the ",[1914,3183,1923],{}," ",[1914,3186,2087],{},[1914,3188,2093],{}," dates are null, it means the room has never been booked before; thus, it is available. If the ",[1914,3191,2087],{}," of the room is ",[1914,3194,3195],{},"_gt","( greater than ) the ",[1914,3198,3199],{},"checkOutDate",", it means the room is also available, so also if the ",[1914,3202,2093],{}," is ",[1914,3205,3206],{},"_lt"," (lesser than) the ",[1914,3209,3210],{},"checkInDate",[1858,3212,3213,3214,3217,3218,3220],{},"Using the ",[1914,3215,3216],{},"_limit"," parameter, we are limiting the ",[1914,3219,1920],{}," result to be just one as we only need users to book one room when making a reservation",[1858,3222,3223,3224,3226,3227,1880],{},"Finally, based on Directus's response, the ",[1914,3225,2580],{}," function will either throw an error or return the fetched ",[1914,3228,3229],{},"roomTypes",[1840,3231,3232,3233,2247],{},"Create a another function for making a new reservation called ",[1914,3234,3235],{},"makeReservation",[2146,3237,3239],{"className":2194,"code":3238,"language":2196,"meta":24,"style":24},"type ReservationData = {\n  first_name: string;\n  last_name: string;\n  email: string;\n  phone_number: string;\n  check_in_date: string;\n  check_out_date: string;\n  room_id: string;\n  nights: string;\n  total_price: string;\n  payment_id: string;\n};\n\nexport const makeReservation = async (reservationData: ReservationData) => {\n  try {\n    const data = await directus.request(\n      createItem(\"reservations\", {\n        ...reservationData,\n      })\n    );\n    return \"Booking Successful\";\n  } catch (error) {\n    console.error(\"Error creating a reservation:\", error);\n  }\n};\n",[1914,3240,3241,3252,3262,3272,3282,3292,3302,3312,3322,3332,3342,3352,3356,3360,3389,3395,3412,3424,3432,3436,3440,3449,3457,3470,3474],{"__ignoreMap":24},[2154,3242,3243,3245,3248,3250],{"class":2156,"line":2157},[2154,3244,2227],{"class":2164},[2154,3246,3247],{"class":2230}," ReservationData",[2154,3249,2234],{"class":2164},[2154,3251,2237],{"class":2160},[2154,3253,3254,3256,3258,3260],{"class":2156,"line":2172},[2154,3255,2320],{"class":2243},[2154,3257,2247],{"class":2164},[2154,3259,2264],{"class":2250},[2154,3261,2215],{"class":2160},[2154,3263,3264,3266,3268,3270],{"class":2156,"line":2224},[2154,3265,2332],{"class":2243},[2154,3267,2247],{"class":2164},[2154,3269,2264],{"class":2250},[2154,3271,2215],{"class":2160},[2154,3273,3274,3276,3278,3280],{"class":2156,"line":2240},[2154,3275,2344],{"class":2243},[2154,3277,2247],{"class":2164},[2154,3279,2264],{"class":2250},[2154,3281,2215],{"class":2160},[2154,3283,3284,3286,3288,3290],{"class":2156,"line":2256},[2154,3285,2356],{"class":2243},[2154,3287,2247],{"class":2164},[2154,3289,2264],{"class":2250},[2154,3291,2215],{"class":2160},[2154,3293,3294,3296,3298,3300],{"class":2156,"line":2269},[2154,3295,2368],{"class":2243},[2154,3297,2247],{"class":2164},[2154,3299,2264],{"class":2250},[2154,3301,2215],{"class":2160},[2154,3303,3304,3306,3308,3310],{"class":2156,"line":2281},[2154,3305,2380],{"class":2243},[2154,3307,2247],{"class":2164},[2154,3309,2264],{"class":2250},[2154,3311,2215],{"class":2160},[2154,3313,3314,3316,3318,3320],{"class":2156,"line":2294},[2154,3315,2392],{"class":2243},[2154,3317,2247],{"class":2164},[2154,3319,2264],{"class":2250},[2154,3321,2215],{"class":2160},[2154,3323,3324,3326,3328,3330],{"class":2156,"line":2300},[2154,3325,2404],{"class":2243},[2154,3327,2247],{"class":2164},[2154,3329,2264],{"class":2250},[2154,3331,2215],{"class":2160},[2154,3333,3334,3336,3338,3340],{"class":2156,"line":2305},[2154,3335,2416],{"class":2243},[2154,3337,2247],{"class":2164},[2154,3339,2264],{"class":2250},[2154,3341,2215],{"class":2160},[2154,3343,3344,3346,3348,3350],{"class":2156,"line":2317},[2154,3345,2428],{"class":2243},[2154,3347,2247],{"class":2164},[2154,3349,2264],{"class":2250},[2154,3351,2215],{"class":2160},[2154,3353,3354],{"class":2156,"line":2329},[2154,3355,2297],{"class":2160},[2154,3357,3358],{"class":2156,"line":2341},[2154,3359,2221],{"emptyLinePlaceholder":2220},[2154,3361,3362,3364,3366,3369,3371,3373,3376,3379,3381,3383,3385,3387],{"class":2156,"line":2353},[2154,3363,2554],{"class":2164},[2154,3365,2629],{"class":2164},[2154,3367,3368],{"class":2230}," makeReservation",[2154,3370,2234],{"class":2164},[2154,3372,2637],{"class":2164},[2154,3374,3375],{"class":2160}," (",[2154,3377,3378],{"class":2243},"reservationData",[2154,3380,2247],{"class":2164},[2154,3382,3247],{"class":2230},[2154,3384,2676],{"class":2160},[2154,3386,2679],{"class":2164},[2154,3388,2237],{"class":2160},[2154,3390,3391,3393],{"class":2156,"line":2365},[2154,3392,2686],{"class":2164},[2154,3394,2237],{"class":2160},[2154,3396,3397,3399,3402,3404,3406,3408,3410],{"class":2156,"line":2377},[2154,3398,2693],{"class":2164},[2154,3400,3401],{"class":2250}," data",[2154,3403,2234],{"class":2164},[2154,3405,2701],{"class":2164},[2154,3407,2704],{"class":2160},[2154,3409,2707],{"class":2230},[2154,3411,2710],{"class":2160},[2154,3413,3414,3417,3419,3422],{"class":2156,"line":2389},[2154,3415,3416],{"class":2230},"      createItem",[2154,3418,2537],{"class":2160},[2154,3420,3421],{"class":2168},"\"reservations\"",[2154,3423,2723],{"class":2160},[2154,3425,3426,3429],{"class":2156,"line":2401},[2154,3427,3428],{"class":2164},"        ...",[2154,3430,3431],{"class":2160},"reservationData,\n",[2154,3433,3434],{"class":2156,"line":2413},[2154,3435,3078],{"class":2160},[2154,3437,3438],{"class":2156,"line":2425},[2154,3439,3084],{"class":2160},[2154,3441,3442,3444,3447],{"class":2156,"line":2436},[2154,3443,3090],{"class":2164},[2154,3445,3446],{"class":2168}," \"Booking Successful\"",[2154,3448,2215],{"class":2160},[2154,3450,3451,3453,3455],{"class":2156,"line":2441},[2154,3452,3099],{"class":2160},[2154,3454,3102],{"class":2164},[2154,3456,3105],{"class":2160},[2154,3458,3459,3461,3463,3465,3468],{"class":2156,"line":2446},[2154,3460,3111],{"class":2160},[2154,3462,3114],{"class":2230},[2154,3464,2537],{"class":2160},[2154,3466,3467],{"class":2168},"\"Error creating a reservation:\"",[2154,3469,3122],{"class":2160},[2154,3471,3472],{"class":2156,"line":2458},[2154,3473,3128],{"class":2160},[2154,3475,3476],{"class":2156,"line":2470},[2154,3477,2297],{"class":2160},[1840,3479,3144,3480,3482,3483,3485],{},[1914,3481,3235],{}," function, sends a request to Directus to create a new reservation with a ",[1914,3484,3378],{}," object.",[1847,3487,3489],{"id":3488},"set-up-a-nextjs-application","Set Up a Next.js Application",[1840,3491,3492],{},"Run the following command to initialize a Next.js project:",[2146,3494,3496],{"className":2148,"code":3495,"language":2150,"meta":24,"style":24},"npx create-next-app@14 hotel-resort\n",[1914,3497,3498],{"__ignoreMap":24},[2154,3499,3500,3503,3506],{"class":2156,"line":2157},[2154,3501,3502],{"class":2230},"npx",[2154,3504,3505],{"class":2168}," create-next-app@14",[2154,3507,3508],{"class":2168}," hotel-resort\n",[1840,3510,3511],{},"During installation, when prompted, choose the following configurations:",[2146,3513,3515],{"className":2148,"code":3514,"language":2150,"meta":24,"style":24},"✔ Would you like to use TypeScript?  Yes\n✔ Would you like to use ESLint?  Yes\n✔ Would you like to use Tailwind CSS? No\n✔ Would you like to use `src/` directory?  No\n✔ Would you like to use App Router? (recommended)  Yes\n✔ Would you like to customize the default import alias (@/*)? Yes\n✔ What import alias would you like configured? @/*\n",[1914,3516,3517,3543,3562,3585,3614,3637,3672],{"__ignoreMap":24},[2154,3518,3519,3522,3525,3528,3531,3534,3537,3540],{"class":2156,"line":2157},[2154,3520,3521],{"class":2230},"✔",[2154,3523,3524],{"class":2168}," Would",[2154,3526,3527],{"class":2168}," you",[2154,3529,3530],{"class":2168}," like",[2154,3532,3533],{"class":2168}," to",[2154,3535,3536],{"class":2168}," use",[2154,3538,3539],{"class":2168}," TypeScript?",[2154,3541,3542],{"class":2168},"  Yes\n",[2154,3544,3545,3547,3549,3551,3553,3555,3557,3560],{"class":2156,"line":2172},[2154,3546,3521],{"class":2230},[2154,3548,3524],{"class":2168},[2154,3550,3527],{"class":2168},[2154,3552,3530],{"class":2168},[2154,3554,3533],{"class":2168},[2154,3556,3536],{"class":2168},[2154,3558,3559],{"class":2168}," ESLint?",[2154,3561,3542],{"class":2168},[2154,3563,3564,3566,3568,3570,3572,3574,3576,3579,3582],{"class":2156,"line":2224},[2154,3565,3521],{"class":2230},[2154,3567,3524],{"class":2168},[2154,3569,3527],{"class":2168},[2154,3571,3530],{"class":2168},[2154,3573,3533],{"class":2168},[2154,3575,3536],{"class":2168},[2154,3577,3578],{"class":2168}," Tailwind",[2154,3580,3581],{"class":2168}," CSS?",[2154,3583,3584],{"class":2168}," No\n",[2154,3586,3587,3589,3591,3593,3595,3597,3599,3602,3605,3608,3611],{"class":2156,"line":2240},[2154,3588,3521],{"class":2230},[2154,3590,3524],{"class":2168},[2154,3592,3527],{"class":2168},[2154,3594,3530],{"class":2168},[2154,3596,3533],{"class":2168},[2154,3598,3536],{"class":2168},[2154,3600,3601],{"class":2168}," `",[2154,3603,3604],{"class":2230},"src/",[2154,3606,3607],{"class":2168},"`",[2154,3609,3610],{"class":2230}," directory?",[2154,3612,3613],{"class":2168},"  No\n",[2154,3615,3616,3618,3620,3622,3624,3626,3628,3631,3634],{"class":2156,"line":2256},[2154,3617,3521],{"class":2230},[2154,3619,3524],{"class":2168},[2154,3621,3527],{"class":2168},[2154,3623,3530],{"class":2168},[2154,3625,3533],{"class":2168},[2154,3627,3536],{"class":2168},[2154,3629,3630],{"class":2168}," App",[2154,3632,3633],{"class":2168}," Router?",[2154,3635,3636],{"class":2160}," (recommended)  Yes\n",[2154,3638,3639,3641,3643,3645,3647,3649,3652,3655,3657,3660,3663,3666,3669],{"class":2156,"line":2269},[2154,3640,3521],{"class":2230},[2154,3642,3524],{"class":2168},[2154,3644,3527],{"class":2168},[2154,3646,3530],{"class":2168},[2154,3648,3533],{"class":2168},[2154,3650,3651],{"class":2168}," customize",[2154,3653,3654],{"class":2168}," the",[2154,3656,2557],{"class":2168},[2154,3658,3659],{"class":2168}," import",[2154,3661,3662],{"class":2168}," alias",[2154,3664,3665],{"class":2160}," (@/*)",[2154,3667,3668],{"class":2164},"?",[2154,3670,3671],{"class":2160}," Yes\n",[2154,3673,3674,3676,3679,3681,3683,3686,3688,3690,3693,3696],{"class":2156,"line":2281},[2154,3675,3521],{"class":2230},[2154,3677,3678],{"class":2168}," What",[2154,3680,3659],{"class":2168},[2154,3682,3662],{"class":2168},[2154,3684,3685],{"class":2168}," would",[2154,3687,3527],{"class":2168},[2154,3689,3530],{"class":2168},[2154,3691,3692],{"class":2168}," configured?",[2154,3694,3695],{"class":2168}," @/",[2154,3697,3698],{"class":2250},"*\n",[1840,3700,3701],{},"Install the required dependencies:",[2146,3703,3705],{"className":2148,"code":3704,"language":2150,"meta":24,"style":24},"npm i @directus/sdk dayjs react-datepicker @stripe/stripe-js\n",[1914,3706,3707],{"__ignoreMap":24},[2154,3708,3709,3712,3715,3718,3721,3724],{"class":2156,"line":2157},[2154,3710,3711],{"class":2230},"npm",[2154,3713,3714],{"class":2168}," i",[2154,3716,3717],{"class":2168}," @directus/sdk",[2154,3719,3720],{"class":2168}," dayjs",[2154,3722,3723],{"class":2168}," react-datepicker",[2154,3725,3726],{"class":2168}," @stripe/stripe-js\n",[1847,3728,3730],{"id":3729},"set-up-the-homepage-with-date-picker","Set Up The Homepage With Date Picker",[1840,3732,2567,3733,3736,3737,3740],{},[1914,3734,3735],{},"app"," directory, create a ",[1914,3738,3739],{},"form.tsx"," file with the content:",[2146,3742,3744],{"className":2587,"code":3743,"language":2589,"meta":24,"style":24},"\"use client\";\nimport { useState, FormEvent } from \"react\";\nimport { useRouter } from \"next/navigation\";\nimport DatePicker from \"react-datepicker\";\nimport \"react-datepicker/dist/react-datepicker.css\";\n\ntype DateState = Date | null;\nexport default function BookingForm() {\n  const [startDate, setStartDate] = useState\u003CDateState>(new Date());\n  const [endDate, setEndDate] = useState\u003CDateState>();\n  const router = useRouter();\n  const [error, setError] = useState(\"\");\n\n  const handleChange = (range: DateState[]) => {\n    const [startDate, endDate] = range;\n    setStartDate(startDate);\n    setEndDate(endDate);\n  };\n\n  const handleFormSubmit = (e: FormEvent\u003CHTMLFormElement>) => {\n    const formData = new FormData(e.currentTarget);\n    e.preventDefault()\n    if (!endDate) {\n    setError(\"Please add a check out date\")\n    } else {\n      const checkAvailabilityData = {\n        checkInDate: startDate,\n        checkOutDate: endDate,\n        capacity: formData.get(\"capacity\")\n      }\n      router.push(`/bookings/rooms?checkInDate=${checkAvailabilityData.checkInDate}&checkOutDate=${checkAvailabilityData.checkOutDate}&capacity=${checkAvailabilityData.capacity}`)\n    }\n  }\n\n  \u003Cinput type=\"number\" name=\"capacity\" />;\n  return (\n    \u003Cform onSubmit={handleFormSubmit}>\n      \u003Cdiv>\n        \u003Ch2>Book an Hotel Room\u003C/h2>\n        \u003Cdiv>\n          \u003Cdiv>\n            \u003Clabel htmlFor=\"checkInDate\"> Check-in and Check-out Date:\u003C/label>\n            {error && \u003Cspan>{ error }\u003C/span>}\n            \u003CDatePicker\n              selected={startDate}\n              onChange={handleChange}\n              startDate={startDate}\n              endDate={endDate}\n              selectsRange\n              withPortal\n              required\n            />\n          \u003C/div>\n          \u003Cdiv>\n            \u003Clabel htmlFor=\"capacity\"> Guest(s):\u003C/label>\n            \u003Cinput\n              type=\"number\"\n              name=\"capacity\"\n              defaultValue={1}\n              min={1}\n              max={6}\n            />\n          \u003C/div>\n        \u003C/div>\n\n        \u003Cbutton type=\"submit\">Check Availability \u003C/button>\n      \u003C/div>\n    \u003C/form>\n  );\n}\n",[1914,3745,3746,3753,3767,3781,3795,3804,3808,3828,3843,3882,3909,3924,3951,3955,3980,3999,4007,4015,4020,4024,4055,4073,4084,4097,4110,4120,4132,4137,4142,4157,4162,4205,4210,4214,4218,4245,4252,4268,4279,4293,4301,4310,4333,4354,4361,4371,4381,4390,4400,4405,4410,4415,4420,4429,4437,4456,4463,4473,4483,4498,4511,4525,4529,4537,4546,4550,4571,4580,4589,4594],{"__ignoreMap":24},[2154,3747,3748,3751],{"class":2156,"line":2157},[2154,3749,3750],{"class":2168},"\"use client\"",[2154,3752,2215],{"class":2160},[2154,3754,3755,3757,3760,3762,3765],{"class":2156,"line":2172},[2154,3756,2203],{"class":2164},[2154,3758,3759],{"class":2160}," { useState, FormEvent } ",[2154,3761,2209],{"class":2164},[2154,3763,3764],{"class":2168}," \"react\"",[2154,3766,2215],{"class":2160},[2154,3768,3769,3771,3774,3776,3779],{"class":2156,"line":2224},[2154,3770,2203],{"class":2164},[2154,3772,3773],{"class":2160}," { useRouter } ",[2154,3775,2209],{"class":2164},[2154,3777,3778],{"class":2168}," \"next/navigation\"",[2154,3780,2215],{"class":2160},[2154,3782,3783,3785,3788,3790,3793],{"class":2156,"line":2240},[2154,3784,2203],{"class":2164},[2154,3786,3787],{"class":2160}," DatePicker ",[2154,3789,2209],{"class":2164},[2154,3791,3792],{"class":2168}," \"react-datepicker\"",[2154,3794,2215],{"class":2160},[2154,3796,3797,3799,3802],{"class":2156,"line":2256},[2154,3798,2203],{"class":2164},[2154,3800,3801],{"class":2168}," \"react-datepicker/dist/react-datepicker.css\"",[2154,3803,2215],{"class":2160},[2154,3805,3806],{"class":2156,"line":2269},[2154,3807,2221],{"emptyLinePlaceholder":2220},[2154,3809,3810,3812,3815,3817,3820,3823,3826],{"class":2156,"line":2281},[2154,3811,2227],{"class":2164},[2154,3813,3814],{"class":2230}," DateState",[2154,3816,2234],{"class":2164},[2154,3818,3819],{"class":2230}," Date",[2154,3821,3822],{"class":2164}," |",[2154,3824,3825],{"class":2250}," null",[2154,3827,2215],{"class":2160},[2154,3829,3830,3832,3834,3837,3840],{"class":2156,"line":2294},[2154,3831,2554],{"class":2164},[2154,3833,2557],{"class":2164},[2154,3835,3836],{"class":2164}," function",[2154,3838,3839],{"class":2230}," BookingForm",[2154,3841,3842],{"class":2160},"() {\n",[2154,3844,3845,3848,3851,3854,3856,3859,3862,3864,3867,3869,3872,3875,3878,3880],{"class":2156,"line":2300},[2154,3846,3847],{"class":2164},"  const",[2154,3849,3850],{"class":2160}," [",[2154,3852,3853],{"class":2250},"startDate",[2154,3855,1917],{"class":2160},[2154,3857,3858],{"class":2250},"setStartDate",[2154,3860,3861],{"class":2160},"] ",[2154,3863,2165],{"class":2164},[2154,3865,3866],{"class":2230}," useState",[2154,3868,2506],{"class":2160},[2154,3870,3871],{"class":2230},"DateState",[2154,3873,3874],{"class":2160},">(",[2154,3876,3877],{"class":2164},"new",[2154,3879,3819],{"class":2230},[2154,3881,2543],{"class":2160},[2154,3883,3884,3886,3888,3891,3893,3896,3898,3900,3902,3904,3906],{"class":2156,"line":2305},[2154,3885,3847],{"class":2164},[2154,3887,3850],{"class":2160},[2154,3889,3890],{"class":2250},"endDate",[2154,3892,1917],{"class":2160},[2154,3894,3895],{"class":2250},"setEndDate",[2154,3897,3861],{"class":2160},[2154,3899,2165],{"class":2164},[2154,3901,3866],{"class":2230},[2154,3903,2506],{"class":2160},[2154,3905,3871],{"class":2230},[2154,3907,3908],{"class":2160},">();\n",[2154,3910,3911,3913,3916,3918,3921],{"class":2156,"line":2317},[2154,3912,3847],{"class":2164},[2154,3914,3915],{"class":2250}," router",[2154,3917,2234],{"class":2164},[2154,3919,3920],{"class":2230}," useRouter",[2154,3922,3923],{"class":2160},"();\n",[2154,3925,3926,3928,3930,3932,3934,3937,3939,3941,3943,3945,3948],{"class":2156,"line":2329},[2154,3927,3847],{"class":2164},[2154,3929,3850],{"class":2160},[2154,3931,3114],{"class":2250},[2154,3933,1917],{"class":2160},[2154,3935,3936],{"class":2250},"setError",[2154,3938,3861],{"class":2160},[2154,3940,2165],{"class":2164},[2154,3942,3866],{"class":2230},[2154,3944,2537],{"class":2160},[2154,3946,3947],{"class":2168},"\"\"",[2154,3949,3950],{"class":2160},");\n",[2154,3952,3953],{"class":2156,"line":2341},[2154,3954,2221],{"emptyLinePlaceholder":2220},[2154,3956,3957,3959,3962,3964,3966,3969,3971,3973,3976,3978],{"class":2156,"line":2353},[2154,3958,3847],{"class":2164},[2154,3960,3961],{"class":2230}," handleChange",[2154,3963,2234],{"class":2164},[2154,3965,3375],{"class":2160},[2154,3967,3968],{"class":2243},"range",[2154,3970,2247],{"class":2164},[2154,3972,3814],{"class":2230},[2154,3974,3975],{"class":2160},"[]) ",[2154,3977,2679],{"class":2164},[2154,3979,2237],{"class":2160},[2154,3981,3982,3984,3986,3988,3990,3992,3994,3996],{"class":2156,"line":2365},[2154,3983,2693],{"class":2164},[2154,3985,3850],{"class":2160},[2154,3987,3853],{"class":2250},[2154,3989,1917],{"class":2160},[2154,3991,3890],{"class":2250},[2154,3993,3861],{"class":2160},[2154,3995,2165],{"class":2164},[2154,3997,3998],{"class":2160}," range;\n",[2154,4000,4001,4004],{"class":2156,"line":2377},[2154,4002,4003],{"class":2230},"    setStartDate",[2154,4005,4006],{"class":2160},"(startDate);\n",[2154,4008,4009,4012],{"class":2156,"line":2389},[2154,4010,4011],{"class":2230},"    setEndDate",[2154,4013,4014],{"class":2160},"(endDate);\n",[2154,4016,4017],{"class":2156,"line":2401},[2154,4018,4019],{"class":2160},"  };\n",[2154,4021,4022],{"class":2156,"line":2413},[2154,4023,2221],{"emptyLinePlaceholder":2220},[2154,4025,4026,4028,4031,4033,4035,4038,4040,4043,4045,4048,4051,4053],{"class":2156,"line":2425},[2154,4027,3847],{"class":2164},[2154,4029,4030],{"class":2230}," handleFormSubmit",[2154,4032,2234],{"class":2164},[2154,4034,3375],{"class":2160},[2154,4036,4037],{"class":2243},"e",[2154,4039,2247],{"class":2164},[2154,4041,4042],{"class":2230}," FormEvent",[2154,4044,2506],{"class":2160},[2154,4046,4047],{"class":2230},"HTMLFormElement",[2154,4049,4050],{"class":2160},">) ",[2154,4052,2679],{"class":2164},[2154,4054,2237],{"class":2160},[2154,4056,4057,4059,4062,4064,4067,4070],{"class":2156,"line":2436},[2154,4058,2693],{"class":2164},[2154,4060,4061],{"class":2250}," formData",[2154,4063,2234],{"class":2164},[2154,4065,4066],{"class":2164}," new",[2154,4068,4069],{"class":2230}," FormData",[2154,4071,4072],{"class":2160},"(e.currentTarget);\n",[2154,4074,4075,4078,4081],{"class":2156,"line":2441},[2154,4076,4077],{"class":2160},"    e.",[2154,4079,4080],{"class":2230},"preventDefault",[2154,4082,4083],{"class":2160},"()\n",[2154,4085,4086,4089,4091,4094],{"class":2156,"line":2446},[2154,4087,4088],{"class":2164},"    if",[2154,4090,3375],{"class":2160},[2154,4092,4093],{"class":2164},"!",[2154,4095,4096],{"class":2160},"endDate) {\n",[2154,4098,4099,4102,4104,4107],{"class":2156,"line":2458},[2154,4100,4101],{"class":2230},"    setError",[2154,4103,2537],{"class":2160},[2154,4105,4106],{"class":2168},"\"Please add a check out date\"",[2154,4108,4109],{"class":2160},")\n",[2154,4111,4112,4115,4118],{"class":2156,"line":2470},[2154,4113,4114],{"class":2160},"    } ",[2154,4116,4117],{"class":2164},"else",[2154,4119,2237],{"class":2160},[2154,4121,4122,4125,4128,4130],{"class":2156,"line":2482},[2154,4123,4124],{"class":2164},"      const",[2154,4126,4127],{"class":2250}," checkAvailabilityData",[2154,4129,2234],{"class":2164},[2154,4131,2237],{"class":2160},[2154,4133,4134],{"class":2156,"line":2487},[2154,4135,4136],{"class":2160},"        checkInDate: startDate,\n",[2154,4138,4139],{"class":2156,"line":2492},[2154,4140,4141],{"class":2160},"        checkOutDate: endDate,\n",[2154,4143,4144,4147,4150,4152,4155],{"class":2156,"line":2515},[2154,4145,4146],{"class":2160},"        capacity: formData.",[2154,4148,4149],{"class":2230},"get",[2154,4151,2537],{"class":2160},[2154,4153,4154],{"class":2168},"\"capacity\"",[2154,4156,4109],{"class":2160},[2154,4158,4159],{"class":2156,"line":2528},[2154,4160,4161],{"class":2160},"      }\n",[2154,4163,4164,4167,4170,4172,4175,4178,4180,4182,4185,4187,4189,4191,4194,4196,4198,4200,4203],{"class":2156,"line":2546},[2154,4165,4166],{"class":2160},"      router.",[2154,4168,4169],{"class":2230},"push",[2154,4171,2537],{"class":2160},[2154,4173,4174],{"class":2168},"`/bookings/rooms?checkInDate=${",[2154,4176,4177],{"class":2160},"checkAvailabilityData",[2154,4179,1880],{"class":2168},[2154,4181,3210],{"class":2160},[2154,4183,4184],{"class":2168},"}&checkOutDate=${",[2154,4186,4177],{"class":2160},[2154,4188,1880],{"class":2168},[2154,4190,3199],{"class":2160},[2154,4192,4193],{"class":2168},"}&capacity=${",[2154,4195,4177],{"class":2160},[2154,4197,1880],{"class":2168},[2154,4199,1982],{"class":2160},[2154,4201,4202],{"class":2168},"}`",[2154,4204,4109],{"class":2160},[2154,4206,4207],{"class":2156,"line":2551},[2154,4208,4209],{"class":2160},"    }\n",[2154,4211,4212],{"class":2156,"line":2859},[2154,4213,3128],{"class":2160},[2154,4215,4216],{"class":2156,"line":2865},[2154,4217,2221],{"emptyLinePlaceholder":2220},[2154,4219,4220,4223,4227,4230,4232,4235,4238,4240,4242],{"class":2156,"line":2871},[2154,4221,4222],{"class":2160},"  \u003C",[2154,4224,4226],{"class":4225},"sovSZ","input",[2154,4228,4229],{"class":2230}," type",[2154,4231,2165],{"class":2164},[2154,4233,4234],{"class":2168},"\"number\"",[2154,4236,4237],{"class":2230}," name",[2154,4239,2165],{"class":2164},[2154,4241,4154],{"class":2168},[2154,4243,4244],{"class":2160}," />;\n",[2154,4246,4247,4250],{"class":2156,"line":2876},[2154,4248,4249],{"class":2164},"  return",[2154,4251,2640],{"class":2160},[2154,4253,4254,4257,4260,4263,4265],{"class":2156,"line":2881},[2154,4255,4256],{"class":2160},"    \u003C",[2154,4258,4259],{"class":4225},"form",[2154,4261,4262],{"class":2230}," onSubmit",[2154,4264,2165],{"class":2164},[2154,4266,4267],{"class":2160},"{handleFormSubmit}>\n",[2154,4269,4270,4273,4276],{"class":2156,"line":2886},[2154,4271,4272],{"class":2160},"      \u003C",[2154,4274,4275],{"class":4225},"div",[2154,4277,4278],{"class":2160},">\n",[2154,4280,4281,4284,4286,4289,4291],{"class":2156,"line":2895},[2154,4282,4283],{"class":2160},"        \u003C",[2154,4285,1847],{"class":4225},[2154,4287,4288],{"class":2160},">Book an Hotel Room\u003C/",[2154,4290,1847],{"class":4225},[2154,4292,4278],{"class":2160},[2154,4294,4295,4297,4299],{"class":2156,"line":2900},[2154,4296,4283],{"class":2160},[2154,4298,4275],{"class":4225},[2154,4300,4278],{"class":2160},[2154,4302,4303,4306,4308],{"class":2156,"line":2910},[2154,4304,4305],{"class":2160},"          \u003C",[2154,4307,4275],{"class":4225},[2154,4309,4278],{"class":2160},[2154,4311,4312,4315,4318,4321,4323,4326,4329,4331],{"class":2156,"line":2915},[2154,4313,4314],{"class":2160},"            \u003C",[2154,4316,4317],{"class":4225},"label",[2154,4319,4320],{"class":2230}," htmlFor",[2154,4322,2165],{"class":2164},[2154,4324,4325],{"class":2168},"\"checkInDate\"",[2154,4327,4328],{"class":2160},"> Check-in and Check-out Date:\u003C/",[2154,4330,4317],{"class":4225},[2154,4332,4278],{"class":2160},[2154,4334,4335,4338,4341,4344,4346,4349,4351],{"class":2156,"line":2920},[2154,4336,4337],{"class":2160},"            {error ",[2154,4339,4340],{"class":2164},"&&",[2154,4342,4343],{"class":2160}," \u003C",[2154,4345,2154],{"class":4225},[2154,4347,4348],{"class":2160},">{ error }\u003C/",[2154,4350,2154],{"class":4225},[2154,4352,4353],{"class":2160},">}\n",[2154,4355,4356,4358],{"class":2156,"line":2925},[2154,4357,4314],{"class":2160},[2154,4359,4360],{"class":2250},"DatePicker\n",[2154,4362,4363,4366,4368],{"class":2156,"line":2930},[2154,4364,4365],{"class":2230},"              selected",[2154,4367,2165],{"class":2164},[2154,4369,4370],{"class":2160},"{startDate}\n",[2154,4372,4373,4376,4378],{"class":2156,"line":2936},[2154,4374,4375],{"class":2230},"              onChange",[2154,4377,2165],{"class":2164},[2154,4379,4380],{"class":2160},"{handleChange}\n",[2154,4382,4383,4386,4388],{"class":2156,"line":2941},[2154,4384,4385],{"class":2230},"              startDate",[2154,4387,2165],{"class":2164},[2154,4389,4370],{"class":2160},[2154,4391,4392,4395,4397],{"class":2156,"line":2946},[2154,4393,4394],{"class":2230},"              endDate",[2154,4396,2165],{"class":2164},[2154,4398,4399],{"class":2160},"{endDate}\n",[2154,4401,4402],{"class":2156,"line":2951},[2154,4403,4404],{"class":2230},"              selectsRange\n",[2154,4406,4407],{"class":2156,"line":2960},[2154,4408,4409],{"class":2230},"              withPortal\n",[2154,4411,4412],{"class":2156,"line":2965},[2154,4413,4414],{"class":2230},"              required\n",[2154,4416,4417],{"class":2156,"line":2971},[2154,4418,4419],{"class":2160},"            />\n",[2154,4421,4422,4425,4427],{"class":2156,"line":2976},[2154,4423,4424],{"class":2160},"          \u003C/",[2154,4426,4275],{"class":4225},[2154,4428,4278],{"class":2160},[2154,4430,4431,4433,4435],{"class":2156,"line":2981},[2154,4432,4305],{"class":2160},[2154,4434,4275],{"class":4225},[2154,4436,4278],{"class":2160},[2154,4438,4439,4441,4443,4445,4447,4449,4452,4454],{"class":2156,"line":2986},[2154,4440,4314],{"class":2160},[2154,4442,4317],{"class":4225},[2154,4444,4320],{"class":2230},[2154,4446,2165],{"class":2164},[2154,4448,4154],{"class":2168},[2154,4450,4451],{"class":2160},"> Guest(s):\u003C/",[2154,4453,4317],{"class":4225},[2154,4455,4278],{"class":2160},[2154,4457,4458,4460],{"class":2156,"line":2991},[2154,4459,4314],{"class":2160},[2154,4461,4462],{"class":4225},"input\n",[2154,4464,4465,4468,4470],{"class":2156,"line":2997},[2154,4466,4467],{"class":2230},"              type",[2154,4469,2165],{"class":2164},[2154,4471,4472],{"class":2168},"\"number\"\n",[2154,4474,4475,4478,4480],{"class":2156,"line":3002},[2154,4476,4477],{"class":2230},"              name",[2154,4479,2165],{"class":2164},[2154,4481,4482],{"class":2168},"\"capacity\"\n",[2154,4484,4485,4488,4490,4493,4495],{"class":2156,"line":3007},[2154,4486,4487],{"class":2230},"              defaultValue",[2154,4489,2165],{"class":2164},[2154,4491,4492],{"class":2160},"{",[2154,4494,2784],{"class":2250},[2154,4496,4497],{"class":2160},"}\n",[2154,4499,4500,4503,4505,4507,4509],{"class":2156,"line":3012},[2154,4501,4502],{"class":2230},"              min",[2154,4504,2165],{"class":2164},[2154,4506,4492],{"class":2160},[2154,4508,2784],{"class":2250},[2154,4510,4497],{"class":2160},[2154,4512,4513,4516,4518,4520,4523],{"class":2156,"line":3021},[2154,4514,4515],{"class":2230},"              max",[2154,4517,2165],{"class":2164},[2154,4519,4492],{"class":2160},[2154,4521,4522],{"class":2250},"6",[2154,4524,4497],{"class":2160},[2154,4526,4527],{"class":2156,"line":3026},[2154,4528,4419],{"class":2160},[2154,4530,4531,4533,4535],{"class":2156,"line":3032},[2154,4532,4424],{"class":2160},[2154,4534,4275],{"class":4225},[2154,4536,4278],{"class":2160},[2154,4538,4539,4542,4544],{"class":2156,"line":3037},[2154,4540,4541],{"class":2160},"        \u003C/",[2154,4543,4275],{"class":4225},[2154,4545,4278],{"class":2160},[2154,4547,4548],{"class":2156,"line":3042},[2154,4549,2221],{"emptyLinePlaceholder":2220},[2154,4551,4552,4554,4557,4559,4561,4564,4567,4569],{"class":2156,"line":3047},[2154,4553,4283],{"class":2160},[2154,4555,4556],{"class":4225},"button",[2154,4558,4229],{"class":2230},[2154,4560,2165],{"class":2164},[2154,4562,4563],{"class":2168},"\"submit\"",[2154,4565,4566],{"class":2160},">Check Availability \u003C/",[2154,4568,4556],{"class":4225},[2154,4570,4278],{"class":2160},[2154,4572,4573,4576,4578],{"class":2156,"line":3052},[2154,4574,4575],{"class":2160},"      \u003C/",[2154,4577,4275],{"class":4225},[2154,4579,4278],{"class":2160},[2154,4581,4582,4585,4587],{"class":2156,"line":3058},[2154,4583,4584],{"class":2160},"    \u003C/",[2154,4586,4259],{"class":4225},[2154,4588,4278],{"class":2160},[2154,4590,4591],{"class":2156,"line":3064},[2154,4592,4593],{"class":2160},"  );\n",[2154,4595,4596],{"class":2156,"line":3070},[2154,4597,4497],{"class":2160},[1855,4599,4600,4606,4609],{},[1858,4601,3144,4602,4605],{},[1914,4603,4604],{},"DatePicker"," component to render a date picker form for users to submit the selected range of their check-in and check-out periods.",[1858,4607,4608],{},"The form also contains an input of the number of guests the user will be bringing.",[1858,4610,4611,4612,4615,4616,4619],{},"When submitted, push the data as query parameters using the Next.js ",[1914,4613,4614],{},"router.push"," method to the ",[1914,4617,4618],{},"/bookings/rooms"," URL.",[1840,4621,4622,4623,4626],{},"To display this form, in the ",[1914,4624,4625],{},"app/page.tsx"," file, replace the content with:",[2146,4628,4630],{"className":2587,"code":4629,"language":2589,"meta":24,"style":24},"import BookingForm from \"./form\";\n\nexport default function Home() {\n\n  return (\n    \u003Cmain>\n      \u003Cdiv>\n        \u003Ch1>Welcome to Next.js Hotel Resort\u003C/h1>\n        \u003Cp>Find the best hotel rooms and enjoy your stay\u003C/p>\n        \u003Cp>Home away from home\u003C/p>\n        \u003CBookingForm />\n      \u003C/div>\n    \u003C/main>\n  );\n}\n",[1914,4631,4632,4646,4650,4663,4667,4673,4682,4690,4704,4717,4730,4740,4748,4756,4760],{"__ignoreMap":24},[2154,4633,4634,4636,4639,4641,4644],{"class":2156,"line":2157},[2154,4635,2203],{"class":2164},[2154,4637,4638],{"class":2160}," BookingForm ",[2154,4640,2209],{"class":2164},[2154,4642,4643],{"class":2168}," \"./form\"",[2154,4645,2215],{"class":2160},[2154,4647,4648],{"class":2156,"line":2172},[2154,4649,2221],{"emptyLinePlaceholder":2220},[2154,4651,4652,4654,4656,4658,4661],{"class":2156,"line":2224},[2154,4653,2554],{"class":2164},[2154,4655,2557],{"class":2164},[2154,4657,3836],{"class":2164},[2154,4659,4660],{"class":2230}," Home",[2154,4662,3842],{"class":2160},[2154,4664,4665],{"class":2156,"line":2240},[2154,4666,2221],{"emptyLinePlaceholder":2220},[2154,4668,4669,4671],{"class":2156,"line":2256},[2154,4670,4249],{"class":2164},[2154,4672,2640],{"class":2160},[2154,4674,4675,4677,4680],{"class":2156,"line":2269},[2154,4676,4256],{"class":2160},[2154,4678,4679],{"class":4225},"main",[2154,4681,4278],{"class":2160},[2154,4683,4684,4686,4688],{"class":2156,"line":2281},[2154,4685,4272],{"class":2160},[2154,4687,4275],{"class":4225},[2154,4689,4278],{"class":2160},[2154,4691,4692,4694,4697,4700,4702],{"class":2156,"line":2294},[2154,4693,4283],{"class":2160},[2154,4695,4696],{"class":4225},"h1",[2154,4698,4699],{"class":2160},">Welcome to Next.js Hotel Resort\u003C/",[2154,4701,4696],{"class":4225},[2154,4703,4278],{"class":2160},[2154,4705,4706,4708,4710,4713,4715],{"class":2156,"line":2300},[2154,4707,4283],{"class":2160},[2154,4709,1840],{"class":4225},[2154,4711,4712],{"class":2160},">Find the best hotel rooms and enjoy your stay\u003C/",[2154,4714,1840],{"class":4225},[2154,4716,4278],{"class":2160},[2154,4718,4719,4721,4723,4726,4728],{"class":2156,"line":2305},[2154,4720,4283],{"class":2160},[2154,4722,1840],{"class":4225},[2154,4724,4725],{"class":2160},">Home away from home\u003C/",[2154,4727,1840],{"class":4225},[2154,4729,4278],{"class":2160},[2154,4731,4732,4734,4737],{"class":2156,"line":2317},[2154,4733,4283],{"class":2160},[2154,4735,4736],{"class":2250},"BookingForm",[2154,4738,4739],{"class":2160}," />\n",[2154,4741,4742,4744,4746],{"class":2156,"line":2329},[2154,4743,4575],{"class":2160},[2154,4745,4275],{"class":4225},[2154,4747,4278],{"class":2160},[2154,4749,4750,4752,4754],{"class":2156,"line":2341},[2154,4751,4584],{"class":2160},[2154,4753,4679],{"class":4225},[2154,4755,4278],{"class":2160},[2154,4757,4758],{"class":2156,"line":2353},[2154,4759,4593],{"class":2160},[2154,4761,4762],{"class":2156,"line":2365},[2154,4763,4497],{"class":2160},[1840,4765,4766],{},[1927,4767],{"alt":4768,"src":4769},"Screenshot of the application homepage with a data picker","/img/aace075b-cdac-411d-95dc-0377aa413c90.webp",[1847,4771,4773],{"id":4772},"show-available-rooms","Show Available Rooms",[1840,4775,4776,4777,4779,4780,4783,4784,4786],{},"Inside the ",[1914,4778,3735],{}," directory, create a new directory called ",[1914,4781,4782],{},"bookings","; inside it, create another directory called ",[1914,4785,1920],{},".  This route will be responsible for displaying the list of room types based on the availability of the rooms.",[1840,4788,4789,4790,3736,4792,4795],{},"Inside of the ",[1914,4791,1920],{},[1914,4793,4794],{},"page.tsx"," file:",[2146,4797,4799],{"className":2587,"code":4798,"language":2589,"meta":24,"style":24},"import { getRoomTypes } from \"@/lib/apis\";\nimport dayjs from \"dayjs\";\nimport Link from \"next/link\";\n\nexport default async function Rooms({\n  searchParams,\n}: {\n  searchParams: { [key: string]: string };\n}) {\n  const { capacity, checkInDate, checkOutDate } = searchParams;\n  const formattedCheckInDate = dayjs(checkInDate).format(\"YYYY-MM-DD\");\n  const formattedCheckOutDate = dayjs(checkOutDate).format(\"YYYY-MM-DD\");\n  const roomTypes = await getRoomTypes(\n    formattedCheckInDate,\n    formattedCheckOutDate,\n    capacity\n  );\n\n  return (\n    \u003Cmain>\n      \u003Cdiv>\n        \u003Ch1>Select a Room of your choice\u003C/h1>\n        \u003Cdiv>\n          {roomTypes &&\n            roomTypes.map((roomType) => {\n              return (\n                \u003Cdiv key={roomType.id}>\n                  \u003Ch2>{roomType.name}\u003C/h2>\n                  \u003Cp>capacity: {roomType.capacity}\u003C/p>\n                  \u003Cp>Price per night: {roomType.price}\u003C/p>\n                  {roomType.rooms.length > 0 ? (\n                    \u003CLink\n                      href={`/bookings/checkout?checkInDate=${formattedCheckInDate}&checkOutDate=${formattedCheckOutDate}&room=${roomType.rooms[0]}&price=${roomType.price}&roomType=${roomType.name}`}\n                    >\n                      Book room\n                    \u003C/Link>\n                  ) : (\n                    \"Room unavailable\"\n                  )}\n                \u003C/div>\n              );\n            })}\n        \u003C/div>\n      \u003C/div>\n    \u003C/main>\n  );\n}\n",[1914,4800,4801,4815,4829,4843,4847,4863,4870,4879,4905,4910,4935,4959,4981,4996,5001,5006,5011,5015,5019,5025,5033,5041,5054,5062,5070,5090,5097,5112,5126,5139,5152,5171,5179,5238,5243,5248,5258,5267,5272,5277,5286,5291,5296,5304,5312,5320,5324],{"__ignoreMap":24},[2154,4802,4803,4805,4808,4810,4813],{"class":2156,"line":2157},[2154,4804,2203],{"class":2164},[2154,4806,4807],{"class":2160}," { getRoomTypes } ",[2154,4809,2209],{"class":2164},[2154,4811,4812],{"class":2168}," \"@/lib/apis\"",[2154,4814,2215],{"class":2160},[2154,4816,4817,4819,4822,4824,4827],{"class":2156,"line":2172},[2154,4818,2203],{"class":2164},[2154,4820,4821],{"class":2160}," dayjs ",[2154,4823,2209],{"class":2164},[2154,4825,4826],{"class":2168}," \"dayjs\"",[2154,4828,2215],{"class":2160},[2154,4830,4831,4833,4836,4838,4841],{"class":2156,"line":2224},[2154,4832,2203],{"class":2164},[2154,4834,4835],{"class":2160}," Link ",[2154,4837,2209],{"class":2164},[2154,4839,4840],{"class":2168}," \"next/link\"",[2154,4842,2215],{"class":2160},[2154,4844,4845],{"class":2156,"line":2240},[2154,4846,2221],{"emptyLinePlaceholder":2220},[2154,4848,4849,4851,4853,4855,4857,4860],{"class":2156,"line":2256},[2154,4850,2554],{"class":2164},[2154,4852,2557],{"class":2164},[2154,4854,2637],{"class":2164},[2154,4856,3836],{"class":2164},[2154,4858,4859],{"class":2230}," Rooms",[2154,4861,4862],{"class":2160},"({\n",[2154,4864,4865,4868],{"class":2156,"line":2269},[2154,4866,4867],{"class":2243},"  searchParams",[2154,4869,2652],{"class":2160},[2154,4871,4872,4875,4877],{"class":2156,"line":2281},[2154,4873,4874],{"class":2160},"}",[2154,4876,2247],{"class":2164},[2154,4878,2237],{"class":2160},[2154,4880,4881,4883,4885,4888,4891,4893,4895,4898,4900,4902],{"class":2156,"line":2294},[2154,4882,4867],{"class":2243},[2154,4884,2247],{"class":2164},[2154,4886,4887],{"class":2160}," { [",[2154,4889,4890],{"class":2243},"key",[2154,4892,2247],{"class":2164},[2154,4894,2264],{"class":2250},[2154,4896,4897],{"class":2160},"]",[2154,4899,2247],{"class":2164},[2154,4901,2264],{"class":2250},[2154,4903,4904],{"class":2160}," };\n",[2154,4906,4907],{"class":2156,"line":2300},[2154,4908,4909],{"class":2160},"}) {\n",[2154,4911,4912,4914,4917,4919,4921,4923,4925,4927,4930,4932],{"class":2156,"line":2305},[2154,4913,3847],{"class":2164},[2154,4915,4916],{"class":2160}," { ",[2154,4918,1982],{"class":2250},[2154,4920,1917],{"class":2160},[2154,4922,3210],{"class":2250},[2154,4924,1917],{"class":2160},[2154,4926,3199],{"class":2250},[2154,4928,4929],{"class":2160}," } ",[2154,4931,2165],{"class":2164},[2154,4933,4934],{"class":2160}," searchParams;\n",[2154,4936,4937,4939,4942,4944,4946,4949,4952,4954,4957],{"class":2156,"line":2317},[2154,4938,3847],{"class":2164},[2154,4940,4941],{"class":2250}," formattedCheckInDate",[2154,4943,2234],{"class":2164},[2154,4945,3720],{"class":2230},[2154,4947,4948],{"class":2160},"(checkInDate).",[2154,4950,4951],{"class":2230},"format",[2154,4953,2537],{"class":2160},[2154,4955,4956],{"class":2168},"\"YYYY-MM-DD\"",[2154,4958,3950],{"class":2160},[2154,4960,4961,4963,4966,4968,4970,4973,4975,4977,4979],{"class":2156,"line":2329},[2154,4962,3847],{"class":2164},[2154,4964,4965],{"class":2250}," formattedCheckOutDate",[2154,4967,2234],{"class":2164},[2154,4969,3720],{"class":2230},[2154,4971,4972],{"class":2160},"(checkOutDate).",[2154,4974,4951],{"class":2230},[2154,4976,2537],{"class":2160},[2154,4978,4956],{"class":2168},[2154,4980,3950],{"class":2160},[2154,4982,4983,4985,4988,4990,4992,4994],{"class":2156,"line":2341},[2154,4984,3847],{"class":2164},[2154,4986,4987],{"class":2250}," roomTypes",[2154,4989,2234],{"class":2164},[2154,4991,2701],{"class":2164},[2154,4993,2632],{"class":2230},[2154,4995,2710],{"class":2160},[2154,4997,4998],{"class":2156,"line":2353},[2154,4999,5000],{"class":2160},"    formattedCheckInDate,\n",[2154,5002,5003],{"class":2156,"line":2365},[2154,5004,5005],{"class":2160},"    formattedCheckOutDate,\n",[2154,5007,5008],{"class":2156,"line":2377},[2154,5009,5010],{"class":2160},"    capacity\n",[2154,5012,5013],{"class":2156,"line":2389},[2154,5014,4593],{"class":2160},[2154,5016,5017],{"class":2156,"line":2401},[2154,5018,2221],{"emptyLinePlaceholder":2220},[2154,5020,5021,5023],{"class":2156,"line":2413},[2154,5022,4249],{"class":2164},[2154,5024,2640],{"class":2160},[2154,5026,5027,5029,5031],{"class":2156,"line":2425},[2154,5028,4256],{"class":2160},[2154,5030,4679],{"class":4225},[2154,5032,4278],{"class":2160},[2154,5034,5035,5037,5039],{"class":2156,"line":2436},[2154,5036,4272],{"class":2160},[2154,5038,4275],{"class":4225},[2154,5040,4278],{"class":2160},[2154,5042,5043,5045,5047,5050,5052],{"class":2156,"line":2441},[2154,5044,4283],{"class":2160},[2154,5046,4696],{"class":4225},[2154,5048,5049],{"class":2160},">Select a Room of your choice\u003C/",[2154,5051,4696],{"class":4225},[2154,5053,4278],{"class":2160},[2154,5055,5056,5058,5060],{"class":2156,"line":2446},[2154,5057,4283],{"class":2160},[2154,5059,4275],{"class":4225},[2154,5061,4278],{"class":2160},[2154,5063,5064,5067],{"class":2156,"line":2458},[2154,5065,5066],{"class":2160},"          {roomTypes ",[2154,5068,5069],{"class":2164},"&&\n",[2154,5071,5072,5075,5078,5081,5084,5086,5088],{"class":2156,"line":2470},[2154,5073,5074],{"class":2160},"            roomTypes.",[2154,5076,5077],{"class":2230},"map",[2154,5079,5080],{"class":2160},"((",[2154,5082,5083],{"class":2243},"roomType",[2154,5085,2676],{"class":2160},[2154,5087,2679],{"class":2164},[2154,5089,2237],{"class":2160},[2154,5091,5092,5095],{"class":2156,"line":2482},[2154,5093,5094],{"class":2164},"              return",[2154,5096,2640],{"class":2160},[2154,5098,5099,5102,5104,5107,5109],{"class":2156,"line":2487},[2154,5100,5101],{"class":2160},"                \u003C",[2154,5103,4275],{"class":4225},[2154,5105,5106],{"class":2230}," key",[2154,5108,2165],{"class":2164},[2154,5110,5111],{"class":2160},"{roomType.id}>\n",[2154,5113,5114,5117,5119,5122,5124],{"class":2156,"line":2492},[2154,5115,5116],{"class":2160},"                  \u003C",[2154,5118,1847],{"class":4225},[2154,5120,5121],{"class":2160},">{roomType.name}\u003C/",[2154,5123,1847],{"class":4225},[2154,5125,4278],{"class":2160},[2154,5127,5128,5130,5132,5135,5137],{"class":2156,"line":2515},[2154,5129,5116],{"class":2160},[2154,5131,1840],{"class":4225},[2154,5133,5134],{"class":2160},">capacity: {roomType.capacity}\u003C/",[2154,5136,1840],{"class":4225},[2154,5138,4278],{"class":2160},[2154,5140,5141,5143,5145,5148,5150],{"class":2156,"line":2528},[2154,5142,5116],{"class":2160},[2154,5144,1840],{"class":4225},[2154,5146,5147],{"class":2160},">Price per night: {roomType.price}\u003C/",[2154,5149,1840],{"class":4225},[2154,5151,4278],{"class":2160},[2154,5153,5154,5157,5160,5163,5166,5169],{"class":2156,"line":2546},[2154,5155,5156],{"class":2160},"                  {roomType.rooms.",[2154,5158,5159],{"class":2250},"length",[2154,5161,5162],{"class":2164}," >",[2154,5164,5165],{"class":2250}," 0",[2154,5167,5168],{"class":2164}," ?",[2154,5170,2640],{"class":2160},[2154,5172,5173,5176],{"class":2156,"line":2551},[2154,5174,5175],{"class":2160},"                    \u003C",[2154,5177,5178],{"class":2250},"Link\n",[2154,5180,5181,5184,5186,5188,5191,5194,5196,5199,5202,5204,5206,5208,5211,5214,5216,5219,5221,5223,5225,5228,5230,5232,5234,5236],{"class":2156,"line":2859},[2154,5182,5183],{"class":2230},"                      href",[2154,5185,2165],{"class":2164},[2154,5187,4492],{"class":2160},[2154,5189,5190],{"class":2168},"`/bookings/checkout?checkInDate=${",[2154,5192,5193],{"class":2160},"formattedCheckInDate",[2154,5195,4184],{"class":2168},[2154,5197,5198],{"class":2160},"formattedCheckOutDate",[2154,5200,5201],{"class":2168},"}&room=${",[2154,5203,5083],{"class":2160},[2154,5205,1880],{"class":2168},[2154,5207,1920],{"class":2160},[2154,5209,5210],{"class":2168},"[",[2154,5212,5213],{"class":2250},"0",[2154,5215,4897],{"class":2168},[2154,5217,5218],{"class":2168},"}&price=${",[2154,5220,5083],{"class":2160},[2154,5222,1880],{"class":2168},[2154,5224,1988],{"class":2160},[2154,5226,5227],{"class":2168},"}&roomType=${",[2154,5229,5083],{"class":2160},[2154,5231,1880],{"class":2168},[2154,5233,1976],{"class":2160},[2154,5235,4202],{"class":2168},[2154,5237,4497],{"class":2160},[2154,5239,5240],{"class":2156,"line":2865},[2154,5241,5242],{"class":2160},"                    >\n",[2154,5244,5245],{"class":2156,"line":2871},[2154,5246,5247],{"class":2160},"                      Book room\n",[2154,5249,5250,5253,5256],{"class":2156,"line":2876},[2154,5251,5252],{"class":2160},"                    \u003C/",[2154,5254,5255],{"class":2250},"Link",[2154,5257,4278],{"class":2160},[2154,5259,5260,5263,5265],{"class":2156,"line":2881},[2154,5261,5262],{"class":2160},"                  ) ",[2154,5264,2247],{"class":2164},[2154,5266,2640],{"class":2160},[2154,5268,5269],{"class":2156,"line":2886},[2154,5270,5271],{"class":2168},"                    \"Room unavailable\"\n",[2154,5273,5274],{"class":2156,"line":2895},[2154,5275,5276],{"class":2160},"                  )}\n",[2154,5278,5279,5282,5284],{"class":2156,"line":2900},[2154,5280,5281],{"class":2160},"                \u003C/",[2154,5283,4275],{"class":4225},[2154,5285,4278],{"class":2160},[2154,5287,5288],{"class":2156,"line":2910},[2154,5289,5290],{"class":2160},"              );\n",[2154,5292,5293],{"class":2156,"line":2915},[2154,5294,5295],{"class":2160},"            })}\n",[2154,5297,5298,5300,5302],{"class":2156,"line":2920},[2154,5299,4541],{"class":2160},[2154,5301,4275],{"class":4225},[2154,5303,4278],{"class":2160},[2154,5305,5306,5308,5310],{"class":2156,"line":2925},[2154,5307,4575],{"class":2160},[2154,5309,4275],{"class":4225},[2154,5311,4278],{"class":2160},[2154,5313,5314,5316,5318],{"class":2156,"line":2930},[2154,5315,4584],{"class":2160},[2154,5317,4679],{"class":4225},[2154,5319,4278],{"class":2160},[2154,5321,5322],{"class":2156,"line":2936},[2154,5323,4593],{"class":2160},[2154,5325,5326],{"class":2156,"line":2941},[2154,5327,4497],{"class":2160},[1855,5329,5330,5340,5346],{},[1858,5331,5332,5333,5336,5337,5339],{},"Get the inputs from the previous page via ",[1914,5334,5335],{},"searchParams"," and runs the ",[1914,5338,2580],{}," function.",[1858,5341,5342,5343,5345],{},"Displays the available room types fetched from the ",[1914,5344,2580],{}," function and displays in HTML",[1858,5347,5348,5349,5352,5353,5356],{},"Checks the ",[1914,5350,5351],{},"roomTypes.rooms"," array to determine if a room is available and displays a link to book that room. If there's an available room, it renders a link to the booking form that room. Otherwise, it renders an ",[1914,5354,5355],{},"Room unavailable"," text.",[1840,5358,5359],{},[1927,5360],{"alt":5361,"src":5362},"Screenshot of available rooms by room types page in Next.js when booking a room","/img/06d43baa-5a0e-41eb-a27f-410b6295a167.webp",[1847,5364,5366],{"id":5365},"set-up-stripe-for-receiving-payments","Set up Stripe for Receiving Payments",[1840,5368,5369,5370,5372],{},"Update your ",[1914,5371,2143],{}," file with the publishable and secret keys you can find in your Stripe account:",[2146,5374,5376],{"className":2148,"code":5375,"language":2150,"meta":24,"style":24},"NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=YOUR_STRIPE_PUBLISHABLE_KEY\nSTRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY\n",[1914,5377,5378,5388],{"__ignoreMap":24},[2154,5379,5380,5383,5385],{"class":2156,"line":2157},[2154,5381,5382],{"class":2160},"NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY",[2154,5384,2165],{"class":2164},[2154,5386,5387],{"class":2168},"YOUR_STRIPE_PUBLISHABLE_KEY\n",[2154,5389,5390,5393,5395],{"class":2156,"line":2172},[2154,5391,5392],{"class":2160},"STRIPE_SECRET_KEY",[2154,5394,2165],{"class":2164},[2154,5396,5397],{"class":2168},"YOUR_STRIPE_SECRET_KEY\n",[1840,5399,5400,5401,4779,5403,5406,5407,5410,5411,5414,5415,5418],{},"In your ",[1914,5402,3735],{},[1914,5404,5405],{},"api"," and, inside of it, create a directory ",[1914,5408,5409],{},"stripe-session"," with a ",[1914,5412,5413],{},"route.ts"," file (",[1914,5416,5417],{},"app/api/stripe-session/route.ts","):",[2146,5420,5422],{"className":2194,"code":5421,"language":2196,"meta":24,"style":24},"import { NextResponse } from \"next/server\";\nimport Stripe from \"stripe\";\n\nconst stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string);\n\ntype RequestData = {\n  first_name: string,\n  last_name: string,\n  email: string,\n  phone_number: string,\n  check_in_date: string,\n  check_out_date: string,\n  room_id: string,\n  nights: number,\n  total_price: string,\n  roomType: string,\n  price: number;\n};\n\nexport async function POST(req: Request) {\n  const {\n    price,\n    roomType,\n    room_id,\n    nights,\n    check_in_date,\n    check_out_date,\n    first_name,\n    last_name,\n    phone_number,\n    email,\n  }: RequestData = await req.json();\n  const totalPrice = price * 100;\n  try {\n    // Create Checkout Session\n    const stripeSession = await stripe.checkout.sessions.create({\n      line_items: [\n        {\n          quantity: 1,\n          price_data: {\n            currency: \"usd\",\n            product_data: {\n              name: roomType,\n              description: `Payment for ${nights} Night(s)`\n            },\n            unit_amount: totalPrice,\n          },\n        },\n      ],\n      mode: \"payment\",\n      success_url: `${process.env.APP_URL}/bookings/success`,\n      cancel_url: `${process.env.APP_URL}/bookings/checkout?checkInDate=${check_in_date}&checkOutDate=${check_out_date}&roomType=${roomType}&price=${price/nights}&room=${room_id}`,\n      metadata: {\n        nights,\n        total_price: totalPrice,\n        room_id,\n        check_in_date,\n        check_out_date,\n        first_name,\n        last_name,\n        phone_number,\n        email,\n      },\n    });\n    console.log(stripeSession);\n    return NextResponse.json({ url: stripeSession.url! });\n  } catch (err) {\n    console.log({ err });\n    return NextResponse.json(\n      { message: \"An expected error occurred, please try again\" },\n      { status: 500 }\n    );\n  }\n}\n",[1914,5423,5424,5438,5452,5456,5481,5485,5496,5506,5516,5526,5536,5546,5556,5566,5576,5586,5597,5607,5611,5615,5639,5645,5652,5659,5666,5673,5680,5687,5694,5701,5708,5715,5736,5756,5762,5767,5786,5791,5796,5805,5810,5820,5825,5830,5843,5847,5852,5856,5860,5865,5875,5900,5947,5952,5957,5962,5967,5972,5977,5982,5987,5992,5997,6002,6007,6017,6034,6043,6052,6062,6072,6083,6087,6091],{"__ignoreMap":24},[2154,5425,5426,5428,5431,5433,5436],{"class":2156,"line":2157},[2154,5427,2203],{"class":2164},[2154,5429,5430],{"class":2160}," { NextResponse } ",[2154,5432,2209],{"class":2164},[2154,5434,5435],{"class":2168}," \"next/server\"",[2154,5437,2215],{"class":2160},[2154,5439,5440,5442,5445,5447,5450],{"class":2156,"line":2172},[2154,5441,2203],{"class":2164},[2154,5443,5444],{"class":2160}," Stripe ",[2154,5446,2209],{"class":2164},[2154,5448,5449],{"class":2168}," \"stripe\"",[2154,5451,2215],{"class":2160},[2154,5453,5454],{"class":2156,"line":2224},[2154,5455,2221],{"emptyLinePlaceholder":2220},[2154,5457,5458,5460,5463,5465,5467,5470,5473,5475,5477,5479],{"class":2156,"line":2240},[2154,5459,2495],{"class":2164},[2154,5461,5462],{"class":2250}," stripe",[2154,5464,2234],{"class":2164},[2154,5466,4066],{"class":2164},[2154,5468,5469],{"class":2230}," Stripe",[2154,5471,5472],{"class":2160},"(process.env.",[2154,5474,5392],{"class":2250},[2154,5476,2523],{"class":2164},[2154,5478,2264],{"class":2250},[2154,5480,3950],{"class":2160},[2154,5482,5483],{"class":2156,"line":2256},[2154,5484,2221],{"emptyLinePlaceholder":2220},[2154,5486,5487,5489,5492,5494],{"class":2156,"line":2269},[2154,5488,2227],{"class":2164},[2154,5490,5491],{"class":2230}," RequestData",[2154,5493,2234],{"class":2164},[2154,5495,2237],{"class":2160},[2154,5497,5498,5500,5502,5504],{"class":2156,"line":2281},[2154,5499,2320],{"class":2243},[2154,5501,2247],{"class":2164},[2154,5503,2264],{"class":2250},[2154,5505,2652],{"class":2160},[2154,5507,5508,5510,5512,5514],{"class":2156,"line":2294},[2154,5509,2332],{"class":2243},[2154,5511,2247],{"class":2164},[2154,5513,2264],{"class":2250},[2154,5515,2652],{"class":2160},[2154,5517,5518,5520,5522,5524],{"class":2156,"line":2300},[2154,5519,2344],{"class":2243},[2154,5521,2247],{"class":2164},[2154,5523,2264],{"class":2250},[2154,5525,2652],{"class":2160},[2154,5527,5528,5530,5532,5534],{"class":2156,"line":2305},[2154,5529,2356],{"class":2243},[2154,5531,2247],{"class":2164},[2154,5533,2264],{"class":2250},[2154,5535,2652],{"class":2160},[2154,5537,5538,5540,5542,5544],{"class":2156,"line":2317},[2154,5539,2368],{"class":2243},[2154,5541,2247],{"class":2164},[2154,5543,2264],{"class":2250},[2154,5545,2652],{"class":2160},[2154,5547,5548,5550,5552,5554],{"class":2156,"line":2329},[2154,5549,2380],{"class":2243},[2154,5551,2247],{"class":2164},[2154,5553,2264],{"class":2250},[2154,5555,2652],{"class":2160},[2154,5557,5558,5560,5562,5564],{"class":2156,"line":2341},[2154,5559,2392],{"class":2243},[2154,5561,2247],{"class":2164},[2154,5563,2264],{"class":2250},[2154,5565,2652],{"class":2160},[2154,5567,5568,5570,5572,5574],{"class":2156,"line":2353},[2154,5569,2404],{"class":2243},[2154,5571,2247],{"class":2164},[2154,5573,2251],{"class":2250},[2154,5575,2652],{"class":2160},[2154,5577,5578,5580,5582,5584],{"class":2156,"line":2365},[2154,5579,2416],{"class":2243},[2154,5581,2247],{"class":2164},[2154,5583,2264],{"class":2250},[2154,5585,2652],{"class":2160},[2154,5587,5588,5591,5593,5595],{"class":2156,"line":2377},[2154,5589,5590],{"class":2243},"  roomType",[2154,5592,2247],{"class":2164},[2154,5594,2264],{"class":2250},[2154,5596,2652],{"class":2160},[2154,5598,5599,5601,5603,5605],{"class":2156,"line":2389},[2154,5600,2259],{"class":2243},[2154,5602,2247],{"class":2164},[2154,5604,2251],{"class":2250},[2154,5606,2215],{"class":2160},[2154,5608,5609],{"class":2156,"line":2401},[2154,5610,2297],{"class":2160},[2154,5612,5613],{"class":2156,"line":2413},[2154,5614,2221],{"emptyLinePlaceholder":2220},[2154,5616,5617,5619,5621,5623,5626,5628,5631,5633,5636],{"class":2156,"line":2425},[2154,5618,2554],{"class":2164},[2154,5620,2637],{"class":2164},[2154,5622,3836],{"class":2164},[2154,5624,5625],{"class":2230}," POST",[2154,5627,2537],{"class":2160},[2154,5629,5630],{"class":2243},"req",[2154,5632,2247],{"class":2164},[2154,5634,5635],{"class":2230}," Request",[2154,5637,5638],{"class":2160},") {\n",[2154,5640,5641,5643],{"class":2156,"line":2436},[2154,5642,3847],{"class":2164},[2154,5644,2237],{"class":2160},[2154,5646,5647,5650],{"class":2156,"line":2441},[2154,5648,5649],{"class":2250},"    price",[2154,5651,2652],{"class":2160},[2154,5653,5654,5657],{"class":2156,"line":2446},[2154,5655,5656],{"class":2250},"    roomType",[2154,5658,2652],{"class":2160},[2154,5660,5661,5664],{"class":2156,"line":2458},[2154,5662,5663],{"class":2250},"    room_id",[2154,5665,2652],{"class":2160},[2154,5667,5668,5671],{"class":2156,"line":2470},[2154,5669,5670],{"class":2250},"    nights",[2154,5672,2652],{"class":2160},[2154,5674,5675,5678],{"class":2156,"line":2482},[2154,5676,5677],{"class":2250},"    check_in_date",[2154,5679,2652],{"class":2160},[2154,5681,5682,5685],{"class":2156,"line":2487},[2154,5683,5684],{"class":2250},"    check_out_date",[2154,5686,2652],{"class":2160},[2154,5688,5689,5692],{"class":2156,"line":2492},[2154,5690,5691],{"class":2250},"    first_name",[2154,5693,2652],{"class":2160},[2154,5695,5696,5699],{"class":2156,"line":2515},[2154,5697,5698],{"class":2250},"    last_name",[2154,5700,2652],{"class":2160},[2154,5702,5703,5706],{"class":2156,"line":2528},[2154,5704,5705],{"class":2250},"    phone_number",[2154,5707,2652],{"class":2160},[2154,5709,5710,5713],{"class":2156,"line":2546},[2154,5711,5712],{"class":2250},"    email",[2154,5714,2652],{"class":2160},[2154,5716,5717,5720,5722,5724,5726,5728,5731,5734],{"class":2156,"line":2551},[2154,5718,5719],{"class":2160},"  }",[2154,5721,2247],{"class":2164},[2154,5723,5491],{"class":2230},[2154,5725,2234],{"class":2164},[2154,5727,2701],{"class":2164},[2154,5729,5730],{"class":2160}," req.",[2154,5732,5733],{"class":2230},"json",[2154,5735,3923],{"class":2160},[2154,5737,5738,5740,5743,5745,5748,5751,5754],{"class":2156,"line":2859},[2154,5739,3847],{"class":2164},[2154,5741,5742],{"class":2250}," totalPrice",[2154,5744,2234],{"class":2164},[2154,5746,5747],{"class":2160}," price ",[2154,5749,5750],{"class":2164},"*",[2154,5752,5753],{"class":2250}," 100",[2154,5755,2215],{"class":2160},[2154,5757,5758,5760],{"class":2156,"line":2865},[2154,5759,2686],{"class":2164},[2154,5761,2237],{"class":2160},[2154,5763,5764],{"class":2156,"line":2871},[2154,5765,5766],{"class":2728},"    // Create Checkout Session\n",[2154,5768,5769,5771,5774,5776,5778,5781,5784],{"class":2156,"line":2876},[2154,5770,2693],{"class":2164},[2154,5772,5773],{"class":2250}," stripeSession",[2154,5775,2234],{"class":2164},[2154,5777,2701],{"class":2164},[2154,5779,5780],{"class":2160}," stripe.checkout.sessions.",[2154,5782,5783],{"class":2230},"create",[2154,5785,4862],{"class":2160},[2154,5787,5788],{"class":2156,"line":2881},[2154,5789,5790],{"class":2160},"      line_items: [\n",[2154,5792,5793],{"class":2156,"line":2886},[2154,5794,5795],{"class":2160},"        {\n",[2154,5797,5798,5801,5803],{"class":2156,"line":2895},[2154,5799,5800],{"class":2160},"          quantity: ",[2154,5802,2784],{"class":2250},[2154,5804,2652],{"class":2160},[2154,5806,5807],{"class":2156,"line":2900},[2154,5808,5809],{"class":2160},"          price_data: {\n",[2154,5811,5812,5815,5818],{"class":2156,"line":2910},[2154,5813,5814],{"class":2160},"            currency: ",[2154,5816,5817],{"class":2168},"\"usd\"",[2154,5819,2652],{"class":2160},[2154,5821,5822],{"class":2156,"line":2915},[2154,5823,5824],{"class":2160},"            product_data: {\n",[2154,5826,5827],{"class":2156,"line":2920},[2154,5828,5829],{"class":2160},"              name: roomType,\n",[2154,5831,5832,5835,5838,5840],{"class":2156,"line":2925},[2154,5833,5834],{"class":2160},"              description: ",[2154,5836,5837],{"class":2168},"`Payment for ${",[2154,5839,2108],{"class":2160},[2154,5841,5842],{"class":2168},"} Night(s)`\n",[2154,5844,5845],{"class":2156,"line":2930},[2154,5846,3061],{"class":2160},[2154,5848,5849],{"class":2156,"line":2936},[2154,5850,5851],{"class":2160},"            unit_amount: totalPrice,\n",[2154,5853,5854],{"class":2156,"line":2941},[2154,5855,3067],{"class":2160},[2154,5857,5858],{"class":2156,"line":2946},[2154,5859,2766],{"class":2160},[2154,5861,5862],{"class":2156,"line":2951},[2154,5863,5864],{"class":2160},"      ],\n",[2154,5866,5867,5870,5873],{"class":2156,"line":2960},[2154,5868,5869],{"class":2160},"      mode: ",[2154,5871,5872],{"class":2168},"\"payment\"",[2154,5874,2652],{"class":2160},[2154,5876,5877,5880,5883,5886,5888,5891,5893,5895,5898],{"class":2156,"line":2965},[2154,5878,5879],{"class":2160},"      success_url: ",[2154,5881,5882],{"class":2168},"`${",[2154,5884,5885],{"class":2160},"process",[2154,5887,1880],{"class":2168},[2154,5889,5890],{"class":2160},"env",[2154,5892,1880],{"class":2168},[2154,5894,2175],{"class":2250},[2154,5896,5897],{"class":2168},"}/bookings/success`",[2154,5899,2652],{"class":2160},[2154,5901,5902,5905,5907,5909,5911,5913,5915,5917,5920,5922,5924,5926,5928,5930,5932,5934,5937,5939,5941,5943,5945],{"class":2156,"line":2971},[2154,5903,5904],{"class":2160},"      cancel_url: ",[2154,5906,5882],{"class":2168},[2154,5908,5885],{"class":2160},[2154,5910,1880],{"class":2168},[2154,5912,5890],{"class":2160},[2154,5914,1880],{"class":2168},[2154,5916,2175],{"class":2250},[2154,5918,5919],{"class":2168},"}/bookings/checkout?checkInDate=${",[2154,5921,2087],{"class":2160},[2154,5923,4184],{"class":2168},[2154,5925,2093],{"class":2160},[2154,5927,5227],{"class":2168},[2154,5929,5083],{"class":2160},[2154,5931,5218],{"class":2168},[2154,5933,1988],{"class":2160},[2154,5935,5936],{"class":2164},"/",[2154,5938,2108],{"class":2160},[2154,5940,5201],{"class":2168},[2154,5942,2099],{"class":2160},[2154,5944,4202],{"class":2168},[2154,5946,2652],{"class":2160},[2154,5948,5949],{"class":2156,"line":2976},[2154,5950,5951],{"class":2160},"      metadata: {\n",[2154,5953,5954],{"class":2156,"line":2981},[2154,5955,5956],{"class":2160},"        nights,\n",[2154,5958,5959],{"class":2156,"line":2986},[2154,5960,5961],{"class":2160},"        total_price: totalPrice,\n",[2154,5963,5964],{"class":2156,"line":2991},[2154,5965,5966],{"class":2160},"        room_id,\n",[2154,5968,5969],{"class":2156,"line":2997},[2154,5970,5971],{"class":2160},"        check_in_date,\n",[2154,5973,5974],{"class":2156,"line":3002},[2154,5975,5976],{"class":2160},"        check_out_date,\n",[2154,5978,5979],{"class":2156,"line":3007},[2154,5980,5981],{"class":2160},"        first_name,\n",[2154,5983,5984],{"class":2156,"line":3012},[2154,5985,5986],{"class":2160},"        last_name,\n",[2154,5988,5989],{"class":2156,"line":3021},[2154,5990,5991],{"class":2160},"        phone_number,\n",[2154,5993,5994],{"class":2156,"line":3026},[2154,5995,5996],{"class":2160},"        email,\n",[2154,5998,5999],{"class":2156,"line":3032},[2154,6000,6001],{"class":2160},"      },\n",[2154,6003,6004],{"class":2156,"line":3037},[2154,6005,6006],{"class":2160},"    });\n",[2154,6008,6009,6011,6014],{"class":2156,"line":3042},[2154,6010,3111],{"class":2160},[2154,6012,6013],{"class":2230},"log",[2154,6015,6016],{"class":2160},"(stripeSession);\n",[2154,6018,6019,6021,6024,6026,6029,6031],{"class":2156,"line":3047},[2154,6020,3090],{"class":2164},[2154,6022,6023],{"class":2160}," NextResponse.",[2154,6025,5733],{"class":2230},[2154,6027,6028],{"class":2160},"({ url: stripeSession.url",[2154,6030,4093],{"class":2164},[2154,6032,6033],{"class":2160}," });\n",[2154,6035,6036,6038,6040],{"class":2156,"line":3052},[2154,6037,3099],{"class":2160},[2154,6039,3102],{"class":2164},[2154,6041,6042],{"class":2160}," (err) {\n",[2154,6044,6045,6047,6049],{"class":2156,"line":3058},[2154,6046,3111],{"class":2160},[2154,6048,6013],{"class":2230},[2154,6050,6051],{"class":2160},"({ err });\n",[2154,6053,6054,6056,6058,6060],{"class":2156,"line":3064},[2154,6055,3090],{"class":2164},[2154,6057,6023],{"class":2160},[2154,6059,5733],{"class":2230},[2154,6061,2710],{"class":2160},[2154,6063,6064,6067,6070],{"class":2156,"line":3070},[2154,6065,6066],{"class":2160},"      { message: ",[2154,6068,6069],{"class":2168},"\"An expected error occurred, please try again\"",[2154,6071,2841],{"class":2160},[2154,6073,6074,6077,6080],{"class":2156,"line":3075},[2154,6075,6076],{"class":2160},"      { status: ",[2154,6078,6079],{"class":2250},"500",[2154,6081,6082],{"class":2160}," }\n",[2154,6084,6085],{"class":2156,"line":3081},[2154,6086,3084],{"class":2160},[2154,6088,6089],{"class":2156,"line":3087},[2154,6090,3128],{"class":2160},[2154,6092,6093],{"class":2156,"line":3096},[2154,6094,4497],{"class":2160},[1855,6096,6097,6100,6107,6118,6129,6139,6146],{},[1858,6098,6099],{},"Create a Next.js API that expects a request booking information to create a new booking/reservation,",[1858,6101,6102,6103,6106],{},"Create a new Stripe session with the ",[1914,6104,6105],{},"stripe.checkout.sessions.create"," method from the Stripe SDK.",[1858,6108,6109,6110,1917,6112,3174,6115,1880],{},"Add the required data to create payment details for a Stripe product, such as a ",[1914,6111,1976],{},[1914,6113,6114],{},"description",[1914,6116,6117],{},"unit_amount",[1858,6119,6120,6121,6124,6125,6128],{},"Specify ",[1914,6122,6123],{},"payment"," as the Stripe ",[1914,6126,6127],{},"mode"," of payment.",[1858,6130,6131,6132,3174,6135,6138],{},"Provide a ",[1914,6133,6134],{},"success_url",[1914,6136,6137],{},"cancel_url"," URL to redirect the user to determine if the payment was successful or cancelled.",[1858,6140,6141,6142,6145],{},"Attach a ",[1914,6143,6144],{},"metadata"," object to save the user details to the stripe payment payload when the payment is initiated.",[1858,6147,6148],{},"Returns the Stripe payment session URL so the user can make the payment if the request is successful.",[1840,6150,6151],{},"You will use this API route in the next section of this tutorial.",[1847,6153,6155],{"id":6154},"create-a-checkout-page","Create a Checkout Page",[1840,6157,6158,6159,6162,6163,6166,6167,3375,6170,5418],{},"With an available room selected, you need to create a checkout page, get details, and pay for the available room. To do this, create a new directory in the ",[1914,6160,6161],{},"app/bookings"," called ",[1914,6164,6165],{},"checkout",". Inside of it, make a ",[1914,6168,6169],{},"roomWidget.tsx",[1914,6171,6172],{},"app/bookings/checkout/roomWidget.tsx",[2146,6174,6176],{"className":2587,"code":6175,"language":2589,"meta":24,"style":24},"type RoomType = {\n  roomType: string,\n  checkInDate: string,\n  checkOutDate: string,\n  nights: number,\n  totalPrice: number\n}\nexport default function RoomWidget({\n  roomType,\n  checkInDate,\n  checkOutDate,\n  nights,\n  totalPrice,\n}: RoomType) {\n  return (\n    \u003Cdiv>\n      \u003Ch3>{roomType}\u003C/h3>\n      \u003Cp>Check In Date: \u003Cspan>{checkInDate}\u003C/span>\u003C/p>\n      \u003Cp>Check Out Date: \u003Cspan>{checkOutDate}\u003C/span>\u003C/p>\n      \u003Cp>Total Cost: {totalPrice}\u003C/p>\n      \u003Cp>{ nights } Night (s)\u003C/p>\n    \u003C/div>\n  )\n}\n",[1914,6177,6178,6189,6199,6209,6219,6229,6239,6243,6256,6262,6268,6274,6280,6286,6296,6302,6310,6323,6346,6368,6381,6394,6402,6407],{"__ignoreMap":24},[2154,6179,6180,6182,6185,6187],{"class":2156,"line":2157},[2154,6181,2227],{"class":2164},[2154,6183,6184],{"class":2230}," RoomType",[2154,6186,2234],{"class":2164},[2154,6188,2237],{"class":2160},[2154,6190,6191,6193,6195,6197],{"class":2156,"line":2172},[2154,6192,5590],{"class":2243},[2154,6194,2247],{"class":2164},[2154,6196,2264],{"class":2250},[2154,6198,2652],{"class":2160},[2154,6200,6201,6203,6205,6207],{"class":2156,"line":2224},[2154,6202,2645],{"class":2243},[2154,6204,2247],{"class":2164},[2154,6206,2264],{"class":2250},[2154,6208,2652],{"class":2160},[2154,6210,6211,6213,6215,6217],{"class":2156,"line":2240},[2154,6212,2657],{"class":2243},[2154,6214,2247],{"class":2164},[2154,6216,2264],{"class":2250},[2154,6218,2652],{"class":2160},[2154,6220,6221,6223,6225,6227],{"class":2156,"line":2256},[2154,6222,2404],{"class":2243},[2154,6224,2247],{"class":2164},[2154,6226,2251],{"class":2250},[2154,6228,2652],{"class":2160},[2154,6230,6231,6234,6236],{"class":2156,"line":2269},[2154,6232,6233],{"class":2243},"  totalPrice",[2154,6235,2247],{"class":2164},[2154,6237,6238],{"class":2250}," number\n",[2154,6240,6241],{"class":2156,"line":2281},[2154,6242,4497],{"class":2160},[2154,6244,6245,6247,6249,6251,6254],{"class":2156,"line":2294},[2154,6246,2554],{"class":2164},[2154,6248,2557],{"class":2164},[2154,6250,3836],{"class":2164},[2154,6252,6253],{"class":2230}," RoomWidget",[2154,6255,4862],{"class":2160},[2154,6257,6258,6260],{"class":2156,"line":2300},[2154,6259,5590],{"class":2243},[2154,6261,2652],{"class":2160},[2154,6263,6264,6266],{"class":2156,"line":2305},[2154,6265,2645],{"class":2243},[2154,6267,2652],{"class":2160},[2154,6269,6270,6272],{"class":2156,"line":2317},[2154,6271,2657],{"class":2243},[2154,6273,2652],{"class":2160},[2154,6275,6276,6278],{"class":2156,"line":2329},[2154,6277,2404],{"class":2243},[2154,6279,2652],{"class":2160},[2154,6281,6282,6284],{"class":2156,"line":2341},[2154,6283,6233],{"class":2243},[2154,6285,2652],{"class":2160},[2154,6287,6288,6290,6292,6294],{"class":2156,"line":2353},[2154,6289,4874],{"class":2160},[2154,6291,2247],{"class":2164},[2154,6293,6184],{"class":2230},[2154,6295,5638],{"class":2160},[2154,6297,6298,6300],{"class":2156,"line":2365},[2154,6299,4249],{"class":2164},[2154,6301,2640],{"class":2160},[2154,6303,6304,6306,6308],{"class":2156,"line":2377},[2154,6305,4256],{"class":2160},[2154,6307,4275],{"class":4225},[2154,6309,4278],{"class":2160},[2154,6311,6312,6314,6316,6319,6321],{"class":2156,"line":2389},[2154,6313,4272],{"class":2160},[2154,6315,1906],{"class":4225},[2154,6317,6318],{"class":2160},">{roomType}\u003C/",[2154,6320,1906],{"class":4225},[2154,6322,4278],{"class":2160},[2154,6324,6325,6327,6329,6332,6334,6337,6339,6342,6344],{"class":2156,"line":2401},[2154,6326,4272],{"class":2160},[2154,6328,1840],{"class":4225},[2154,6330,6331],{"class":2160},">Check In Date: \u003C",[2154,6333,2154],{"class":4225},[2154,6335,6336],{"class":2160},">{checkInDate}\u003C/",[2154,6338,2154],{"class":4225},[2154,6340,6341],{"class":2160},">\u003C/",[2154,6343,1840],{"class":4225},[2154,6345,4278],{"class":2160},[2154,6347,6348,6350,6352,6355,6357,6360,6362,6364,6366],{"class":2156,"line":2413},[2154,6349,4272],{"class":2160},[2154,6351,1840],{"class":4225},[2154,6353,6354],{"class":2160},">Check Out Date: \u003C",[2154,6356,2154],{"class":4225},[2154,6358,6359],{"class":2160},">{checkOutDate}\u003C/",[2154,6361,2154],{"class":4225},[2154,6363,6341],{"class":2160},[2154,6365,1840],{"class":4225},[2154,6367,4278],{"class":2160},[2154,6369,6370,6372,6374,6377,6379],{"class":2156,"line":2425},[2154,6371,4272],{"class":2160},[2154,6373,1840],{"class":4225},[2154,6375,6376],{"class":2160},">Total Cost: {totalPrice}\u003C/",[2154,6378,1840],{"class":4225},[2154,6380,4278],{"class":2160},[2154,6382,6383,6385,6387,6390,6392],{"class":2156,"line":2436},[2154,6384,4272],{"class":2160},[2154,6386,1840],{"class":4225},[2154,6388,6389],{"class":2160},">{ nights } Night (s)\u003C/",[2154,6391,1840],{"class":4225},[2154,6393,4278],{"class":2160},[2154,6395,6396,6398,6400],{"class":2156,"line":2441},[2154,6397,4584],{"class":2160},[2154,6399,4275],{"class":4225},[2154,6401,4278],{"class":2160},[2154,6403,6404],{"class":2156,"line":2446},[2154,6405,6406],{"class":2160},"  )\n",[2154,6408,6409],{"class":2156,"line":2458},[2154,6410,4497],{"class":2160},[1840,6412,6413],{},"This widget component will display a summary of the selected room on the checkout page.",[1840,6415,6416,6417,6419],{},"Next, create a ",[1914,6418,3739],{}," file to gather details from the user input with the content:",[2146,6421,6423],{"className":2587,"code":6422,"language":2589,"meta":24,"style":24},"\"use client\";\nimport { loadStripe } from \"@stripe/stripe-js\";\nimport { FormEvent, useEffect } from \"react\";\n\ntype RoomType = {\n  roomID: string;\n  nights: number;\n  checkInDate: string;\n  checkOutDate: string;\n  price: number;\n  roomType: string,\n};\n\nexport default function BookingForm({\n  roomID,\n  nights,\n  price,\n  checkInDate,\n  checkOutDate,\n  roomType\n}: RoomType) {\n  useEffect(() => {\n    loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!);\n  }, []);\n\n  const handleFormSubmit = async (e: FormEvent\u003CHTMLFormElement>) => {\n    e.preventDefault();\n    const formData = new FormData(e.currentTarget);\n    const bookingData = {\n      check_in_date: checkInDate,\n      check_out_date: checkOutDate,\n      nights,\n      room_id: roomID,\n      price,\n      roomType,\n      first_name: formData.get(\"firstName\") as string,\n      last_name: formData.get(\"lastName\") as string,\n      email: formData.get(\"email\") as string,\n      phone_number: formData.get(\"phoneNumber\") as string,\n    };\n    try {\n      const response = await fetch(\"/api/stripe-session\", {\n        method: \"POST\",\n        body: JSON.stringify(bookingData),\n      });\n\n      if (response.ok) {\n        const payment = await response.json();\n        window.location.href = payment.url;\n      } else {\n        console.error(\"Error submitting form:\", response.statusText);\n      }\n    } catch (error) {\n      console.error(\"Error:\", error);\n    }\n  };\n\n  return (\n    \u003Cform onSubmit={handleFormSubmit}>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"firstName\">First Name\u003C/label>\n        \u003Cinput type=\"text\" name=\"firstName\" id=\"firstName\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"lastName\">Last Name\u003C/label>\n        \u003Cinput type=\"text\" name=\"lastName\" id=\"lastName\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"email\">Email Address\u003C/label>\n        \u003Cinput type=\"email\" name=\"email\" id=\"email\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"phoneNumber\">Phone Number\u003C/label>\n        \u003Cinput type=\"text\" name=\"phoneNumber\" id=\"phoneNumber\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Cbutton type=\"submit\">Book Room\u003C/button>\n      \u003C/div>\n    \u003C/form>\n  );\n}\n",[1914,6424,6425,6431,6445,6458,6462,6472,6483,6493,6503,6513,6523,6533,6537,6541,6553,6559,6565,6571,6577,6583,6588,6598,6610,6623,6628,6632,6660,6668,6682,6693,6698,6703,6708,6713,6718,6723,6744,6764,6784,6804,6809,6816,6837,6847,6863,6868,6872,6880,6899,6909,6918,6933,6937,6945,6959,6963,6967,6971,6977,6989,6997,7016,7047,7055,7063,7082,7110,7118,7126,7145,7173,7181,7189,7208,7236,7244,7252,7271,7280,7289,7294],{"__ignoreMap":24},[2154,6426,6427,6429],{"class":2156,"line":2157},[2154,6428,3750],{"class":2168},[2154,6430,2215],{"class":2160},[2154,6432,6433,6435,6438,6440,6443],{"class":2156,"line":2172},[2154,6434,2203],{"class":2164},[2154,6436,6437],{"class":2160}," { loadStripe } ",[2154,6439,2209],{"class":2164},[2154,6441,6442],{"class":2168}," \"@stripe/stripe-js\"",[2154,6444,2215],{"class":2160},[2154,6446,6447,6449,6452,6454,6456],{"class":2156,"line":2224},[2154,6448,2203],{"class":2164},[2154,6450,6451],{"class":2160}," { FormEvent, useEffect } ",[2154,6453,2209],{"class":2164},[2154,6455,3764],{"class":2168},[2154,6457,2215],{"class":2160},[2154,6459,6460],{"class":2156,"line":2240},[2154,6461,2221],{"emptyLinePlaceholder":2220},[2154,6463,6464,6466,6468,6470],{"class":2156,"line":2256},[2154,6465,2227],{"class":2164},[2154,6467,6184],{"class":2230},[2154,6469,2234],{"class":2164},[2154,6471,2237],{"class":2160},[2154,6473,6474,6477,6479,6481],{"class":2156,"line":2269},[2154,6475,6476],{"class":2243},"  roomID",[2154,6478,2247],{"class":2164},[2154,6480,2264],{"class":2250},[2154,6482,2215],{"class":2160},[2154,6484,6485,6487,6489,6491],{"class":2156,"line":2281},[2154,6486,2404],{"class":2243},[2154,6488,2247],{"class":2164},[2154,6490,2251],{"class":2250},[2154,6492,2215],{"class":2160},[2154,6494,6495,6497,6499,6501],{"class":2156,"line":2294},[2154,6496,2645],{"class":2243},[2154,6498,2247],{"class":2164},[2154,6500,2264],{"class":2250},[2154,6502,2215],{"class":2160},[2154,6504,6505,6507,6509,6511],{"class":2156,"line":2300},[2154,6506,2657],{"class":2243},[2154,6508,2247],{"class":2164},[2154,6510,2264],{"class":2250},[2154,6512,2215],{"class":2160},[2154,6514,6515,6517,6519,6521],{"class":2156,"line":2305},[2154,6516,2259],{"class":2243},[2154,6518,2247],{"class":2164},[2154,6520,2251],{"class":2250},[2154,6522,2215],{"class":2160},[2154,6524,6525,6527,6529,6531],{"class":2156,"line":2317},[2154,6526,5590],{"class":2243},[2154,6528,2247],{"class":2164},[2154,6530,2264],{"class":2250},[2154,6532,2652],{"class":2160},[2154,6534,6535],{"class":2156,"line":2329},[2154,6536,2297],{"class":2160},[2154,6538,6539],{"class":2156,"line":2341},[2154,6540,2221],{"emptyLinePlaceholder":2220},[2154,6542,6543,6545,6547,6549,6551],{"class":2156,"line":2353},[2154,6544,2554],{"class":2164},[2154,6546,2557],{"class":2164},[2154,6548,3836],{"class":2164},[2154,6550,3839],{"class":2230},[2154,6552,4862],{"class":2160},[2154,6554,6555,6557],{"class":2156,"line":2365},[2154,6556,6476],{"class":2243},[2154,6558,2652],{"class":2160},[2154,6560,6561,6563],{"class":2156,"line":2377},[2154,6562,2404],{"class":2243},[2154,6564,2652],{"class":2160},[2154,6566,6567,6569],{"class":2156,"line":2389},[2154,6568,2259],{"class":2243},[2154,6570,2652],{"class":2160},[2154,6572,6573,6575],{"class":2156,"line":2401},[2154,6574,2645],{"class":2243},[2154,6576,2652],{"class":2160},[2154,6578,6579,6581],{"class":2156,"line":2413},[2154,6580,2657],{"class":2243},[2154,6582,2652],{"class":2160},[2154,6584,6585],{"class":2156,"line":2425},[2154,6586,6587],{"class":2243},"  roomType\n",[2154,6589,6590,6592,6594,6596],{"class":2156,"line":2436},[2154,6591,4874],{"class":2160},[2154,6593,2247],{"class":2164},[2154,6595,6184],{"class":2230},[2154,6597,5638],{"class":2160},[2154,6599,6600,6603,6606,6608],{"class":2156,"line":2441},[2154,6601,6602],{"class":2230},"  useEffect",[2154,6604,6605],{"class":2160},"(() ",[2154,6607,2679],{"class":2164},[2154,6609,2237],{"class":2160},[2154,6611,6612,6615,6617,6619,6621],{"class":2156,"line":2446},[2154,6613,6614],{"class":2230},"    loadStripe",[2154,6616,5472],{"class":2160},[2154,6618,5382],{"class":2250},[2154,6620,4093],{"class":2164},[2154,6622,3950],{"class":2160},[2154,6624,6625],{"class":2156,"line":2458},[2154,6626,6627],{"class":2160},"  }, []);\n",[2154,6629,6630],{"class":2156,"line":2470},[2154,6631,2221],{"emptyLinePlaceholder":2220},[2154,6633,6634,6636,6638,6640,6642,6644,6646,6648,6650,6652,6654,6656,6658],{"class":2156,"line":2482},[2154,6635,3847],{"class":2164},[2154,6637,4030],{"class":2230},[2154,6639,2234],{"class":2164},[2154,6641,2637],{"class":2164},[2154,6643,3375],{"class":2160},[2154,6645,4037],{"class":2243},[2154,6647,2247],{"class":2164},[2154,6649,4042],{"class":2230},[2154,6651,2506],{"class":2160},[2154,6653,4047],{"class":2230},[2154,6655,4050],{"class":2160},[2154,6657,2679],{"class":2164},[2154,6659,2237],{"class":2160},[2154,6661,6662,6664,6666],{"class":2156,"line":2487},[2154,6663,4077],{"class":2160},[2154,6665,4080],{"class":2230},[2154,6667,3923],{"class":2160},[2154,6669,6670,6672,6674,6676,6678,6680],{"class":2156,"line":2492},[2154,6671,2693],{"class":2164},[2154,6673,4061],{"class":2250},[2154,6675,2234],{"class":2164},[2154,6677,4066],{"class":2164},[2154,6679,4069],{"class":2230},[2154,6681,4072],{"class":2160},[2154,6683,6684,6686,6689,6691],{"class":2156,"line":2515},[2154,6685,2693],{"class":2164},[2154,6687,6688],{"class":2250}," bookingData",[2154,6690,2234],{"class":2164},[2154,6692,2237],{"class":2160},[2154,6694,6695],{"class":2156,"line":2528},[2154,6696,6697],{"class":2160},"      check_in_date: checkInDate,\n",[2154,6699,6700],{"class":2156,"line":2546},[2154,6701,6702],{"class":2160},"      check_out_date: checkOutDate,\n",[2154,6704,6705],{"class":2156,"line":2551},[2154,6706,6707],{"class":2160},"      nights,\n",[2154,6709,6710],{"class":2156,"line":2859},[2154,6711,6712],{"class":2160},"      room_id: roomID,\n",[2154,6714,6715],{"class":2156,"line":2865},[2154,6716,6717],{"class":2160},"      price,\n",[2154,6719,6720],{"class":2156,"line":2871},[2154,6721,6722],{"class":2160},"      roomType,\n",[2154,6724,6725,6728,6730,6732,6735,6737,6740,6742],{"class":2156,"line":2876},[2154,6726,6727],{"class":2160},"      first_name: formData.",[2154,6729,4149],{"class":2230},[2154,6731,2537],{"class":2160},[2154,6733,6734],{"class":2168},"\"firstName\"",[2154,6736,2676],{"class":2160},[2154,6738,6739],{"class":2164},"as",[2154,6741,2264],{"class":2250},[2154,6743,2652],{"class":2160},[2154,6745,6746,6749,6751,6753,6756,6758,6760,6762],{"class":2156,"line":2881},[2154,6747,6748],{"class":2160},"      last_name: formData.",[2154,6750,4149],{"class":2230},[2154,6752,2537],{"class":2160},[2154,6754,6755],{"class":2168},"\"lastName\"",[2154,6757,2676],{"class":2160},[2154,6759,6739],{"class":2164},[2154,6761,2264],{"class":2250},[2154,6763,2652],{"class":2160},[2154,6765,6766,6769,6771,6773,6776,6778,6780,6782],{"class":2156,"line":2886},[2154,6767,6768],{"class":2160},"      email: formData.",[2154,6770,4149],{"class":2230},[2154,6772,2537],{"class":2160},[2154,6774,6775],{"class":2168},"\"email\"",[2154,6777,2676],{"class":2160},[2154,6779,6739],{"class":2164},[2154,6781,2264],{"class":2250},[2154,6783,2652],{"class":2160},[2154,6785,6786,6789,6791,6793,6796,6798,6800,6802],{"class":2156,"line":2895},[2154,6787,6788],{"class":2160},"      phone_number: formData.",[2154,6790,4149],{"class":2230},[2154,6792,2537],{"class":2160},[2154,6794,6795],{"class":2168},"\"phoneNumber\"",[2154,6797,2676],{"class":2160},[2154,6799,6739],{"class":2164},[2154,6801,2264],{"class":2250},[2154,6803,2652],{"class":2160},[2154,6805,6806],{"class":2156,"line":2900},[2154,6807,6808],{"class":2160},"    };\n",[2154,6810,6811,6814],{"class":2156,"line":2910},[2154,6812,6813],{"class":2164},"    try",[2154,6815,2237],{"class":2160},[2154,6817,6818,6820,6823,6825,6827,6830,6832,6835],{"class":2156,"line":2915},[2154,6819,4124],{"class":2164},[2154,6821,6822],{"class":2250}," response",[2154,6824,2234],{"class":2164},[2154,6826,2701],{"class":2164},[2154,6828,6829],{"class":2230}," fetch",[2154,6831,2537],{"class":2160},[2154,6833,6834],{"class":2168},"\"/api/stripe-session\"",[2154,6836,2723],{"class":2160},[2154,6838,6839,6842,6845],{"class":2156,"line":2920},[2154,6840,6841],{"class":2160},"        method: ",[2154,6843,6844],{"class":2168},"\"POST\"",[2154,6846,2652],{"class":2160},[2154,6848,6849,6852,6855,6857,6860],{"class":2156,"line":2925},[2154,6850,6851],{"class":2160},"        body: ",[2154,6853,6854],{"class":2250},"JSON",[2154,6856,1880],{"class":2160},[2154,6858,6859],{"class":2230},"stringify",[2154,6861,6862],{"class":2160},"(bookingData),\n",[2154,6864,6865],{"class":2156,"line":2930},[2154,6866,6867],{"class":2160},"      });\n",[2154,6869,6870],{"class":2156,"line":2936},[2154,6871,2221],{"emptyLinePlaceholder":2220},[2154,6873,6874,6877],{"class":2156,"line":2941},[2154,6875,6876],{"class":2164},"      if",[2154,6878,6879],{"class":2160}," (response.ok) {\n",[2154,6881,6882,6885,6888,6890,6892,6895,6897],{"class":2156,"line":2946},[2154,6883,6884],{"class":2164},"        const",[2154,6886,6887],{"class":2250}," payment",[2154,6889,2234],{"class":2164},[2154,6891,2701],{"class":2164},[2154,6893,6894],{"class":2160}," response.",[2154,6896,5733],{"class":2230},[2154,6898,3923],{"class":2160},[2154,6900,6901,6904,6906],{"class":2156,"line":2951},[2154,6902,6903],{"class":2160},"        window.location.href ",[2154,6905,2165],{"class":2164},[2154,6907,6908],{"class":2160}," payment.url;\n",[2154,6910,6911,6914,6916],{"class":2156,"line":2960},[2154,6912,6913],{"class":2160},"      } ",[2154,6915,4117],{"class":2164},[2154,6917,2237],{"class":2160},[2154,6919,6920,6923,6925,6927,6930],{"class":2156,"line":2965},[2154,6921,6922],{"class":2160},"        console.",[2154,6924,3114],{"class":2230},[2154,6926,2537],{"class":2160},[2154,6928,6929],{"class":2168},"\"Error submitting form:\"",[2154,6931,6932],{"class":2160},", response.statusText);\n",[2154,6934,6935],{"class":2156,"line":2971},[2154,6936,4161],{"class":2160},[2154,6938,6939,6941,6943],{"class":2156,"line":2976},[2154,6940,4114],{"class":2160},[2154,6942,3102],{"class":2164},[2154,6944,3105],{"class":2160},[2154,6946,6947,6950,6952,6954,6957],{"class":2156,"line":2981},[2154,6948,6949],{"class":2160},"      console.",[2154,6951,3114],{"class":2230},[2154,6953,2537],{"class":2160},[2154,6955,6956],{"class":2168},"\"Error:\"",[2154,6958,3122],{"class":2160},[2154,6960,6961],{"class":2156,"line":2986},[2154,6962,4209],{"class":2160},[2154,6964,6965],{"class":2156,"line":2991},[2154,6966,4019],{"class":2160},[2154,6968,6969],{"class":2156,"line":2997},[2154,6970,2221],{"emptyLinePlaceholder":2220},[2154,6972,6973,6975],{"class":2156,"line":3002},[2154,6974,4249],{"class":2164},[2154,6976,2640],{"class":2160},[2154,6978,6979,6981,6983,6985,6987],{"class":2156,"line":3007},[2154,6980,4256],{"class":2160},[2154,6982,4259],{"class":4225},[2154,6984,4262],{"class":2230},[2154,6986,2165],{"class":2164},[2154,6988,4267],{"class":2160},[2154,6990,6991,6993,6995],{"class":2156,"line":3012},[2154,6992,4272],{"class":2160},[2154,6994,4275],{"class":4225},[2154,6996,4278],{"class":2160},[2154,6998,6999,7001,7003,7005,7007,7009,7012,7014],{"class":2156,"line":3021},[2154,7000,4283],{"class":2160},[2154,7002,4317],{"class":4225},[2154,7004,4320],{"class":2230},[2154,7006,2165],{"class":2164},[2154,7008,6734],{"class":2168},[2154,7010,7011],{"class":2160},">First Name\u003C/",[2154,7013,4317],{"class":4225},[2154,7015,4278],{"class":2160},[2154,7017,7018,7020,7022,7024,7026,7029,7031,7033,7035,7038,7040,7042,7045],{"class":2156,"line":3026},[2154,7019,4283],{"class":2160},[2154,7021,4226],{"class":4225},[2154,7023,4229],{"class":2230},[2154,7025,2165],{"class":2164},[2154,7027,7028],{"class":2168},"\"text\"",[2154,7030,4237],{"class":2230},[2154,7032,2165],{"class":2164},[2154,7034,6734],{"class":2168},[2154,7036,7037],{"class":2230}," id",[2154,7039,2165],{"class":2164},[2154,7041,6734],{"class":2168},[2154,7043,7044],{"class":2230}," required",[2154,7046,4739],{"class":2160},[2154,7048,7049,7051,7053],{"class":2156,"line":3032},[2154,7050,4575],{"class":2160},[2154,7052,4275],{"class":4225},[2154,7054,4278],{"class":2160},[2154,7056,7057,7059,7061],{"class":2156,"line":3037},[2154,7058,4272],{"class":2160},[2154,7060,4275],{"class":4225},[2154,7062,4278],{"class":2160},[2154,7064,7065,7067,7069,7071,7073,7075,7078,7080],{"class":2156,"line":3042},[2154,7066,4283],{"class":2160},[2154,7068,4317],{"class":4225},[2154,7070,4320],{"class":2230},[2154,7072,2165],{"class":2164},[2154,7074,6755],{"class":2168},[2154,7076,7077],{"class":2160},">Last Name\u003C/",[2154,7079,4317],{"class":4225},[2154,7081,4278],{"class":2160},[2154,7083,7084,7086,7088,7090,7092,7094,7096,7098,7100,7102,7104,7106,7108],{"class":2156,"line":3047},[2154,7085,4283],{"class":2160},[2154,7087,4226],{"class":4225},[2154,7089,4229],{"class":2230},[2154,7091,2165],{"class":2164},[2154,7093,7028],{"class":2168},[2154,7095,4237],{"class":2230},[2154,7097,2165],{"class":2164},[2154,7099,6755],{"class":2168},[2154,7101,7037],{"class":2230},[2154,7103,2165],{"class":2164},[2154,7105,6755],{"class":2168},[2154,7107,7044],{"class":2230},[2154,7109,4739],{"class":2160},[2154,7111,7112,7114,7116],{"class":2156,"line":3052},[2154,7113,4575],{"class":2160},[2154,7115,4275],{"class":4225},[2154,7117,4278],{"class":2160},[2154,7119,7120,7122,7124],{"class":2156,"line":3058},[2154,7121,4272],{"class":2160},[2154,7123,4275],{"class":4225},[2154,7125,4278],{"class":2160},[2154,7127,7128,7130,7132,7134,7136,7138,7141,7143],{"class":2156,"line":3064},[2154,7129,4283],{"class":2160},[2154,7131,4317],{"class":4225},[2154,7133,4320],{"class":2230},[2154,7135,2165],{"class":2164},[2154,7137,6775],{"class":2168},[2154,7139,7140],{"class":2160},">Email Address\u003C/",[2154,7142,4317],{"class":4225},[2154,7144,4278],{"class":2160},[2154,7146,7147,7149,7151,7153,7155,7157,7159,7161,7163,7165,7167,7169,7171],{"class":2156,"line":3070},[2154,7148,4283],{"class":2160},[2154,7150,4226],{"class":4225},[2154,7152,4229],{"class":2230},[2154,7154,2165],{"class":2164},[2154,7156,6775],{"class":2168},[2154,7158,4237],{"class":2230},[2154,7160,2165],{"class":2164},[2154,7162,6775],{"class":2168},[2154,7164,7037],{"class":2230},[2154,7166,2165],{"class":2164},[2154,7168,6775],{"class":2168},[2154,7170,7044],{"class":2230},[2154,7172,4739],{"class":2160},[2154,7174,7175,7177,7179],{"class":2156,"line":3075},[2154,7176,4575],{"class":2160},[2154,7178,4275],{"class":4225},[2154,7180,4278],{"class":2160},[2154,7182,7183,7185,7187],{"class":2156,"line":3081},[2154,7184,4272],{"class":2160},[2154,7186,4275],{"class":4225},[2154,7188,4278],{"class":2160},[2154,7190,7191,7193,7195,7197,7199,7201,7204,7206],{"class":2156,"line":3087},[2154,7192,4283],{"class":2160},[2154,7194,4317],{"class":4225},[2154,7196,4320],{"class":2230},[2154,7198,2165],{"class":2164},[2154,7200,6795],{"class":2168},[2154,7202,7203],{"class":2160},">Phone Number\u003C/",[2154,7205,4317],{"class":4225},[2154,7207,4278],{"class":2160},[2154,7209,7210,7212,7214,7216,7218,7220,7222,7224,7226,7228,7230,7232,7234],{"class":2156,"line":3096},[2154,7211,4283],{"class":2160},[2154,7213,4226],{"class":4225},[2154,7215,4229],{"class":2230},[2154,7217,2165],{"class":2164},[2154,7219,7028],{"class":2168},[2154,7221,4237],{"class":2230},[2154,7223,2165],{"class":2164},[2154,7225,6795],{"class":2168},[2154,7227,7037],{"class":2230},[2154,7229,2165],{"class":2164},[2154,7231,6795],{"class":2168},[2154,7233,7044],{"class":2230},[2154,7235,4739],{"class":2160},[2154,7237,7238,7240,7242],{"class":2156,"line":3108},[2154,7239,4575],{"class":2160},[2154,7241,4275],{"class":4225},[2154,7243,4278],{"class":2160},[2154,7245,7246,7248,7250],{"class":2156,"line":3125},[2154,7247,4272],{"class":2160},[2154,7249,4275],{"class":4225},[2154,7251,4278],{"class":2160},[2154,7253,7254,7256,7258,7260,7262,7264,7267,7269],{"class":2156,"line":3131},[2154,7255,4283],{"class":2160},[2154,7257,4556],{"class":4225},[2154,7259,4229],{"class":2230},[2154,7261,2165],{"class":2164},[2154,7263,4563],{"class":2168},[2154,7265,7266],{"class":2160},">Book Room\u003C/",[2154,7268,4556],{"class":4225},[2154,7270,4278],{"class":2160},[2154,7272,7274,7276,7278],{"class":2156,"line":7273},78,[2154,7275,4575],{"class":2160},[2154,7277,4275],{"class":4225},[2154,7279,4278],{"class":2160},[2154,7281,7283,7285,7287],{"class":2156,"line":7282},79,[2154,7284,4584],{"class":2160},[2154,7286,4259],{"class":4225},[2154,7288,4278],{"class":2160},[2154,7290,7292],{"class":2156,"line":7291},80,[2154,7293,4593],{"class":2160},[2154,7295,7297],{"class":2156,"line":7296},81,[2154,7298,4497],{"class":2160},[1840,7300,3144,7301,7303],{},[1914,7302,4736],{}," component:",[1855,7305,7306,7312,7326,7332,7339,7346],{},[1858,7307,7308,7309,5339],{},"Loads the Stripe SDK when the component is mounted using the ",[1914,7310,7311],{},"loadStripe",[1858,7313,7314,7315,1917,7318,1917,7321,3174,7323],{},"Creates a form that gets the user details such as ",[1914,7316,7317],{},"firstName",[1914,7319,7320],{},"lastName",[1914,7322,2075],{},[1914,7324,7325],{},"phoneNumber",[1858,7327,7328,7329],{},"Receives room details for booking a room as ",[1914,7330,7331],{},"props",[1858,7333,7334,7335,7338],{},"Creates a new ",[1914,7336,7337],{},"bookingData"," object, combining the selected room details and the user-filled form data.",[1858,7340,7341,7342,7345],{},"When the form is submitted, it fires up a request to the ",[1914,7343,7344],{},"/api/stripe-session"," route you created in the previous step to trigger a payment from Stripe.",[1858,7347,7348],{},"When the request is successful, it redirects the user to the Stripe payment link returned from the Stripe API route.",[1840,7350,7351,7352,7354],{},"To render this form in the same directory, create a new file called ",[1914,7353,4794],{}," with the content:",[2146,7356,7358],{"className":2587,"code":7357,"language":2589,"meta":24,"style":24},"import dayjs from \"dayjs\";\nimport BookingForm from \"./form\";\nimport RoomWidget from \"./roomWidget\";\n\nexport default async function Bookings({\n  searchParams,\n}: {\n  searchParams: { [key: string]: string };\n}) {\n  const { checkInDate, checkOutDate, room, price, roomType } = searchParams;\n  // Calculate the number of nights\n  const nights = dayjs(checkOutDate).diff(checkInDate, \"day\");\n  const totalPrice = nights * Number(price);\n  return (\n    \u003Cmain>\n      \u003Cdiv>\n        \u003CRoomWidget\n          roomType={roomType}\n          checkInDate={checkInDate}\n          checkOutDate={checkOutDate}\n          totalPrice={totalPrice}\n          nights={nights}\n        />\n        \u003CBookingForm\n          roomID={room}\n          nights={nights}\n          price={totalPrice}\n          checkInDate={checkInDate}\n          checkOutDate={checkOutDate}\n          roomType={roomType}\n        />\n      \u003C/div>\n    \u003C/main>\n  );\n}\n",[1914,7359,7360,7372,7384,7398,7402,7417,7423,7431,7453,7457,7488,7493,7517,7536,7542,7550,7558,7565,7575,7585,7595,7605,7615,7620,7627,7637,7645,7654,7662,7670,7678,7682,7690,7698,7702],{"__ignoreMap":24},[2154,7361,7362,7364,7366,7368,7370],{"class":2156,"line":2157},[2154,7363,2203],{"class":2164},[2154,7365,4821],{"class":2160},[2154,7367,2209],{"class":2164},[2154,7369,4826],{"class":2168},[2154,7371,2215],{"class":2160},[2154,7373,7374,7376,7378,7380,7382],{"class":2156,"line":2172},[2154,7375,2203],{"class":2164},[2154,7377,4638],{"class":2160},[2154,7379,2209],{"class":2164},[2154,7381,4643],{"class":2168},[2154,7383,2215],{"class":2160},[2154,7385,7386,7388,7391,7393,7396],{"class":2156,"line":2224},[2154,7387,2203],{"class":2164},[2154,7389,7390],{"class":2160}," RoomWidget ",[2154,7392,2209],{"class":2164},[2154,7394,7395],{"class":2168}," \"./roomWidget\"",[2154,7397,2215],{"class":2160},[2154,7399,7400],{"class":2156,"line":2240},[2154,7401,2221],{"emptyLinePlaceholder":2220},[2154,7403,7404,7406,7408,7410,7412,7415],{"class":2156,"line":2256},[2154,7405,2554],{"class":2164},[2154,7407,2557],{"class":2164},[2154,7409,2637],{"class":2164},[2154,7411,3836],{"class":2164},[2154,7413,7414],{"class":2230}," Bookings",[2154,7416,4862],{"class":2160},[2154,7418,7419,7421],{"class":2156,"line":2269},[2154,7420,4867],{"class":2243},[2154,7422,2652],{"class":2160},[2154,7424,7425,7427,7429],{"class":2156,"line":2281},[2154,7426,4874],{"class":2160},[2154,7428,2247],{"class":2164},[2154,7430,2237],{"class":2160},[2154,7432,7433,7435,7437,7439,7441,7443,7445,7447,7449,7451],{"class":2156,"line":2294},[2154,7434,4867],{"class":2243},[2154,7436,2247],{"class":2164},[2154,7438,4887],{"class":2160},[2154,7440,4890],{"class":2243},[2154,7442,2247],{"class":2164},[2154,7444,2264],{"class":2250},[2154,7446,4897],{"class":2160},[2154,7448,2247],{"class":2164},[2154,7450,2264],{"class":2250},[2154,7452,4904],{"class":2160},[2154,7454,7455],{"class":2156,"line":2300},[2154,7456,4909],{"class":2160},[2154,7458,7459,7461,7463,7465,7467,7469,7471,7474,7476,7478,7480,7482,7484,7486],{"class":2156,"line":2305},[2154,7460,3847],{"class":2164},[2154,7462,4916],{"class":2160},[2154,7464,3210],{"class":2250},[2154,7466,1917],{"class":2160},[2154,7468,3199],{"class":2250},[2154,7470,1917],{"class":2160},[2154,7472,7473],{"class":2250},"room",[2154,7475,1917],{"class":2160},[2154,7477,1988],{"class":2250},[2154,7479,1917],{"class":2160},[2154,7481,5083],{"class":2250},[2154,7483,4929],{"class":2160},[2154,7485,2165],{"class":2164},[2154,7487,4934],{"class":2160},[2154,7489,7490],{"class":2156,"line":2317},[2154,7491,7492],{"class":2728},"  // Calculate the number of nights\n",[2154,7494,7495,7497,7500,7502,7504,7506,7509,7512,7515],{"class":2156,"line":2329},[2154,7496,3847],{"class":2164},[2154,7498,7499],{"class":2250}," nights",[2154,7501,2234],{"class":2164},[2154,7503,3720],{"class":2230},[2154,7505,4972],{"class":2160},[2154,7507,7508],{"class":2230},"diff",[2154,7510,7511],{"class":2160},"(checkInDate, ",[2154,7513,7514],{"class":2168},"\"day\"",[2154,7516,3950],{"class":2160},[2154,7518,7519,7521,7523,7525,7528,7530,7533],{"class":2156,"line":2341},[2154,7520,3847],{"class":2164},[2154,7522,5742],{"class":2250},[2154,7524,2234],{"class":2164},[2154,7526,7527],{"class":2160}," nights ",[2154,7529,5750],{"class":2164},[2154,7531,7532],{"class":2230}," Number",[2154,7534,7535],{"class":2160},"(price);\n",[2154,7537,7538,7540],{"class":2156,"line":2353},[2154,7539,4249],{"class":2164},[2154,7541,2640],{"class":2160},[2154,7543,7544,7546,7548],{"class":2156,"line":2365},[2154,7545,4256],{"class":2160},[2154,7547,4679],{"class":4225},[2154,7549,4278],{"class":2160},[2154,7551,7552,7554,7556],{"class":2156,"line":2377},[2154,7553,4272],{"class":2160},[2154,7555,4275],{"class":4225},[2154,7557,4278],{"class":2160},[2154,7559,7560,7562],{"class":2156,"line":2389},[2154,7561,4283],{"class":2160},[2154,7563,7564],{"class":2250},"RoomWidget\n",[2154,7566,7567,7570,7572],{"class":2156,"line":2401},[2154,7568,7569],{"class":2230},"          roomType",[2154,7571,2165],{"class":2164},[2154,7573,7574],{"class":2160},"{roomType}\n",[2154,7576,7577,7580,7582],{"class":2156,"line":2413},[2154,7578,7579],{"class":2230},"          checkInDate",[2154,7581,2165],{"class":2164},[2154,7583,7584],{"class":2160},"{checkInDate}\n",[2154,7586,7587,7590,7592],{"class":2156,"line":2425},[2154,7588,7589],{"class":2230},"          checkOutDate",[2154,7591,2165],{"class":2164},[2154,7593,7594],{"class":2160},"{checkOutDate}\n",[2154,7596,7597,7600,7602],{"class":2156,"line":2436},[2154,7598,7599],{"class":2230},"          totalPrice",[2154,7601,2165],{"class":2164},[2154,7603,7604],{"class":2160},"{totalPrice}\n",[2154,7606,7607,7610,7612],{"class":2156,"line":2441},[2154,7608,7609],{"class":2230},"          nights",[2154,7611,2165],{"class":2164},[2154,7613,7614],{"class":2160},"{nights}\n",[2154,7616,7617],{"class":2156,"line":2446},[2154,7618,7619],{"class":2160},"        />\n",[2154,7621,7622,7624],{"class":2156,"line":2458},[2154,7623,4283],{"class":2160},[2154,7625,7626],{"class":2250},"BookingForm\n",[2154,7628,7629,7632,7634],{"class":2156,"line":2470},[2154,7630,7631],{"class":2230},"          roomID",[2154,7633,2165],{"class":2164},[2154,7635,7636],{"class":2160},"{room}\n",[2154,7638,7639,7641,7643],{"class":2156,"line":2482},[2154,7640,7609],{"class":2230},[2154,7642,2165],{"class":2164},[2154,7644,7614],{"class":2160},[2154,7646,7647,7650,7652],{"class":2156,"line":2487},[2154,7648,7649],{"class":2230},"          price",[2154,7651,2165],{"class":2164},[2154,7653,7604],{"class":2160},[2154,7655,7656,7658,7660],{"class":2156,"line":2492},[2154,7657,7579],{"class":2230},[2154,7659,2165],{"class":2164},[2154,7661,7584],{"class":2160},[2154,7663,7664,7666,7668],{"class":2156,"line":2515},[2154,7665,7589],{"class":2230},[2154,7667,2165],{"class":2164},[2154,7669,7594],{"class":2160},[2154,7671,7672,7674,7676],{"class":2156,"line":2528},[2154,7673,7569],{"class":2230},[2154,7675,2165],{"class":2164},[2154,7677,7574],{"class":2160},[2154,7679,7680],{"class":2156,"line":2546},[2154,7681,7619],{"class":2160},[2154,7683,7684,7686,7688],{"class":2156,"line":2551},[2154,7685,4575],{"class":2160},[2154,7687,4275],{"class":4225},[2154,7689,4278],{"class":2160},[2154,7691,7692,7694,7696],{"class":2156,"line":2859},[2154,7693,4584],{"class":2160},[2154,7695,4679],{"class":4225},[2154,7697,4278],{"class":2160},[2154,7699,7700],{"class":2156,"line":2865},[2154,7701,4593],{"class":2160},[2154,7703,7704],{"class":2156,"line":2871},[2154,7705,4497],{"class":2160},[1840,7707,7708],{},[1927,7709],{"alt":7710,"src":7711},"Screenshot of the booking form with room widget component","/img/07368fc6-100f-4942-bae2-6ee6167a3a08.webp",[1840,7713,7714,7715,7718],{},"Clicking on the ",[1914,7716,7717],{},"Book Room"," button to submit the form will trigger a Stripe payment and take you to a Stripe checkout:",[1840,7720,7721],{},[1927,7722],{"alt":7723,"src":7724},"A Stripe checkout","/img/3e7bde10-d959-4d31-bd61-9f5aeceed004.webp",[1840,7726,7727],{},"This form will trigger a stripe payment to pay for the selected room.",[1840,7729,6416,7730,7733,7734,7736],{},[1914,7731,7732],{},"success"," directory in the ",[1914,7735,6161],{}," directory to create a success page when payment is successfully made.",[1840,7738,2567,7739,3736,7741,7743],{},[1914,7740,7732],{},[1914,7742,4794],{}," that has the content:",[2146,7745,7747],{"className":2587,"code":7746,"language":2589,"meta":24,"style":24},"\"use client\";\n\nimport Link from \"next/link\";\n\nexport default function SuccessPage() {\n  return (\n    \u003Cdiv>\n      \u003Ch1>Hotel Booking Payment Successful!\u003C/h1>\n      \u003Cp>You will receive an email with your booking details\u003C/p>\n      \u003CLink href=\"/\"\n      >\n        Go back to Homepage\n      \u003C/Link>\n    \u003C/div>\n  );\n}\n",[1914,7748,7749,7755,7759,7771,7775,7788,7794,7802,7815,7828,7842,7847,7852,7860,7868,7872],{"__ignoreMap":24},[2154,7750,7751,7753],{"class":2156,"line":2157},[2154,7752,3750],{"class":2168},[2154,7754,2215],{"class":2160},[2154,7756,7757],{"class":2156,"line":2172},[2154,7758,2221],{"emptyLinePlaceholder":2220},[2154,7760,7761,7763,7765,7767,7769],{"class":2156,"line":2224},[2154,7762,2203],{"class":2164},[2154,7764,4835],{"class":2160},[2154,7766,2209],{"class":2164},[2154,7768,4840],{"class":2168},[2154,7770,2215],{"class":2160},[2154,7772,7773],{"class":2156,"line":2240},[2154,7774,2221],{"emptyLinePlaceholder":2220},[2154,7776,7777,7779,7781,7783,7786],{"class":2156,"line":2256},[2154,7778,2554],{"class":2164},[2154,7780,2557],{"class":2164},[2154,7782,3836],{"class":2164},[2154,7784,7785],{"class":2230}," SuccessPage",[2154,7787,3842],{"class":2160},[2154,7789,7790,7792],{"class":2156,"line":2269},[2154,7791,4249],{"class":2164},[2154,7793,2640],{"class":2160},[2154,7795,7796,7798,7800],{"class":2156,"line":2281},[2154,7797,4256],{"class":2160},[2154,7799,4275],{"class":4225},[2154,7801,4278],{"class":2160},[2154,7803,7804,7806,7808,7811,7813],{"class":2156,"line":2294},[2154,7805,4272],{"class":2160},[2154,7807,4696],{"class":4225},[2154,7809,7810],{"class":2160},">Hotel Booking Payment Successful!\u003C/",[2154,7812,4696],{"class":4225},[2154,7814,4278],{"class":2160},[2154,7816,7817,7819,7821,7824,7826],{"class":2156,"line":2300},[2154,7818,4272],{"class":2160},[2154,7820,1840],{"class":4225},[2154,7822,7823],{"class":2160},">You will receive an email with your booking details\u003C/",[2154,7825,1840],{"class":4225},[2154,7827,4278],{"class":2160},[2154,7829,7830,7832,7834,7837,7839],{"class":2156,"line":2305},[2154,7831,4272],{"class":2160},[2154,7833,5255],{"class":2250},[2154,7835,7836],{"class":2230}," href",[2154,7838,2165],{"class":2164},[2154,7840,7841],{"class":2168},"\"/\"\n",[2154,7843,7844],{"class":2156,"line":2317},[2154,7845,7846],{"class":2160},"      >\n",[2154,7848,7849],{"class":2156,"line":2329},[2154,7850,7851],{"class":2160},"        Go back to Homepage\n",[2154,7853,7854,7856,7858],{"class":2156,"line":2341},[2154,7855,4575],{"class":2160},[2154,7857,5255],{"class":2250},[2154,7859,4278],{"class":2160},[2154,7861,7862,7864,7866],{"class":2156,"line":2353},[2154,7863,4584],{"class":2160},[2154,7865,4275],{"class":4225},[2154,7867,4278],{"class":2160},[2154,7869,7870],{"class":2156,"line":2365},[2154,7871,4593],{"class":2160},[2154,7873,7874],{"class":2156,"line":2377},[2154,7875,4497],{"class":2160},[1840,7877,7878],{},[1927,7879],{"alt":7880,"src":7881},"A page showing a success message and a link to the homepage","/img/c4903fb9-5155-4cab-bc6d-cb3f36a86aff.webp",[1847,7883,7885],{"id":7884},"configure-a-webhook-for-stripe-payment-events","Configure A Webhook for Stripe Payment Events",[1840,7887,7888,7889,7891],{},"When a Stripe payment is resolved successfully, we want to send Directus a request to create a new reservation using the ",[1914,7890,6144],{}," we stored in the payment request.",[1840,7893,7894],{},"To do this, Stripe has a list of events that we can listen to when a payment is triggered. Let's create a webhook in Next.js that can listen to a Stripe event when a payment goes through.",[1840,7896,5400,7897,7900,7901,7904,7905,7907],{},[1914,7898,7899],{},"app/api/"," directory, create a new directory with a subdirectory called ",[1914,7902,7903],{},"webhook/stripe,"," and inside of this directory, create a ",[1914,7906,5413],{}," for implementing a webhook,",[1840,7909,7910,7911,2247],{},"Add the following code to ",[1914,7912,5413],{},[2146,7914,7916],{"className":2194,"code":7915,"language":2196,"meta":24,"style":24},"import { NextResponse } from \"next/server\";\nimport Stripe from \"stripe\";\nimport { makeReservation } from \"@/lib/apis\";\n\nconst checkout_session_completed = \"checkout.session.completed\";\nconst stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string);\n\nexport async function POST(req: Request, res: Response) {\n  const reqBody = await req.text();\n  const sig = req.headers.get(\"stripe-signature\");\n  const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;\n\n  let event: Stripe.Event;\n\n  try {\n    if (!sig || !webhookSecret) return;\n    event = stripe.webhooks.constructEvent(reqBody, sig, webhookSecret);\n  } catch (error: any) {\n    console.log(error);\n    return NextResponse.json(\n      { message: `Webhook Error: ${error.message}` },\n      { status: 500 }\n    );\n  }\n\n  // load our event\n  switch (event.type) {\n    case checkout_session_completed:\n      const session = event.data.object;\n      if (!session.metadata || !session.payment_intent) {\n        console.error(\"Missing metadata or Payment Intent in Stripe session\");\n        // Optionally return an error response\n        return NextResponse.json(\n          { message: \"Incomplete reservation data\" },\n          { status: 400 }\n        );\n      }\n\n      const {\n        // @ts-ignore\n        metadata: {\n          first_name,\n          last_name,\n          email,\n          phone_number,\n          check_in_date,\n          check_out_date,\n          room_id,\n          nights,\n          total_price,\n        },\n        payment_intent,\n      } = session;\n      console.log({ payment_intent });\n      await makeReservation({\n        first_name,\n        last_name,\n        email,\n        phone_number,\n        check_in_date,\n        check_out_date,\n        room_id,\n        nights,\n        total_price,\n        payment_id: payment_intent as string,\n      });\n\n      return NextResponse.json(\"Booking successful\", {\n        status: 200,\n        statusText: \"Booking Successful\",\n      });\n\n    default:\n      console.log(`Unhandled event type ${event.type}`);\n  }\n\n  return NextResponse.json({ message: \"Event Received\" }, { status: 200 });\n}\n",[1914,7917,7918,7930,7942,7955,7959,7973,7995,7999,8029,8047,8068,8085,8089,8108,8112,8118,8143,8159,8176,8185,8195,8213,8221,8225,8229,8233,8238,8246,8254,8266,8284,8297,8302,8313,8323,8333,8338,8342,8346,8352,8357,8365,8372,8379,8386,8393,8400,8407,8414,8420,8427,8431,8438,8447,8456,8465,8469,8473,8477,8481,8485,8489,8493,8497,8502,8513,8517,8521,8537,8547,8557,8561,8565,8572,8594,8598,8602,8623],{"__ignoreMap":24},[2154,7919,7920,7922,7924,7926,7928],{"class":2156,"line":2157},[2154,7921,2203],{"class":2164},[2154,7923,5430],{"class":2160},[2154,7925,2209],{"class":2164},[2154,7927,5435],{"class":2168},[2154,7929,2215],{"class":2160},[2154,7931,7932,7934,7936,7938,7940],{"class":2156,"line":2172},[2154,7933,2203],{"class":2164},[2154,7935,5444],{"class":2160},[2154,7937,2209],{"class":2164},[2154,7939,5449],{"class":2168},[2154,7941,2215],{"class":2160},[2154,7943,7944,7946,7949,7951,7953],{"class":2156,"line":2224},[2154,7945,2203],{"class":2164},[2154,7947,7948],{"class":2160}," { makeReservation } ",[2154,7950,2209],{"class":2164},[2154,7952,4812],{"class":2168},[2154,7954,2215],{"class":2160},[2154,7956,7957],{"class":2156,"line":2240},[2154,7958,2221],{"emptyLinePlaceholder":2220},[2154,7960,7961,7963,7966,7968,7971],{"class":2156,"line":2256},[2154,7962,2495],{"class":2164},[2154,7964,7965],{"class":2250}," checkout_session_completed",[2154,7967,2234],{"class":2164},[2154,7969,7970],{"class":2168}," \"checkout.session.completed\"",[2154,7972,2215],{"class":2160},[2154,7974,7975,7977,7979,7981,7983,7985,7987,7989,7991,7993],{"class":2156,"line":2269},[2154,7976,2495],{"class":2164},[2154,7978,5462],{"class":2250},[2154,7980,2234],{"class":2164},[2154,7982,4066],{"class":2164},[2154,7984,5469],{"class":2230},[2154,7986,5472],{"class":2160},[2154,7988,5392],{"class":2250},[2154,7990,2523],{"class":2164},[2154,7992,2264],{"class":2250},[2154,7994,3950],{"class":2160},[2154,7996,7997],{"class":2156,"line":2281},[2154,7998,2221],{"emptyLinePlaceholder":2220},[2154,8000,8001,8003,8005,8007,8009,8011,8013,8015,8017,8019,8022,8024,8027],{"class":2156,"line":2294},[2154,8002,2554],{"class":2164},[2154,8004,2637],{"class":2164},[2154,8006,3836],{"class":2164},[2154,8008,5625],{"class":2230},[2154,8010,2537],{"class":2160},[2154,8012,5630],{"class":2243},[2154,8014,2247],{"class":2164},[2154,8016,5635],{"class":2230},[2154,8018,1917],{"class":2160},[2154,8020,8021],{"class":2243},"res",[2154,8023,2247],{"class":2164},[2154,8025,8026],{"class":2230}," Response",[2154,8028,5638],{"class":2160},[2154,8030,8031,8033,8036,8038,8040,8042,8045],{"class":2156,"line":2300},[2154,8032,3847],{"class":2164},[2154,8034,8035],{"class":2250}," reqBody",[2154,8037,2234],{"class":2164},[2154,8039,2701],{"class":2164},[2154,8041,5730],{"class":2160},[2154,8043,8044],{"class":2230},"text",[2154,8046,3923],{"class":2160},[2154,8048,8049,8051,8054,8056,8059,8061,8063,8066],{"class":2156,"line":2305},[2154,8050,3847],{"class":2164},[2154,8052,8053],{"class":2250}," sig",[2154,8055,2234],{"class":2164},[2154,8057,8058],{"class":2160}," req.headers.",[2154,8060,4149],{"class":2230},[2154,8062,2537],{"class":2160},[2154,8064,8065],{"class":2168},"\"stripe-signature\"",[2154,8067,3950],{"class":2160},[2154,8069,8070,8072,8075,8077,8080,8083],{"class":2156,"line":2317},[2154,8071,3847],{"class":2164},[2154,8073,8074],{"class":2250}," webhookSecret",[2154,8076,2234],{"class":2164},[2154,8078,8079],{"class":2160}," process.env.",[2154,8081,8082],{"class":2250},"STRIPE_WEBHOOK_SECRET",[2154,8084,2215],{"class":2160},[2154,8086,8087],{"class":2156,"line":2329},[2154,8088,2221],{"emptyLinePlaceholder":2220},[2154,8090,8091,8094,8097,8099,8101,8103,8106],{"class":2156,"line":2341},[2154,8092,8093],{"class":2164},"  let",[2154,8095,8096],{"class":2160}," event",[2154,8098,2247],{"class":2164},[2154,8100,5469],{"class":2230},[2154,8102,1880],{"class":2160},[2154,8104,8105],{"class":2230},"Event",[2154,8107,2215],{"class":2160},[2154,8109,8110],{"class":2156,"line":2353},[2154,8111,2221],{"emptyLinePlaceholder":2220},[2154,8113,8114,8116],{"class":2156,"line":2365},[2154,8115,2686],{"class":2164},[2154,8117,2237],{"class":2160},[2154,8119,8120,8122,8124,8126,8129,8132,8135,8138,8141],{"class":2156,"line":2377},[2154,8121,4088],{"class":2164},[2154,8123,3375],{"class":2160},[2154,8125,4093],{"class":2164},[2154,8127,8128],{"class":2160},"sig ",[2154,8130,8131],{"class":2164},"||",[2154,8133,8134],{"class":2164}," !",[2154,8136,8137],{"class":2160},"webhookSecret) ",[2154,8139,8140],{"class":2164},"return",[2154,8142,2215],{"class":2160},[2154,8144,8145,8148,8150,8153,8156],{"class":2156,"line":2389},[2154,8146,8147],{"class":2160},"    event ",[2154,8149,2165],{"class":2164},[2154,8151,8152],{"class":2160}," stripe.webhooks.",[2154,8154,8155],{"class":2230},"constructEvent",[2154,8157,8158],{"class":2160},"(reqBody, sig, webhookSecret);\n",[2154,8160,8161,8163,8165,8167,8169,8171,8174],{"class":2156,"line":2401},[2154,8162,3099],{"class":2160},[2154,8164,3102],{"class":2164},[2154,8166,3375],{"class":2160},[2154,8168,3114],{"class":2243},[2154,8170,2247],{"class":2164},[2154,8172,8173],{"class":2250}," any",[2154,8175,5638],{"class":2160},[2154,8177,8178,8180,8182],{"class":2156,"line":2413},[2154,8179,3111],{"class":2160},[2154,8181,6013],{"class":2230},[2154,8183,8184],{"class":2160},"(error);\n",[2154,8186,8187,8189,8191,8193],{"class":2156,"line":2425},[2154,8188,3090],{"class":2164},[2154,8190,6023],{"class":2160},[2154,8192,5733],{"class":2230},[2154,8194,2710],{"class":2160},[2154,8196,8197,8199,8202,8204,8206,8209,8211],{"class":2156,"line":2436},[2154,8198,6066],{"class":2160},[2154,8200,8201],{"class":2168},"`Webhook Error: ${",[2154,8203,3114],{"class":2160},[2154,8205,1880],{"class":2168},[2154,8207,8208],{"class":2160},"message",[2154,8210,4202],{"class":2168},[2154,8212,2841],{"class":2160},[2154,8214,8215,8217,8219],{"class":2156,"line":2441},[2154,8216,6076],{"class":2160},[2154,8218,6079],{"class":2250},[2154,8220,6082],{"class":2160},[2154,8222,8223],{"class":2156,"line":2446},[2154,8224,3084],{"class":2160},[2154,8226,8227],{"class":2156,"line":2458},[2154,8228,3128],{"class":2160},[2154,8230,8231],{"class":2156,"line":2470},[2154,8232,2221],{"emptyLinePlaceholder":2220},[2154,8234,8235],{"class":2156,"line":2482},[2154,8236,8237],{"class":2728},"  // load our event\n",[2154,8239,8240,8243],{"class":2156,"line":2487},[2154,8241,8242],{"class":2164},"  switch",[2154,8244,8245],{"class":2160}," (event.type) {\n",[2154,8247,8248,8251],{"class":2156,"line":2492},[2154,8249,8250],{"class":2164},"    case",[2154,8252,8253],{"class":2160}," checkout_session_completed:\n",[2154,8255,8256,8258,8261,8263],{"class":2156,"line":2515},[2154,8257,4124],{"class":2164},[2154,8259,8260],{"class":2250}," session",[2154,8262,2234],{"class":2164},[2154,8264,8265],{"class":2160}," event.data.object;\n",[2154,8267,8268,8270,8272,8274,8277,8279,8281],{"class":2156,"line":2528},[2154,8269,6876],{"class":2164},[2154,8271,3375],{"class":2160},[2154,8273,4093],{"class":2164},[2154,8275,8276],{"class":2160},"session.metadata ",[2154,8278,8131],{"class":2164},[2154,8280,8134],{"class":2164},[2154,8282,8283],{"class":2160},"session.payment_intent) {\n",[2154,8285,8286,8288,8290,8292,8295],{"class":2156,"line":2546},[2154,8287,6922],{"class":2160},[2154,8289,3114],{"class":2230},[2154,8291,2537],{"class":2160},[2154,8293,8294],{"class":2168},"\"Missing metadata or Payment Intent in Stripe session\"",[2154,8296,3950],{"class":2160},[2154,8298,8299],{"class":2156,"line":2551},[2154,8300,8301],{"class":2728},"        // Optionally return an error response\n",[2154,8303,8304,8307,8309,8311],{"class":2156,"line":2859},[2154,8305,8306],{"class":2164},"        return",[2154,8308,6023],{"class":2160},[2154,8310,5733],{"class":2230},[2154,8312,2710],{"class":2160},[2154,8314,8315,8318,8321],{"class":2156,"line":2865},[2154,8316,8317],{"class":2160},"          { message: ",[2154,8319,8320],{"class":2168},"\"Incomplete reservation data\"",[2154,8322,2841],{"class":2160},[2154,8324,8325,8328,8331],{"class":2156,"line":2871},[2154,8326,8327],{"class":2160},"          { status: ",[2154,8329,8330],{"class":2250},"400",[2154,8332,6082],{"class":2160},[2154,8334,8335],{"class":2156,"line":2876},[2154,8336,8337],{"class":2160},"        );\n",[2154,8339,8340],{"class":2156,"line":2881},[2154,8341,4161],{"class":2160},[2154,8343,8344],{"class":2156,"line":2886},[2154,8345,2221],{"emptyLinePlaceholder":2220},[2154,8347,8348,8350],{"class":2156,"line":2895},[2154,8349,4124],{"class":2164},[2154,8351,2237],{"class":2160},[2154,8353,8354],{"class":2156,"line":2900},[2154,8355,8356],{"class":2728},"        // @ts-ignore\n",[2154,8358,8359,8362],{"class":2156,"line":2910},[2154,8360,8361],{"class":2243},"        metadata",[2154,8363,8364],{"class":2160},": {\n",[2154,8366,8367,8370],{"class":2156,"line":2915},[2154,8368,8369],{"class":2250},"          first_name",[2154,8371,2652],{"class":2160},[2154,8373,8374,8377],{"class":2156,"line":2920},[2154,8375,8376],{"class":2250},"          last_name",[2154,8378,2652],{"class":2160},[2154,8380,8381,8384],{"class":2156,"line":2925},[2154,8382,8383],{"class":2250},"          email",[2154,8385,2652],{"class":2160},[2154,8387,8388,8391],{"class":2156,"line":2930},[2154,8389,8390],{"class":2250},"          phone_number",[2154,8392,2652],{"class":2160},[2154,8394,8395,8398],{"class":2156,"line":2936},[2154,8396,8397],{"class":2250},"          check_in_date",[2154,8399,2652],{"class":2160},[2154,8401,8402,8405],{"class":2156,"line":2941},[2154,8403,8404],{"class":2250},"          check_out_date",[2154,8406,2652],{"class":2160},[2154,8408,8409,8412],{"class":2156,"line":2946},[2154,8410,8411],{"class":2250},"          room_id",[2154,8413,2652],{"class":2160},[2154,8415,8416,8418],{"class":2156,"line":2951},[2154,8417,7609],{"class":2250},[2154,8419,2652],{"class":2160},[2154,8421,8422,8425],{"class":2156,"line":2960},[2154,8423,8424],{"class":2250},"          total_price",[2154,8426,2652],{"class":2160},[2154,8428,8429],{"class":2156,"line":2965},[2154,8430,2766],{"class":2160},[2154,8432,8433,8436],{"class":2156,"line":2971},[2154,8434,8435],{"class":2250},"        payment_intent",[2154,8437,2652],{"class":2160},[2154,8439,8440,8442,8444],{"class":2156,"line":2976},[2154,8441,6913],{"class":2160},[2154,8443,2165],{"class":2164},[2154,8445,8446],{"class":2160}," session;\n",[2154,8448,8449,8451,8453],{"class":2156,"line":2981},[2154,8450,6949],{"class":2160},[2154,8452,6013],{"class":2230},[2154,8454,8455],{"class":2160},"({ payment_intent });\n",[2154,8457,8458,8461,8463],{"class":2156,"line":2986},[2154,8459,8460],{"class":2164},"      await",[2154,8462,3368],{"class":2230},[2154,8464,4862],{"class":2160},[2154,8466,8467],{"class":2156,"line":2991},[2154,8468,5981],{"class":2160},[2154,8470,8471],{"class":2156,"line":2997},[2154,8472,5986],{"class":2160},[2154,8474,8475],{"class":2156,"line":3002},[2154,8476,5996],{"class":2160},[2154,8478,8479],{"class":2156,"line":3007},[2154,8480,5991],{"class":2160},[2154,8482,8483],{"class":2156,"line":3012},[2154,8484,5971],{"class":2160},[2154,8486,8487],{"class":2156,"line":3021},[2154,8488,5976],{"class":2160},[2154,8490,8491],{"class":2156,"line":3026},[2154,8492,5966],{"class":2160},[2154,8494,8495],{"class":2156,"line":3032},[2154,8496,5956],{"class":2160},[2154,8498,8499],{"class":2156,"line":3037},[2154,8500,8501],{"class":2160},"        total_price,\n",[2154,8503,8504,8507,8509,8511],{"class":2156,"line":3042},[2154,8505,8506],{"class":2160},"        payment_id: payment_intent ",[2154,8508,6739],{"class":2164},[2154,8510,2264],{"class":2250},[2154,8512,2652],{"class":2160},[2154,8514,8515],{"class":2156,"line":3047},[2154,8516,6867],{"class":2160},[2154,8518,8519],{"class":2156,"line":3052},[2154,8520,2221],{"emptyLinePlaceholder":2220},[2154,8522,8523,8526,8528,8530,8532,8535],{"class":2156,"line":3058},[2154,8524,8525],{"class":2164},"      return",[2154,8527,6023],{"class":2160},[2154,8529,5733],{"class":2230},[2154,8531,2537],{"class":2160},[2154,8533,8534],{"class":2168},"\"Booking successful\"",[2154,8536,2723],{"class":2160},[2154,8538,8539,8542,8545],{"class":2156,"line":3064},[2154,8540,8541],{"class":2160},"        status: ",[2154,8543,8544],{"class":2250},"200",[2154,8546,2652],{"class":2160},[2154,8548,8549,8552,8555],{"class":2156,"line":3070},[2154,8550,8551],{"class":2160},"        statusText: ",[2154,8553,8554],{"class":2168},"\"Booking Successful\"",[2154,8556,2652],{"class":2160},[2154,8558,8559],{"class":2156,"line":3075},[2154,8560,6867],{"class":2160},[2154,8562,8563],{"class":2156,"line":3081},[2154,8564,2221],{"emptyLinePlaceholder":2220},[2154,8566,8567,8570],{"class":2156,"line":3087},[2154,8568,8569],{"class":2164},"    default",[2154,8571,1963],{"class":2160},[2154,8573,8574,8576,8578,8580,8583,8586,8588,8590,8592],{"class":2156,"line":3096},[2154,8575,6949],{"class":2160},[2154,8577,6013],{"class":2230},[2154,8579,2537],{"class":2160},[2154,8581,8582],{"class":2168},"`Unhandled event type ${",[2154,8584,8585],{"class":2160},"event",[2154,8587,1880],{"class":2168},[2154,8589,2227],{"class":2160},[2154,8591,4202],{"class":2168},[2154,8593,3950],{"class":2160},[2154,8595,8596],{"class":2156,"line":3108},[2154,8597,3128],{"class":2160},[2154,8599,8600],{"class":2156,"line":3125},[2154,8601,2221],{"emptyLinePlaceholder":2220},[2154,8603,8604,8606,8608,8610,8613,8616,8619,8621],{"class":2156,"line":3131},[2154,8605,4249],{"class":2164},[2154,8607,6023],{"class":2160},[2154,8609,5733],{"class":2230},[2154,8611,8612],{"class":2160},"({ message: ",[2154,8614,8615],{"class":2168},"\"Event Received\"",[2154,8617,8618],{"class":2160}," }, { status: ",[2154,8620,8544],{"class":2250},[2154,8622,6033],{"class":2160},[2154,8624,8625],{"class":2156,"line":7273},[2154,8626,4497],{"class":2160},[1840,8628,8629],{},"Let's break down the webhook route handler for better understanding:",[1855,8631,8632,8637,8643,8653,8666],{},[1858,8633,8634,8635,1880],{},"Initialize a new Stripe instance using a ",[1914,8636,5392],{},[1858,8638,8639,8640,8642],{},"Use the request body as the \"stripe-signature\" header and ",[1914,8641,8082],{}," to check the authenticity of the request and create the Stripe event.",[1858,8644,8645,8646,3203,8649,8652],{},"Use a switch statement to listen for the Stripe event where the ",[1914,8647,8648],{},"event.type",[1914,8650,8651],{},"checkout.session.completed"," (This means the payment checkout went through successfully in Stripe)",[1858,8654,8655,8656,3174,8658,8661,8662,8665],{},"Extract the ",[1914,8657,6144],{},[1914,8659,8660],{},"payment_intent"," from the session that the ",[1914,8663,8664],{},"event.data.object"," provides.",[1858,8667,8668,8669,8672],{},"Using the data extracted from the ",[1914,8670,8671],{},"metadata,"," the webhook requests Directus to create a new reservation.",[1906,8674,8676],{"id":8675},"testing-the-webhook","Testing the Webhook",[1840,8678,8679],{},"With Stripe CLI installed on your computer, run the command:",[2146,8681,8683],{"className":2148,"code":8682,"language":2150,"meta":24,"style":24},"stripe login\n",[1914,8684,8685],{"__ignoreMap":24},[2154,8686,8687,8690],{"class":2156,"line":2157},[2154,8688,8689],{"class":2230},"stripe",[2154,8691,8692],{"class":2168}," login\n",[1840,8694,8695],{},"Forward the API route handle in the Next.js application to Stripe to listen for it with the command:",[2146,8697,8699],{"className":2148,"code":8698,"language":2150,"meta":24,"style":24},"stripe listen --forward-to localhost:3000/api/webhook/stripe\n",[1914,8700,8701],{"__ignoreMap":24},[2154,8702,8703,8705,8708,8711],{"class":2156,"line":2157},[2154,8704,8689],{"class":2230},[2154,8706,8707],{"class":2168}," listen",[2154,8709,8710],{"class":2250}," --forward-to",[2154,8712,8713],{"class":2168}," localhost:3000/api/webhook/stripe\n",[1840,8715,8716],{},"This will provide you with a response similar to this:",[2146,8718,8720],{"className":2148,"code":8719,"language":2150,"meta":24,"style":24},"> Ready! You are using Stripe API Version [2022-08-01]. Your webhook signing secret is whsec_f9e4axxxxxxx (^C to quit)\n",[1914,8721,8722],{"__ignoreMap":24},[2154,8723,8724,8727,8730,8732,8735,8738,8741,8743,8746,8749,8752,8755,8757,8760],{"class":2156,"line":2157},[2154,8725,8726],{"class":2164},">",[2154,8728,8729],{"class":2160}," Ready",[2154,8731,4093],{"class":2164},[2154,8733,8734],{"class":2230}," You",[2154,8736,8737],{"class":2168}," are",[2154,8739,8740],{"class":2168}," using",[2154,8742,5469],{"class":2168},[2154,8744,8745],{"class":2168}," API",[2154,8747,8748],{"class":2168}," Version",[2154,8750,8751],{"class":2160}," [2022-08-01]. Your webhook signing secret is whsec_f9e4axxxxxxx (",[2154,8753,8754],{"class":2230},"^C",[2154,8756,3533],{"class":2168},[2154,8758,8759],{"class":2168}," quit",[2154,8761,4109],{"class":2160},[1840,8763,8764],{},"Copy your webhook signing secret, as this is needed to verify and trigger an event from the webhook.",[1840,8766,8767],{},"After that, open a new terminal tab and test the webhook by triggering a Stripe event from the CLI with:",[2146,8769,8771],{"className":2148,"code":8770,"language":2150,"meta":24,"style":24},"stripe trigger payment_intent.succeeded\n",[1914,8772,8773],{"__ignoreMap":24},[2154,8774,8775,8777,8780],{"class":2156,"line":2157},[2154,8776,8689],{"class":2230},[2154,8778,8779],{"class":2168}," trigger",[2154,8781,8782],{"class":2168}," payment_intent.succeeded\n",[1840,8784,8785],{},"You will receive a response that looks like this:",[1840,8787,8788],{},[1927,8789],{"alt":8790,"src":8791},"Screenshot of the Stripe webhook logs","/img/79bb025b-f65e-4513-9e76-edf1fe1f807f.webp",[1847,8793,8795],{"id":8794},"summary","Summary",[1840,8797,8798],{},"In this tutorial, you've successfully created a hotel booking website fetching data from Directus and its relational datasets using Directus's powerful operators and filter rules, trigger a payment on Stripe, create a webhook that listens to the Stripe payment, and then make a reservation in Directus.",[1840,8800,8801,8802,1880],{},"The complete code for this tutorial can be found ",[1861,8803,8806],{"href":8804,"rel":8805},"https://github.com/directs-labs/nextjs-hotel-booking",[1865],"here",[1840,8808,8809],{},"Some possible steps to carry out next might include:",[1855,8811,8812,8819,8825,8834,8840,8846],{},[1858,8813,8814,8818],{},[8815,8816,8817],"strong",{},"User Authentication:"," Consider adding user authentication so users can sign up, log in, and manage their bookings. This adds a layer of security and personalization to the application.",[1858,8820,8821,8824],{},[8815,8822,8823],{},"Admin Dashboard:"," Create an admin dashboard where hotel staff can manage room availability, view reservations, and update booking details. This can be achieved by implementing user roles and permissions in Directus.",[1858,8826,8827,8830,8831,1880],{},[8815,8828,8829],{},"Email Notifications:"," Set up email notifications to confirm bookings, send reminders, and provide updates on reservation status. This can also be implemented in Directus using ",[1861,8832,8833],{"href":468},"Directus Flows",[1858,8835,8836,8839],{},[8815,8837,8838],{},"Reviews and Ratings:"," Add a feature for users to leave reviews and ratings for booked rooms. This can help future guests make informed decisions and provide valuable feedback to the hotel.",[1858,8841,8842,8845],{},[8815,8843,8844],{},"Proper Error Handling:"," Consider handling errors properly and displaying the errors in the UI, such as error form fields were not filled, payment was unsuccessful, or an error occurred.",[1858,8847,8848,8851],{},[8815,8849,8850],{},"Styling the Application:"," The project is made with HTML. To make it, consider styling the application with CSS or a CSS framework of your choice.",[8853,8854,8855],"style",{},"html pre.shiki code .sxrX7, html code.shiki .sxrX7{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s8jYJ, html code.shiki .s8jYJ{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sIIMD, html code.shiki .sIIMD{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .snPdu, html code.shiki .snPdu{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sP4rz, html code.shiki .sP4rz{--shiki-light:#E36209;--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sBjJW, html code.shiki .sBjJW{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sovSZ, html code.shiki .sovSZ{--shiki-light:#22863A;--shiki-default:#22863A;--shiki-dark:#85E89D}",{"title":24,"searchDepth":2157,"depth":2172,"links":8857},[8858,8859,8864,8865,8866,8867,8868,8869,8872],{"id":1849,"depth":2172,"text":1850},{"id":1903,"depth":2172,"text":1904,"children":8860},[8861,8862,8863],{"id":1908,"depth":2224,"text":1909},{"id":2132,"depth":2224,"text":2133},{"id":2563,"depth":2224,"text":2564},{"id":3488,"depth":2172,"text":3489},{"id":3729,"depth":2172,"text":3730},{"id":4772,"depth":2172,"text":4773},{"id":5365,"depth":2172,"text":5366},{"id":6154,"depth":2172,"text":6155},{"id":7884,"depth":2172,"text":7885,"children":8870},[8871],{"id":8675,"depth":2224,"text":8676},{"id":8794,"depth":2172,"text":8795},"md",{"slug":8875},"build-an-hotel-booking-platform-with-next-js-stripe-and-directus-automate","---\nid: e93c8494-df0d-4aa1-80c1-beabb0081411\nslug: build-an-hotel-booking-platform-with-next-js-stripe-and-directus-automate\ntitle: Build an Hotel Booking Platform with Next.js, Stripe, and Directus Automate\ntechnologies:\n  - nextjs\nauthors:\n  - name: Trust Jamin\n    title: Guest Author\ndescription: Learn to build a hotel booking site with dynamic availability and payments via Stripe.\n---\nIn this tutorial, you will build a fully functional hotel booking website, using Next.js for the frontend, Directus as the backend service and Stripe for receiving payments.\n\nYou will create different room types, create and store rooms based on the room types, create new reservations dynamically when a room payment is successful and block the availability for that room based on the check-in and check-out date for the reservation.\n\n## Before You Start\n\nYou will need:\n\n- [Node.js](https://nodejs.org/) installed and a code editor on your computer.\n- A Directus project - you can use [Directus Cloud](https://directus.cloud/) or [run it yourself](/getting-started/create-a-project).\n- A [Stripe](https://stripe.com/) account with a business already set up\n- [Stripe CLI](https://docs.stripe.com/stripe-cli) installed in your computer\n- Some knowledge of TypeScript and React.\n\n## Set Up Directus\n\n### Data Model Relationships\n\nBefore setting up Directus, let's understand how the different data models you will set up in Directus are related. You need 3 data collections - `roomtypes`, `rooms`, `reservations`.\n\n![An ER diagram showing the fields and relationships defined below.](/img/d518b80b-1fc0-4151-854f-c1a973aac4b6.webp)\n\n- `room_types` are the hotel's different types of rooms and can have multiple `rooms`.\n- `rooms` are all the rooms the hotel has. A single room can only be of one `room_types` and can contain multiple reservations.\n- `reservations` are all the reservations made by users from the application's frontend after successfully making a payment.\n\nIn your Directus project, head to Settings -> Data Model  to create these data models with the following fields:\n\n- `room_types`:\n  - `id`: the primary field of this collection\n  - `name`: A string field for a room type\n  - `capacity`: An integer input field for the maximum number of guests a room can occupy.\n  - `price`: A string input price of a room\n  - `rooms`: A `One to Many` relational field related to the `rooms` collection, signifying that a single room type can have multiple rooms.\n- `rooms`:\n  - `id`: the primary field of this collection\n  - `is_available`: A toggle field for a room that indicates whether it is available for booking.\n  - `capacity`: An integer input field for the maximum number of guests a room can occupy.\n  - `room_number`: A string input to label a room\n  - `room_type`: A `Many to One` relational field related to the `room_types` collection, signifying that multiple rooms can only have a single room type.\n  - `reservations`: A `One to Many` relational field that is related to the `reservations` collection, signifying that a single room can have multiple reservations\n- `reservations`:\n  - `id`: the primary field of this collection\n  - `first_name`: A string input for the first name\n  - `last_name`: A string input for the last name\n  - `email`: A string input for email address\n  - `phone_number`: A string input for phone number\n  - `check_in_date`: A Datetime input for the check-in date for the reservation\n  - `check_out_date`: A Datetime input for the check-out date for the reservation\n  - `room_id`: A `Many to One` relational field that is related to the `rooms` collection, signifying that a single room can have multiple reservations\n  - `nights`: A string input for the number of nights the reservations will last.\n  - `total_price`: A string input for the total cost of the reservation\n  - `payment_id`: A string input for the payment for the reservation that happened on Stripe.\n\nCreate some items in the Room Types and Rooms collections - [here's some sample data](https://github.com/directus-labs/nextjs-hotel-booking-system/tree/main/sample-data).\n\n### Configure the Directus SDK\n\nOpen the `hotel-resort` project in a code editor and create a `.env.local` file, being sure to place the value with your Directus project URL:\n\n```bash\nDIRECTUS_URL=YOUR_DIRECTUS_URL\nAPP_URL=http://localhost:3000\n```\n\nCreate a new directory called `lib`. Inside it, create `directus.ts` to initialize a new Directus SDK instance:\n\n```ts\nimport { createDirectus, rest } from \"@directus/sdk\";\n\ntype RoomTypes = {\n  capacity: number;\n  price: string;\n  name: string;\n  rooms: number[];\n};\n\ntype Reservations = {\n  first_name: string;\n  last_name: string;\n  email: string;\n  phone_number: string;\n  check_in_date: string;\n  check_out_date: string;\n  room_id: string;\n  nights: number;\n  total_price: string;\n  payment_id: string\n};\n\ntype Schema = {\n  room_types: RoomTypes[];\n  reservations: Reservations[];\n};\n\nconst directus = createDirectus\u003CSchema>(\n  process.env.DIRECTUS_URL as string\n).with(rest());\n\nexport default directus;\n```\n\n### Create Directus API Actions\n\nIn the `lib` directory, create a new file called `apis.ts`. This file will contain all the API requests the Next.js application will make to Directus.\n\nAdd a `getRoomTypes` function to `lib/apis.ts`:\n\n```tsx\nimport directus from \"./directus\";\nimport { readItems, createItem } from \"@directus/sdk\";\n\nexport const getRoomTypes = async (\n  checkInDate: string,\n  checkOutDate: string,\n  capacity: string\n) => {\n  try {\n    const availableRooms = await directus.request(\n      readItems(\"room_types\", {\n        // fetches all fields from room_types\n        fields: [\"*\"],\n        filter: {\n          // check if the capacity is greater than the requested capacity\n          capacity: { _gte: Number(capacity) },\n        },\n        deep: {\n          rooms: {\n            _limit: 1,\n            _filter: {\n              _or: [\n                // check if the room is available and if the check_in_date is empty\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_in_date: { _null: true },\n                      },\n                    },\n                  ],\n                },\n                // check if the room is available and if the check_out_date is empty\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_out_date: { _null: true },\n                      },\n                    },\n                  ],\n                },\n                // check if the check_out_date is less than the requested checkInDate\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_out_date: { _lt: checkInDate },\n                      },\n                    },\n                  ],\n                },\n                // check if the check_in_date is less than the requested checkOutDate\n                {\n                  _and: [\n                    {\n                      is_available: true,\n                      reservations: {\n                        check_in_date: { _gt: checkOutDate },\n                      },\n                    },\n                  ],\n                },\n              ],\n            },\n          },\n        },\n      })\n    );\n    return availableRooms;\n  } catch (error) {\n    console.error(\"Error fetching available room types:\", error);\n  }\n};\n```\n\nLet's break down the `getRoomTypes` object for better understanding:\n\n- The `filter` field uses a filter operator to filter the `room_types` collection only to show the room types whose capacity is `_gte` (greater than or equal to) the requested `capacity`.\n- Next, we use a `deep` parameter to filter the nested relational dataset in the `room_types` collection. In the `deep` parameter, we use Directus's logic operators `_or` and `_and` to check if any rooms are available and if their reservation date does not conflict with the requested data dates.\n- If the `reservations` `check_in_date` and `check_out_date` dates are null, it means the room has never been booked before; thus, it is available. If the `check_in_date` of the room is `_gt`( greater than ) the `checkOutDate`, it means the room is also available, so also if the `check_out_date` is `_lt` (lesser than) the `checkInDate`.\n- Using the `_limit` parameter, we are limiting the `rooms` result to be just one as we only need users to book one room when making a reservation\n- Finally, based on Directus's response, the `getRoomTypes` function will either throw an error or return the fetched `roomTypes`.\n\nCreate a another function for making a new reservation called `makeReservation`:\n\n```ts\ntype ReservationData = {\n  first_name: string;\n  last_name: string;\n  email: string;\n  phone_number: string;\n  check_in_date: string;\n  check_out_date: string;\n  room_id: string;\n  nights: string;\n  total_price: string;\n  payment_id: string;\n};\n\nexport const makeReservation = async (reservationData: ReservationData) => {\n  try {\n    const data = await directus.request(\n      createItem(\"reservations\", {\n        ...reservationData,\n      })\n    );\n    return \"Booking Successful\";\n  } catch (error) {\n    console.error(\"Error creating a reservation:\", error);\n  }\n};\n```\n\nThe `makeReservation` function, sends a request to Directus to create a new reservation with a `reservationData` object.\n\n## Set Up a Next.js Application\n\nRun the following command to initialize a Next.js project:\n\n```bash\nnpx create-next-app@14 hotel-resort\n```\n\nDuring installation, when prompted, choose the following configurations:\n\n```bash\n✔ Would you like to use TypeScript?  Yes\n✔ Would you like to use ESLint?  Yes\n✔ Would you like to use Tailwind CSS? No\n✔ Would you like to use `src/` directory?  No\n✔ Would you like to use App Router? (recommended)  Yes\n✔ Would you like to customize the default import alias (@/*)? Yes\n✔ What import alias would you like configured? @/*\n```\n\nInstall the required dependencies:\n\n```bash\nnpm i @directus/sdk dayjs react-datepicker @stripe/stripe-js\n```\n\n## Set Up The Homepage With Date Picker\n\nIn the `app` directory, create a `form.tsx` file with the content:\n\n```tsx\n\"use client\";\nimport { useState, FormEvent } from \"react\";\nimport { useRouter } from \"next/navigation\";\nimport DatePicker from \"react-datepicker\";\nimport \"react-datepicker/dist/react-datepicker.css\";\n\ntype DateState = Date | null;\nexport default function BookingForm() {\n  const [startDate, setStartDate] = useState\u003CDateState>(new Date());\n  const [endDate, setEndDate] = useState\u003CDateState>();\n  const router = useRouter();\n  const [error, setError] = useState(\"\");\n\n  const handleChange = (range: DateState[]) => {\n    const [startDate, endDate] = range;\n    setStartDate(startDate);\n    setEndDate(endDate);\n  };\n\n  const handleFormSubmit = (e: FormEvent\u003CHTMLFormElement>) => {\n    const formData = new FormData(e.currentTarget);\n    e.preventDefault()\n    if (!endDate) {\n    setError(\"Please add a check out date\")\n    } else {\n      const checkAvailabilityData = {\n        checkInDate: startDate,\n        checkOutDate: endDate,\n        capacity: formData.get(\"capacity\")\n      }\n      router.push(`/bookings/rooms?checkInDate=${checkAvailabilityData.checkInDate}&checkOutDate=${checkAvailabilityData.checkOutDate}&capacity=${checkAvailabilityData.capacity}`)\n    }\n  }\n\n  \u003Cinput type=\"number\" name=\"capacity\" />;\n  return (\n    \u003Cform onSubmit={handleFormSubmit}>\n      \u003Cdiv>\n        \u003Ch2>Book an Hotel Room\u003C/h2>\n        \u003Cdiv>\n          \u003Cdiv>\n            \u003Clabel htmlFor=\"checkInDate\"> Check-in and Check-out Date:\u003C/label>\n            {error && \u003Cspan>{ error }\u003C/span>}\n            \u003CDatePicker\n              selected={startDate}\n              onChange={handleChange}\n              startDate={startDate}\n              endDate={endDate}\n              selectsRange\n              withPortal\n              required\n            />\n          \u003C/div>\n          \u003Cdiv>\n            \u003Clabel htmlFor=\"capacity\"> Guest(s):\u003C/label>\n            \u003Cinput\n              type=\"number\"\n              name=\"capacity\"\n              defaultValue={1}\n              min={1}\n              max={6}\n            />\n          \u003C/div>\n        \u003C/div>\n\n        \u003Cbutton type=\"submit\">Check Availability \u003C/button>\n      \u003C/div>\n    \u003C/form>\n  );\n}\n```\n\n- The `DatePicker` component to render a date picker form for users to submit the selected range of their check-in and check-out periods.\n- The form also contains an input of the number of guests the user will be bringing.\n- When submitted, push the data as query parameters using the Next.js `router.push` method to the `/bookings/rooms` URL.\n\nTo display this form, in the `app/page.tsx` file, replace the content with:\n\n```tsx\nimport BookingForm from \"./form\";\n\nexport default function Home() {\n\n  return (\n    \u003Cmain>\n      \u003Cdiv>\n        \u003Ch1>Welcome to Next.js Hotel Resort\u003C/h1>\n        \u003Cp>Find the best hotel rooms and enjoy your stay\u003C/p>\n        \u003Cp>Home away from home\u003C/p>\n        \u003CBookingForm />\n      \u003C/div>\n    \u003C/main>\n  );\n}\n```\n\n![Screenshot of the application homepage with a data picker](/img/aace075b-cdac-411d-95dc-0377aa413c90.webp)\n\n## Show Available Rooms\n\nInside the `app` directory, create a new directory called `bookings`; inside it, create another directory called `rooms`.  This route will be responsible for displaying the list of room types based on the availability of the rooms.\n\nInside of the `rooms` directory, create a `page.tsx` file:\n\n```tsx\nimport { getRoomTypes } from \"@/lib/apis\";\nimport dayjs from \"dayjs\";\nimport Link from \"next/link\";\n\nexport default async function Rooms({\n  searchParams,\n}: {\n  searchParams: { [key: string]: string };\n}) {\n  const { capacity, checkInDate, checkOutDate } = searchParams;\n  const formattedCheckInDate = dayjs(checkInDate).format(\"YYYY-MM-DD\");\n  const formattedCheckOutDate = dayjs(checkOutDate).format(\"YYYY-MM-DD\");\n  const roomTypes = await getRoomTypes(\n    formattedCheckInDate,\n    formattedCheckOutDate,\n    capacity\n  );\n\n  return (\n    \u003Cmain>\n      \u003Cdiv>\n        \u003Ch1>Select a Room of your choice\u003C/h1>\n        \u003Cdiv>\n          {roomTypes &&\n            roomTypes.map((roomType) => {\n              return (\n                \u003Cdiv key={roomType.id}>\n                  \u003Ch2>{roomType.name}\u003C/h2>\n                  \u003Cp>capacity: {roomType.capacity}\u003C/p>\n                  \u003Cp>Price per night: {roomType.price}\u003C/p>\n                  {roomType.rooms.length > 0 ? (\n                    \u003CLink\n                      href={`/bookings/checkout?checkInDate=${formattedCheckInDate}&checkOutDate=${formattedCheckOutDate}&room=${roomType.rooms[0]}&price=${roomType.price}&roomType=${roomType.name}`}\n                    >\n                      Book room\n                    \u003C/Link>\n                  ) : (\n                    \"Room unavailable\"\n                  )}\n                \u003C/div>\n              );\n            })}\n        \u003C/div>\n      \u003C/div>\n    \u003C/main>\n  );\n}\n```\n\n- Get the inputs from the previous page via `searchParams` and runs the `getRoomTypes` function.\n- Displays the available room types fetched from the `getRoomTypes` function and displays in HTML\n- Checks the `roomTypes.rooms` array to determine if a room is available and displays a link to book that room. If there's an available room, it renders a link to the booking form that room. Otherwise, it renders an `Room unavailable` text.\n\n![Screenshot of available rooms by room types page in Next.js when booking a room](/img/06d43baa-5a0e-41eb-a27f-410b6295a167.webp)\n\n## Set up Stripe for Receiving Payments\n\nUpdate your `.env.local` file with the publishable and secret keys you can find in your Stripe account:\n\n```bash\nNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=YOUR_STRIPE_PUBLISHABLE_KEY\nSTRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY\n```\n\nIn your `app` directory, create a new directory called `api` and, inside of it, create a directory `stripe-session` with a `route.ts` file (`app/api/stripe-session/route.ts`):\n\n```ts\nimport { NextResponse } from \"next/server\";\nimport Stripe from \"stripe\";\n\nconst stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string);\n\ntype RequestData = {\n  first_name: string,\n  last_name: string,\n  email: string,\n  phone_number: string,\n  check_in_date: string,\n  check_out_date: string,\n  room_id: string,\n  nights: number,\n  total_price: string,\n  roomType: string,\n  price: number;\n};\n\nexport async function POST(req: Request) {\n  const {\n    price,\n    roomType,\n    room_id,\n    nights,\n    check_in_date,\n    check_out_date,\n    first_name,\n    last_name,\n    phone_number,\n    email,\n  }: RequestData = await req.json();\n  const totalPrice = price * 100;\n  try {\n    // Create Checkout Session\n    const stripeSession = await stripe.checkout.sessions.create({\n      line_items: [\n        {\n          quantity: 1,\n          price_data: {\n            currency: \"usd\",\n            product_data: {\n              name: roomType,\n              description: `Payment for ${nights} Night(s)`\n            },\n            unit_amount: totalPrice,\n          },\n        },\n      ],\n      mode: \"payment\",\n      success_url: `${process.env.APP_URL}/bookings/success`,\n      cancel_url: `${process.env.APP_URL}/bookings/checkout?checkInDate=${check_in_date}&checkOutDate=${check_out_date}&roomType=${roomType}&price=${price/nights}&room=${room_id}`,\n      metadata: {\n        nights,\n        total_price: totalPrice,\n        room_id,\n        check_in_date,\n        check_out_date,\n        first_name,\n        last_name,\n        phone_number,\n        email,\n      },\n    });\n    console.log(stripeSession);\n    return NextResponse.json({ url: stripeSession.url! });\n  } catch (err) {\n    console.log({ err });\n    return NextResponse.json(\n      { message: \"An expected error occurred, please try again\" },\n      { status: 500 }\n    );\n  }\n}\n```\n\n- Create a Next.js API that expects a request booking information to create a new booking/reservation,\n- Create a new Stripe session with the `stripe.checkout.sessions.create` method from the Stripe SDK.\n- Add the required data to create payment details for a Stripe product, such as a `name`, `description` and `unit_amount`.\n- Specify `payment` as the Stripe `mode` of payment.\n- Provide a `success_url` and `cancel_url` URL to redirect the user to determine if the payment was successful or cancelled.\n- Attach a `metadata` object to save the user details to the stripe payment payload when the payment is initiated.\n- Returns the Stripe payment session URL so the user can make the payment if the request is successful.\n\nYou will use this API route in the next section of this tutorial.\n\n## Create a Checkout Page\n\nWith an available room selected, you need to create a checkout page, get details, and pay for the available room. To do this, create a new directory in the `app/bookings` called `checkout`. Inside of it, make a `roomWidget.tsx` (`app/bookings/checkout/roomWidget.tsx`):\n\n```tsx\ntype RoomType = {\n  roomType: string,\n  checkInDate: string,\n  checkOutDate: string,\n  nights: number,\n  totalPrice: number\n}\nexport default function RoomWidget({\n  roomType,\n  checkInDate,\n  checkOutDate,\n  nights,\n  totalPrice,\n}: RoomType) {\n  return (\n    \u003Cdiv>\n      \u003Ch3>{roomType}\u003C/h3>\n      \u003Cp>Check In Date: \u003Cspan>{checkInDate}\u003C/span>\u003C/p>\n      \u003Cp>Check Out Date: \u003Cspan>{checkOutDate}\u003C/span>\u003C/p>\n      \u003Cp>Total Cost: {totalPrice}\u003C/p>\n      \u003Cp>{ nights } Night (s)\u003C/p>\n    \u003C/div>\n  )\n}\n```\n\nThis widget component will display a summary of the selected room on the checkout page.\n\nNext, create a `form.tsx` file to gather details from the user input with the content:\n\n```tsx\n\"use client\";\nimport { loadStripe } from \"@stripe/stripe-js\";\nimport { FormEvent, useEffect } from \"react\";\n\ntype RoomType = {\n  roomID: string;\n  nights: number;\n  checkInDate: string;\n  checkOutDate: string;\n  price: number;\n  roomType: string,\n};\n\nexport default function BookingForm({\n  roomID,\n  nights,\n  price,\n  checkInDate,\n  checkOutDate,\n  roomType\n}: RoomType) {\n  useEffect(() => {\n    loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!);\n  }, []);\n\n  const handleFormSubmit = async (e: FormEvent\u003CHTMLFormElement>) => {\n    e.preventDefault();\n    const formData = new FormData(e.currentTarget);\n    const bookingData = {\n      check_in_date: checkInDate,\n      check_out_date: checkOutDate,\n      nights,\n      room_id: roomID,\n      price,\n      roomType,\n      first_name: formData.get(\"firstName\") as string,\n      last_name: formData.get(\"lastName\") as string,\n      email: formData.get(\"email\") as string,\n      phone_number: formData.get(\"phoneNumber\") as string,\n    };\n    try {\n      const response = await fetch(\"/api/stripe-session\", {\n        method: \"POST\",\n        body: JSON.stringify(bookingData),\n      });\n\n      if (response.ok) {\n        const payment = await response.json();\n        window.location.href = payment.url;\n      } else {\n        console.error(\"Error submitting form:\", response.statusText);\n      }\n    } catch (error) {\n      console.error(\"Error:\", error);\n    }\n  };\n\n  return (\n    \u003Cform onSubmit={handleFormSubmit}>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"firstName\">First Name\u003C/label>\n        \u003Cinput type=\"text\" name=\"firstName\" id=\"firstName\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"lastName\">Last Name\u003C/label>\n        \u003Cinput type=\"text\" name=\"lastName\" id=\"lastName\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"email\">Email Address\u003C/label>\n        \u003Cinput type=\"email\" name=\"email\" id=\"email\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"phoneNumber\">Phone Number\u003C/label>\n        \u003Cinput type=\"text\" name=\"phoneNumber\" id=\"phoneNumber\" required />\n      \u003C/div>\n      \u003Cdiv>\n        \u003Cbutton type=\"submit\">Book Room\u003C/button>\n      \u003C/div>\n    \u003C/form>\n  );\n}\n```\n\nThe `BookingForm` component:\n- Loads the Stripe SDK when the component is mounted using the `loadStripe` function.\n- Creates a form that gets the user details such as `firstName`, `lastName`, `email` and `phoneNumber`\n- Receives room details for booking a room as `props`\n- Creates a new `bookingData` object, combining the selected room details and the user-filled form data.\n- When the form is submitted, it fires up a request to the `/api/stripe-session` route you created in the previous step to trigger a payment from Stripe.\n- When the request is successful, it redirects the user to the Stripe payment link returned from the Stripe API route.\n\nTo render this form in the same directory, create a new file called `page.tsx` with the content:\n\n```tsx\nimport dayjs from \"dayjs\";\nimport BookingForm from \"./form\";\nimport RoomWidget from \"./roomWidget\";\n\nexport default async function Bookings({\n  searchParams,\n}: {\n  searchParams: { [key: string]: string };\n}) {\n  const { checkInDate, checkOutDate, room, price, roomType } = searchParams;\n  // Calculate the number of nights\n  const nights = dayjs(checkOutDate).diff(checkInDate, \"day\");\n  const totalPrice = nights * Number(price);\n  return (\n    \u003Cmain>\n      \u003Cdiv>\n        \u003CRoomWidget\n          roomType={roomType}\n          checkInDate={checkInDate}\n          checkOutDate={checkOutDate}\n          totalPrice={totalPrice}\n          nights={nights}\n        />\n        \u003CBookingForm\n          roomID={room}\n          nights={nights}\n          price={totalPrice}\n          checkInDate={checkInDate}\n          checkOutDate={checkOutDate}\n          roomType={roomType}\n        />\n      \u003C/div>\n    \u003C/main>\n  );\n}\n```\n\n![Screenshot of the booking form with room widget component](/img/07368fc6-100f-4942-bae2-6ee6167a3a08.webp)\n\nClicking on the `Book Room` button to submit the form will trigger a Stripe payment and take you to a Stripe checkout:\n\n![A Stripe checkout](/img/3e7bde10-d959-4d31-bd61-9f5aeceed004.webp)\n\nThis form will trigger a stripe payment to pay for the selected room.\n\nNext, create a `success` directory in the `app/bookings` directory to create a success page when payment is successfully made.\n\nIn the `success` directory, create a `page.tsx` that has the content:\n\n```tsx\n\"use client\";\n\nimport Link from \"next/link\";\n\nexport default function SuccessPage() {\n  return (\n    \u003Cdiv>\n      \u003Ch1>Hotel Booking Payment Successful!\u003C/h1>\n      \u003Cp>You will receive an email with your booking details\u003C/p>\n      \u003CLink href=\"/\"\n      >\n        Go back to Homepage\n      \u003C/Link>\n    \u003C/div>\n  );\n}\n```\n\n![A page showing a success message and a link to the homepage](/img/c4903fb9-5155-4cab-bc6d-cb3f36a86aff.webp)\n\n## Configure A Webhook for Stripe Payment Events\n\nWhen a Stripe payment is resolved successfully, we want to send Directus a request to create a new reservation using the `metadata` we stored in the payment request.\n\nTo do this, Stripe has a list of events that we can listen to when a payment is triggered. Let's create a webhook in Next.js that can listen to a Stripe event when a payment goes through.\n\nIn your `app/api/` directory, create a new directory with a subdirectory called `webhook/stripe,` and inside of this directory, create a `route.ts` for implementing a webhook,\n\nAdd the following code to `route.ts`:\n\n```ts\nimport { NextResponse } from \"next/server\";\nimport Stripe from \"stripe\";\nimport { makeReservation } from \"@/lib/apis\";\n\nconst checkout_session_completed = \"checkout.session.completed\";\nconst stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string);\n\nexport async function POST(req: Request, res: Response) {\n  const reqBody = await req.text();\n  const sig = req.headers.get(\"stripe-signature\");\n  const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;\n\n  let event: Stripe.Event;\n\n  try {\n    if (!sig || !webhookSecret) return;\n    event = stripe.webhooks.constructEvent(reqBody, sig, webhookSecret);\n  } catch (error: any) {\n    console.log(error);\n    return NextResponse.json(\n      { message: `Webhook Error: ${error.message}` },\n      { status: 500 }\n    );\n  }\n\n  // load our event\n  switch (event.type) {\n    case checkout_session_completed:\n      const session = event.data.object;\n      if (!session.metadata || !session.payment_intent) {\n        console.error(\"Missing metadata or Payment Intent in Stripe session\");\n        // Optionally return an error response\n        return NextResponse.json(\n          { message: \"Incomplete reservation data\" },\n          { status: 400 }\n        );\n      }\n\n      const {\n        // @ts-ignore\n        metadata: {\n          first_name,\n          last_name,\n          email,\n          phone_number,\n          check_in_date,\n          check_out_date,\n          room_id,\n          nights,\n          total_price,\n        },\n        payment_intent,\n      } = session;\n      console.log({ payment_intent });\n      await makeReservation({\n        first_name,\n        last_name,\n        email,\n        phone_number,\n        check_in_date,\n        check_out_date,\n        room_id,\n        nights,\n        total_price,\n        payment_id: payment_intent as string,\n      });\n\n      return NextResponse.json(\"Booking successful\", {\n        status: 200,\n        statusText: \"Booking Successful\",\n      });\n\n    default:\n      console.log(`Unhandled event type ${event.type}`);\n  }\n\n  return NextResponse.json({ message: \"Event Received\" }, { status: 200 });\n}\n```\n\nLet's break down the webhook route handler for better understanding:\n\n- Initialize a new Stripe instance using a `STRIPE_SECRET_KEY`.\n- Use the request body as the \"stripe-signature\" header and `STRIPE_WEBHOOK_SECRET` to check the authenticity of the request and create the Stripe event.\n- Use a switch statement to listen for the Stripe event where the `event.type` is `checkout.session.completed` (This means the payment checkout went through successfully in Stripe)\n- Extract the `metadata` and `payment_intent` from the session that the `event.data.object` provides.\n- Using the data extracted from the `metadata,` the webhook requests Directus to create a new reservation.\n\n### Testing the Webhook\n\nWith Stripe CLI installed on your computer, run the command:\n\n```bash\nstripe login\n```\n\nForward the API route handle in the Next.js application to Stripe to listen for it with the command:\n\n```bash\nstripe listen --forward-to localhost:3000/api/webhook/stripe\n```\n\nThis will provide you with a response similar to this:\n\n```bash\n> Ready! You are using Stripe API Version [2022-08-01]. Your webhook signing secret is whsec_f9e4axxxxxxx (^C to quit)\n```\n\nCopy your webhook signing secret, as this is needed to verify and trigger an event from the webhook.\n\nAfter that, open a new terminal tab and test the webhook by triggering a Stripe event from the CLI with:\n\n```bash\nstripe trigger payment_intent.succeeded\n```\n\nYou will receive a response that looks like this:\n\n![Screenshot of the Stripe webhook logs](/img/79bb025b-f65e-4513-9e76-edf1fe1f807f.webp)\n\n## Summary\n\nIn this tutorial, you've successfully created a hotel booking website fetching data from Directus and its relational datasets using Directus's powerful operators and filter rules, trigger a payment on Stripe, create a webhook that listens to the Stripe payment, and then make a reservation in Directus.\n\nThe complete code for this tutorial can be found [here](https://github.com/directs-labs/nextjs-hotel-booking).\n\nSome possible steps to carry out next might include:\n\n- **User Authentication:** Consider adding user authentication so users can sign up, log in, and manage their bookings. This adds a layer of security and personalization to the application.\n- **Admin Dashboard:** Create an admin dashboard where hotel staff can manage room availability, view reservations, and update booking details. This can be achieved by implementing user roles and permissions in Directus.\n- **Email Notifications:** Set up email notifications to confirm bookings, send reminders, and provide updates on reservation status. This can also be implemented in Directus using [Directus Flows](/getting-started/create-an-automation).\n- **Reviews and Ratings:** Add a feature for users to leave reviews and ratings for booked rooms. This can help future guests make informed decisions and provide valuable feedback to the hotel.\n- **Proper Error Handling:** Consider handling errors properly and displaying the errors in the UI, such as error form fields were not filled, payment was unsuccessful, or an error occurred.\n- **Styling the Application:** The project is made with HTML. To make it, consider styling the application with CSS or a CSS framework of your choice.\n",{"title":1436,"description":1439},[8879],"nextjs","tj46kZuEVj2VcAhWPubjxuvKkeL0OzCZN9MRiv3Bruw",1775038778637]