[{"data":1,"prerenderedAt":6481},["ShallowReactive",2],{"content-navigation":3,"$fY4mAj2l3kRkTDttxn6FGzqBc2O9HAJ2qp-_8LmMX7aw":1825,"/tutorials/projects/how-i-built-an-ai-open-source-santa-roast-app-with-directus-and-nuxt":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":1516,"authors":1832,"body":1836,"description":1519,"extension":1989,"headline":14,"icon":14,"links":14,"meta":6474,"navigation":1859,"path":1517,"rawbody":6476,"seo":6477,"stem":1518,"technologies":6478,"__hash__":6480},"content/tutorials/2.projects/how-i-built-an-ai-open-source-santa-roast-app-with-directus-and-nuxt.md",[1833],{"name":1834,"title":1835},"Bryant Gillespie","Growth Engineer",{"type":1837,"value":1838,"toc":6452},"minimark",[1839,1851,1860,1866,1869,1876,1884,1889,1898,1904,1907,1916,1926,1930,1933,1938,1963,1969,1973,1976,1981,1984,2036,2042,2051,2058,2064,2082,2088,2091,2095,2103,2123,2128,2131,2136,2145,2148,2151,2154,2172,2177,2183,2186,2190,2193,2206,2521,2526,2530,2533,2537,2540,2572,2577,2581,2585,2588,2591,2596,2675,2680,2691,2696,2704,2709,2712,2715,3431,3434,3441,5224,5228,5236,5242,5251,5257,5260,5278,6074,6078,6081,6087,6096,6099,6105,6109,6121,6127,6134,6284,6351,6358,6362,6365,6379,6382,6385,6395,6399,6405,6412,6415,6419,6422,6425,6432,6435,6439,6445,6448],[1840,1841,1842,1843,1850],"p",{},"Hey folks! Bryant here from Directus. In this post, I’ll walk you through our ",[1844,1845,1849],"a",{"href":1846,"rel":1847},"https://salty-santa.vercel.app",[1848],"nofollow","Salty Open Source Santa"," project - how we built it, why we built it, and all the fun little features we packed into this thing. Let's dive in!",[1852,1853],"iframe",{"style":1854,"src":1855,"title":1856,"frameBorder":1857,"allow":1858,"allowFullScreen":1859},"width:100%; aspect-ratio:16/9; margin-bottom: 1em;","https://www.youtube.com/embed/aHHdh50hkG4","YouTube video player","0","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",true,[1840,1861,1862],{},[1863,1864,1865],"strong",{},"What is Salty Open Source Santa?",[1840,1867,1868],{},"So what exactly is this thing? Well, it's basically the open source community's naughty or nice list. You write a letter to Santa, and he analyzes your public GitHub profile data to determine if your open source contributions were good enough to make the nice list. And then he writes you back a salty roast-style letter.",[1840,1870,1871],{},[1872,1873],"img",{"alt":1874,"src":1875},"Screenshot of OS Santa app","/img/os-salty-santa-2.png",[1840,1877,1878],{},[1863,1879,1880,1881],{},"You can check to see if you’re on Open Source Santa’s Naughty or Nice list at ",[1844,1882,1846],{"href":1846,"rel":1883},[1848],[1885,1886,1888],"h2",{"id":1887},"the-idea","The Idea 💡",[1840,1890,1891,1892,1897],{},"Like a lot of fun projects, this started with a simple conversation on Slack. My colleague John Daniels and I were brainstorming ideas for our Christmas promotion. Last year, we did a whole ",[1844,1893,1896],{"href":1894,"rel":1895},"https://x.com/directus/status/1734671700296380579",[1848],"\"12 Days of CMS\" thing"," where team members sang that dreadful song. And this year, I wanted to up the ante a bit.",[1840,1899,1900],{},[1872,1901],{"alt":1902,"src":1903},"Conversation about formation of the Salty Santa app","/img/os-salty-santa-1.png",[1840,1905,1906],{},"John suggested scanning letters and having them transcribed. I’m way more of a smartass than John so I said \"Hey, what if we make it snarkier? Like, you write a letter to Santa and he roasts you back?”",[1840,1908,1909,1910,1915],{},"So with that direction, I built the first version in an episode of our ",[1844,1911,1914],{"href":1912,"rel":1913},"https://directus.io/tv/100-apps-100-hours",[1848],"\"100 Apps, 100 Hours\" show on Directus TV",".  Let's just say it wasn't as pretty as what you see now. Here’s what it looked like.",[1917,1918,1920],"div",{"style":1919},"padding:56.25% 0 0 0;position:relative;",[1852,1921],{"src":1922,"frameBorder":1857,"allow":1923,"style":1924,"title":1925},"https://player.vimeo.com/video/1047153908?badge=0&autopause=0&player_id=0&app_id=58479","autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media","position:absolute;top:0;left:0;width:100%;height:100%;","ai-letters-to-santa-preview",[1927,1928],"script",{"src":1929},"https://player.vimeo.com/api/player.js",[1840,1931,1932],{},"But after recording the episode, I still couldn’t get the idea out of my head and I thought there was a lot more fun we could have with it. I scoped the features out a bit further with some brainstorming help from the fine folks on my team – Matt, Christina, and Lindsey.",[1840,1934,1935],{},[1863,1936,1937],{},"Here’s the additional feature list we came up with:",[1939,1940,1941,1945,1948,1951,1954,1957,1960],"ul",{},[1942,1943,1944],"li",{},"A scoring algorithm to be more fair who makes it onto the nice list",[1942,1946,1947],{},"An actual Nice list page to see which devs are in Santa’s good graces",[1942,1949,1950],{},"Roast a friend mode with suggestions from your GitHub organization",[1942,1952,1953],{},"A “Spicyness” Meter to rank the spiciest letters and increase enagement",[1942,1955,1956],{},"An animated naughty or nice “gauge” to build suspense while you wait on the letter",[1942,1958,1959],{},"Dynamic OG images that mimic a personalized letter from Santa to increase sharing",[1942,1961,1962],{},"And the cherry on top – Santa actually reads the letter aloud to you",[1840,1964,1965],{},[1966,1967,1968],"em",{},"We’ll cover some of these features in-depth, but first let’s run the through the tech stack.",[1885,1970,1972],{"id":1971},"the-tech-stack","The Tech Stack 💾",[1840,1974,1975],{},"Let's dive into the fun stuff - the actual tech that powers Santa’s roasts.",[1977,1978,1980],"h3",{"id":1979},"backend-directus","Backend – Directus",[1840,1982,1983],{},"We're using Directus for the backend (shocking, I know 😉). But it's actually a pretty lightweight data model and setup compared to other projects I’ve built. We've got just four collections:",[1985,1986,1990],"pre",{"className":1987,"code":1988,"language":1989,"meta":24,"style":24},"language-md shiki shiki-themes github-light github-light github-dark","// Our main collections\n- profiles (stores all the letters and scores)\n- likes (for that spicy meter!)\n- metrics (for storing calculated metrics on a daily basis)\n- globals (help content, site title, etc.)\n","md",[1991,1992,1993,2002,2012,2020,2028],"code",{"__ignoreMap":24},[1994,1995,1998],"span",{"class":1996,"line":1997},"line",1,[1994,1999,2001],{"class":2000},"sxrX7","// Our main collections\n",[1994,2003,2005,2009],{"class":1996,"line":2004},2,[1994,2006,2008],{"class":2007},"sP4rz","-",[1994,2010,2011],{"class":2000}," profiles (stores all the letters and scores)\n",[1994,2013,2015,2017],{"class":1996,"line":2014},3,[1994,2016,2008],{"class":2007},[1994,2018,2019],{"class":2000}," likes (for that spicy meter!)\n",[1994,2021,2023,2025],{"class":1996,"line":2022},4,[1994,2024,2008],{"class":2007},[1994,2026,2027],{"class":2000}," metrics (for storing calculated metrics on a daily basis)\n",[1994,2029,2031,2033],{"class":1996,"line":2030},5,[1994,2032,2008],{"class":2007},[1994,2034,2035],{"class":2000}," globals (help content, site title, etc.)\n",[1840,2037,2038],{},[1872,2039],{"alt":2040,"src":2041},"Profiles saved in the Salty OS Santa Directus project","/img/os-salty-santa-4.png",[1840,2043,2044,2045,2050],{},"Under the hood, it's all sitting on a PostgreSQL database – hosted on ",[1844,2046,2049],{"href":2047,"rel":2048},"https://directus.cloud",[1848],"Directus Cloud",". Anytime I add a collection or field to my data model, Directus mirrors those changes to Postgres and updates the APIs automatically. Super handy when you're iterating quickly on a project like this.",[1840,2052,2053,2054,2057],{},"All communication to the frontend is through a single Directus user name “Santa’s Helper” (gotta carry the theme 🤣🎅). Santa’s Helper authenticates using a static access token and has a single Access Policy called ",[1991,2055,2056],{},"Elves",".",[1840,2059,2060],{},[1872,2061],{"alt":2062,"src":2063},"Users saved in the Salty OS Santa Directus project","/img/os-salty-santa-5.png",[1840,2065,2066,2067,2069,2070,2073,2074,2077,2078,2081],{},"The ",[1991,2068,2056],{}," policy has create, read, and update permissions on ",[1991,2071,2072],{},"profiles"," and ",[1991,2075,2076],{},"likes",". And also read permissions for the ",[1991,2079,2080],{},"directus_"," system collections in order to generate types using a helper Node script.",[1840,2083,2084],{},[1872,2085],{"alt":2086,"src":2087},"Access policies in the Salty Santa Directus project","/img-salty-santa-6.png",[1840,2089,2090],{},"If you ever use this same pattern, just make sure you’re only using static access tokens for server-to-server comms. You don’t want to expose those to anyone on the frontend because of the elevated permissions that might be attached.",[1977,2092,2094],{"id":2093},"frontend-nuxt","Frontend – Nuxt",[1840,2096,2097,2098,2057],{},"For the frontend, we're running with ",[1844,2099,2102],{"href":2100,"rel":2101},"https://nuxt.com",[1848],"Nuxt",[1840,2104,2105,2106,2111,2112,2073,2117,2122],{},"We're using the alpha version of ",[1844,2107,2110],{"href":2108,"rel":2109},"https://ui.nuxt.com",[1848],"Nuxt UI"," (living dangerously, I know!). It's built on ",[1844,2113,2116],{"href":2114,"rel":2115},"https://www.radix-vue.com/",[1848],"RadixVue",[1844,2118,2121],{"href":2119,"rel":2120},"https://tailwindcss.com/blog/tailwindcss-v4-beta",[1848],"Tailwind CSS v4-beta",". The component library is fantastic - it gave us all these nice little UI pieces that we could customize for our holiday theme.",[1840,2124,2125],{},[1863,2126,2127],{},"Business Logic in Nuxt Server Routes",[1840,2129,2130],{},"We’re using Nuxt Server Routes pretty heavily in this project. They give us these nice, type-safe API endpoints that we proxy to the Directus API. And they add an extra layer of caching that we can leverage to reduce costs and improve performance since things like GitHub profile data don’t need to be realtime.",[1840,2132,2133],{},[1863,2134,2135],{},"Authentication with Nuxt Auth Utils",[1840,2137,2138,2139,2144],{},"Authentication is really simple and handled via a GitHub OAuth app and the ",[1844,2140,2143],{"href":2141,"rel":2142},"https://github.com/atinux/nuxt-auth-utils",[1848],"nuxt-auth-utils"," package.",[1840,2146,2147],{},"We're not storing any sensitive GitHub data - we just need to know who's logged in so we can fetch their public profile data. The package handles all the OAuth flow, session management, and token refresh stuff for us.",[1840,2149,2150],{},"We use session data to personalize the experience. Like when you're writing a letter to Santa, we can pre-fill it with your GitHub info if you're logged in, or show the friend mode UI if you're not.",[1840,2152,2153],{},"The whole auth flow is super smooth:",[2155,2156,2157,2160,2163,2166,2169],"ol",{},[1942,2158,2159],{},"Click \"Sign in with GitHub\"",[1942,2161,2162],{},"GitHub OAuth popup appears",[1942,2164,2165],{},"Authorize the app",[1942,2167,2168],{},"Get redirected back with your session",[1942,2170,2171],{},"Start roasting (or getting roasted by) Santa!",[1840,2173,2174],{},[1863,2175,2176],{},"Why Not Use Directus Auth?",[1840,2178,2179,2180,2182],{},"While Directus has a really robust authentication SSO providers (including GitHub), we deliberately went with ",[1991,2181,2143],{}," for this project. Here's why… we didn't actually need \"real\" user accounts or any of the powerful permission features that Directus provides. We just needed a quick way to say \"hey, this person is logged in with GitHub\" so we could fetch their public profile data.",[1840,2184,2185],{},"Plus, keeping the auth lightweight meant one less thing to configure in our Directus instance, which we're primarily using it as the store for all the letters and likes. Sometimes simpler is better.",[1977,2187,2189],{"id":2188},"the-ai-magic-anthropic-vercel-ai-sdk","The AI Magic – Anthropic + Vercel AI SDK",[1840,2191,2192],{},"For the AI part, we're using Anthropic's Claude 3.5 Sonnet. We actually tested this against a few different LLMs, and Claude just had this perfect balance of snark and humor that really nailed the Santa voice we were going for.",[1840,2194,2195,2196,2201,2202,2205],{},"We're using the ",[1844,2197,2200],{"href":2198,"rel":2199},"https://sdk.vercel.ai/",[1848],"Vercel AI SDK"," to handle our Anthropic API calls, specifically their ",[1991,2203,2204],{},"generateObject"," function which is super handy. Here's an example of how that might look below.",[1985,2207,2211],{"className":2208,"code":2209,"language":2210,"meta":24,"style":24},"language-typescript shiki shiki-themes github-light github-light github-dark","import { z } from 'zod';\nimport { generateObject } from 'ai';\nimport { createAnthropic } from '@ai-sdk/anthropic';\n\n// Schema for the AI Payload to return proper JSON\nexport const aiPayloadSchema = z.object({\n    letter: z.string().min(1), // The letter in Markdown format\n    list: z.enum(['naughty', 'nice']), // The list the user belongs to\n    flagged: z.boolean().optional(), // Was the letter flagged as inappropriate?\n    flagged_reason: z.string().optional(), // Reason for why it was flagged\n});\n\n// Create the Anthropic client\nconst anthropic = createAnthropic({\n    apiKey: config.anthropicApiKey as string,\n});\n\n// Generate the letter\nconst aiResponse = await generateObject({\n    model: anthropic('claude-3-5-sonnet-20240620'),\n    schema: aiPayloadSchema,\n    maxTokens: 8192,\n    messages: [{ role: 'user', content: prompt }],\n});\n","typescript",[1991,2212,2213,2232,2246,2260,2265,2271,2297,2324,2351,2371,2388,2394,2399,2405,2421,2436,2441,2446,2452,2470,2487,2493,2504,2516],{"__ignoreMap":24},[1994,2214,2215,2219,2222,2225,2229],{"class":1996,"line":1997},[1994,2216,2218],{"class":2217},"s8jYJ","import",[1994,2220,2221],{"class":2000}," { z } ",[1994,2223,2224],{"class":2217},"from",[1994,2226,2228],{"class":2227},"sIIMD"," 'zod'",[1994,2230,2231],{"class":2000},";\n",[1994,2233,2234,2236,2239,2241,2244],{"class":1996,"line":2004},[1994,2235,2218],{"class":2217},[1994,2237,2238],{"class":2000}," { generateObject } ",[1994,2240,2224],{"class":2217},[1994,2242,2243],{"class":2227}," 'ai'",[1994,2245,2231],{"class":2000},[1994,2247,2248,2250,2253,2255,2258],{"class":1996,"line":2014},[1994,2249,2218],{"class":2217},[1994,2251,2252],{"class":2000}," { createAnthropic } ",[1994,2254,2224],{"class":2217},[1994,2256,2257],{"class":2227}," '@ai-sdk/anthropic'",[1994,2259,2231],{"class":2000},[1994,2261,2262],{"class":1996,"line":2022},[1994,2263,2264],{"emptyLinePlaceholder":1859},"\n",[1994,2266,2267],{"class":1996,"line":2030},[1994,2268,2270],{"class":2269},"sCsY4","// Schema for the AI Payload to return proper JSON\n",[1994,2272,2274,2277,2280,2284,2287,2290,2294],{"class":1996,"line":2273},6,[1994,2275,2276],{"class":2217},"export",[1994,2278,2279],{"class":2217}," const",[1994,2281,2283],{"class":2282},"sBjJW"," aiPayloadSchema",[1994,2285,2286],{"class":2217}," =",[1994,2288,2289],{"class":2000}," z.",[1994,2291,2293],{"class":2292},"snPdu","object",[1994,2295,2296],{"class":2000},"({\n",[1994,2298,2300,2303,2306,2309,2312,2315,2318,2321],{"class":1996,"line":2299},7,[1994,2301,2302],{"class":2000},"    letter: z.",[1994,2304,2305],{"class":2292},"string",[1994,2307,2308],{"class":2000},"().",[1994,2310,2311],{"class":2292},"min",[1994,2313,2314],{"class":2000},"(",[1994,2316,2317],{"class":2282},"1",[1994,2319,2320],{"class":2000},"), ",[1994,2322,2323],{"class":2269},"// The letter in Markdown format\n",[1994,2325,2327,2330,2333,2336,2339,2342,2345,2348],{"class":1996,"line":2326},8,[1994,2328,2329],{"class":2000},"    list: z.",[1994,2331,2332],{"class":2292},"enum",[1994,2334,2335],{"class":2000},"([",[1994,2337,2338],{"class":2227},"'naughty'",[1994,2340,2341],{"class":2000},", ",[1994,2343,2344],{"class":2227},"'nice'",[1994,2346,2347],{"class":2000},"]), ",[1994,2349,2350],{"class":2269},"// The list the user belongs to\n",[1994,2352,2354,2357,2360,2362,2365,2368],{"class":1996,"line":2353},9,[1994,2355,2356],{"class":2000},"    flagged: z.",[1994,2358,2359],{"class":2292},"boolean",[1994,2361,2308],{"class":2000},[1994,2363,2364],{"class":2292},"optional",[1994,2366,2367],{"class":2000},"(), ",[1994,2369,2370],{"class":2269},"// Was the letter flagged as inappropriate?\n",[1994,2372,2374,2377,2379,2381,2383,2385],{"class":1996,"line":2373},10,[1994,2375,2376],{"class":2000},"    flagged_reason: z.",[1994,2378,2305],{"class":2292},[1994,2380,2308],{"class":2000},[1994,2382,2364],{"class":2292},[1994,2384,2367],{"class":2000},[1994,2386,2387],{"class":2269},"// Reason for why it was flagged\n",[1994,2389,2391],{"class":1996,"line":2390},11,[1994,2392,2393],{"class":2000},"});\n",[1994,2395,2397],{"class":1996,"line":2396},12,[1994,2398,2264],{"emptyLinePlaceholder":1859},[1994,2400,2402],{"class":1996,"line":2401},13,[1994,2403,2404],{"class":2269},"// Create the Anthropic client\n",[1994,2406,2408,2411,2414,2416,2419],{"class":1996,"line":2407},14,[1994,2409,2410],{"class":2217},"const",[1994,2412,2413],{"class":2282}," anthropic",[1994,2415,2286],{"class":2217},[1994,2417,2418],{"class":2292}," createAnthropic",[1994,2420,2296],{"class":2000},[1994,2422,2424,2427,2430,2433],{"class":1996,"line":2423},15,[1994,2425,2426],{"class":2000},"    apiKey: config.anthropicApiKey ",[1994,2428,2429],{"class":2217},"as",[1994,2431,2432],{"class":2282}," string",[1994,2434,2435],{"class":2000},",\n",[1994,2437,2439],{"class":1996,"line":2438},16,[1994,2440,2393],{"class":2000},[1994,2442,2444],{"class":1996,"line":2443},17,[1994,2445,2264],{"emptyLinePlaceholder":1859},[1994,2447,2449],{"class":1996,"line":2448},18,[1994,2450,2451],{"class":2269},"// Generate the letter\n",[1994,2453,2455,2457,2460,2462,2465,2468],{"class":1996,"line":2454},19,[1994,2456,2410],{"class":2217},[1994,2458,2459],{"class":2282}," aiResponse",[1994,2461,2286],{"class":2217},[1994,2463,2464],{"class":2217}," await",[1994,2466,2467],{"class":2292}," generateObject",[1994,2469,2296],{"class":2000},[1994,2471,2473,2476,2479,2481,2484],{"class":1996,"line":2472},20,[1994,2474,2475],{"class":2000},"    model: ",[1994,2477,2478],{"class":2292},"anthropic",[1994,2480,2314],{"class":2000},[1994,2482,2483],{"class":2227},"'claude-3-5-sonnet-20240620'",[1994,2485,2486],{"class":2000},"),\n",[1994,2488,2490],{"class":1996,"line":2489},21,[1994,2491,2492],{"class":2000},"    schema: aiPayloadSchema,\n",[1994,2494,2496,2499,2502],{"class":1996,"line":2495},22,[1994,2497,2498],{"class":2000},"    maxTokens: ",[1994,2500,2501],{"class":2282},"8192",[1994,2503,2435],{"class":2000},[1994,2505,2507,2510,2513],{"class":1996,"line":2506},23,[1994,2508,2509],{"class":2000},"    messages: [{ role: ",[1994,2511,2512],{"class":2227},"'user'",[1994,2514,2515],{"class":2000},", content: prompt }],\n",[1994,2517,2519],{"class":1996,"line":2518},24,[1994,2520,2393],{"class":2000},[1840,2522,2066,2523,2525],{},[1991,2524,2204],{}," method from the Vercel AI forces Claude to return data in exactly the structure we want. We define our schema with Zod, and the SDK makes sure the AI response matches that structure. No more parsing weird JSON strings or weird edge cases dealing with malformed responses.",[1977,2527,2529],{"id":2528},"frontend-hosting-vercel","Frontend Hosting – Vercel",[1840,2531,2532],{},"The frontend is hosted with the big triangle company - Vercel. In my own testing across various Nuxt projects over the last year or two, I’ve found that deploying Nuxt 3 on Vercel usually “just works” more often than other providers. Other providers usually take me a little more time to debug and troubleshoot builds. Cost is definitely a concern though - especially if this thing gets really popular.",[1977,2534,2536],{"id":2535},"the-fun-extras","The Fun Extras",[1840,2538,2539],{},"There’s some other cool additional libraries that add those special touches.",[1939,2541,2542,2552,2562],{},[1942,2543,2544,2551],{},[1844,2545,2548],{"href":2546,"rel":2547},"https://particles.js.org/",[1848],[1863,2549,2550],{},"@tsparticles"," – powers the falling snow effect animation.",[1942,2553,2554,2561],{},[1844,2555,2558],{"href":2556,"rel":2557},"https://github.com/vueuse/sound",[1848],[1863,2559,2560],{},"@vueuse/sound"," – makes it super easy to add sound effects to any Vue.js app.",[1942,2563,2564,2571],{},[1844,2565,2568],{"href":2566,"rel":2567},"https://github.com/micromark/micromark",[1848],[1863,2569,2570],{},"micromark"," – to render markdown coming back from the LLM.",[1840,2573,2574],{},[1966,2575,2576],{},"Next up, let’s deep dive into the actual features.",[1885,2578,2580],{"id":2579},"the-feature-list","The Feature List 🎅",[1977,2582,2584],{"id":2583},"naughty-or-nice-scoring-algorithm","Naughty or Nice scoring algorithm ✅",[1840,2586,2587],{},"The original version relied on the AI Santa to decide whether a developer made it onto the naughty or nice list. The roasts were hilarious but almost everyone was on the naughty list. Which didn’t feel “fair” to those who contribute a lot, so we had to figure out a way to fix it.",[1840,2589,2590],{},"After eliciting feedback from the team and our AI / LLM friends, we came back with this (way over-engineered 😅) algorithm.",[1840,2592,2593],{},[1863,2594,2595],{},"Base Points",[2597,2598,2599,2616],"table",{},[2600,2601,2602],"thead",{},[2603,2604,2605,2611],"tr",{},[2606,2607,2608],"th",{},[1863,2609,2610],{},"Data Point",[2606,2612,2613],{},[1863,2614,2615],{},"Score",[2617,2618,2619,2628,2636,2643,2651,2659,2667],"tbody",{},[2603,2620,2621,2625],{},[2622,2623,2624],"td",{},"Issues",[2622,2626,2627],{},"0.5 pts per issue",[2603,2629,2630,2633],{},[2622,2631,2632],{},"Commits",[2622,2634,2635],{},"1 pts per commit",[2603,2637,2638,2640],{},[2622,2639,270],{},[2622,2641,2642],{},"2 pts per PR",[2603,2644,2645,2648],{},[2622,2646,2647],{},"Code Reviews",[2622,2649,2650],{},"3 pts per review",[2603,2652,2653,2656],{},[2622,2654,2655],{},"Followers",[2622,2657,2658],{},"2 pts per follower",[2603,2660,2661,2664],{},[2622,2662,2663],{},"Stars",[2622,2665,2666],{},"2 pts per star on owned repos",[2603,2668,2669,2672],{},[2622,2670,2671],{},"Sponsorships",[2622,2673,2674],{},"25 points per GitHub sponsorship (where you are the sponsor)",[1840,2676,2677],{},[1863,2678,2679],{},"Modifiers",[1939,2681,2682,2685,2688],{},[1942,2683,2684],{},"Abandoned Forks: -2 points for each forked repository not updated in 6+ months",[1942,2686,2687],{},"Popular Projects: 20% bonus (1.2×) for having any project with >500 stars",[1942,2689,2690],{},"Organization Membership: 10% bonus (1.1×) for being part of GitHub organizations",[1840,2692,2693],{},[1863,2694,2695],{},"Final Score",[1939,2697,2698,2701],{},[1942,2699,2700],{},"Users scoring 500+ points are classified as \"nice\"",[1942,2702,2703],{},"Users scoring below 500 points are classified as \"naughty\"",[1840,2705,2706],{},[1863,2707,2708],{},"Fetching user data with the GitHub GraphQL API",[1840,2710,2711],{},"We needed to grab a lot of different data points to calculate that naughty/nice score - commits, PRs, reviews, issues, followers, organizations, and more. With the GitHub REST API, we’d be making 6-10 separate API calls for each profile to get all the data we needed to properly score a profile..",[1840,2713,2714],{},"With GraphQL, we can get it all in one shot.",[1985,2716,2720],{"className":2717,"code":2718,"language":2719,"meta":24,"style":24},"language-graphql shiki shiki-themes github-light github-light github-dark","query getUserProfile($username: String!) {\n  user(login: $username) {\n    login\n    name\n    location\n    twitterUsername\n    url\n    avatarUrl\n    websiteUrl\n    company\n    bio\n    readme: repository(name: $username) {\n      object(expression: \"HEAD:README.md\") {\n        ... on Blob {\n          text\n        }\n      }\n    }\n    starredRepositories {\n      totalCount\n    }\n    followers {\n      totalCount\n    }\n    following {\n      totalCount\n    }\n    organizations(first: 3, orderBy: {field: CREATED_AT, direction: DESC}) {\n      nodes {\n        name\n        description\n        url\n        avatarUrl\n         membersWithRole(first: 10){\n          nodes{\n            name\n            login\n            avatarUrl\n          }\n        }\n      }\n    }\n    repositories(visibility: PUBLIC, first: 10, ownerAffiliations: OWNER, orderBy: {field: PUSHED_AT, direction: DESC}) {\n      totalCount\n      nodes {\n        forkCount\n        isFork\n        name\n        description\n        descriptionHTML\n        url\n        createdAt\n        stargazerCount\n        issues(states: OPEN) {\n          totalCount\n        }\n        readme: object(expression: \"HEAD:README.md\") {\n          ... on Blob {\n            text\n          }\n        }\n        pushedAt\n        commitComments {\n          totalCount\n        }\n      }\n    }\n    contributionsCollection(\n      from: \"2024-01-01T00:00:00Z\"\n      to: \"2024-12-31T23:59:59Z\"\n    ) {\n      totalRepositoryContributions\n      totalRepositoriesWithContributedIssues\n      totalRepositoriesWithContributedCommits\n      totalCommitContributions\n      totalIssueContributions\n      totalPullRequestContributions\n      totalPullRequestReviewContributions\n    }\n    sponsorshipsAsSponsor(activeOnly: true, first: 100) {\n      totalCount\n    }\n  }\n}\n","graphql",[1991,2721,2722,2747,2763,2768,2773,2778,2783,2788,2793,2798,2803,2808,2829,2846,2860,2865,2870,2875,2880,2887,2892,2896,2903,2907,2911,2919,2924,2929,2975,2983,2989,2995,3001,3007,3025,3034,3040,3046,3052,3058,3063,3068,3073,3130,3135,3142,3148,3154,3159,3164,3170,3175,3181,3187,3205,3211,3216,3236,3248,3254,3259,3264,3270,3278,3283,3288,3293,3298,3307,3318,3329,3335,3341,3347,3353,3359,3365,3371,3377,3382,3409,3414,3419,3425],{"__ignoreMap":24},[1994,2723,2724,2727,2730,2732,2735,2738,2741,2744],{"class":1996,"line":1997},[1994,2725,2726],{"class":2217},"query",[1994,2728,2729],{"class":2292}," getUserProfile",[1994,2731,2314],{"class":2000},[1994,2733,2734],{"class":2007},"$username",[1994,2736,2737],{"class":2000},": ",[1994,2739,2740],{"class":2282},"String",[1994,2742,2743],{"class":2217},"!",[1994,2745,2746],{"class":2000},") {\n",[1994,2748,2749,2752,2754,2757,2759,2761],{"class":1996,"line":2004},[1994,2750,2751],{"class":2007},"  user",[1994,2753,2314],{"class":2000},[1994,2755,2756],{"class":2007},"login",[1994,2758,2737],{"class":2000},[1994,2760,2734],{"class":2007},[1994,2762,2746],{"class":2000},[1994,2764,2765],{"class":1996,"line":2014},[1994,2766,2767],{"class":2007},"    login\n",[1994,2769,2770],{"class":1996,"line":2022},[1994,2771,2772],{"class":2007},"    name\n",[1994,2774,2775],{"class":1996,"line":2030},[1994,2776,2777],{"class":2007},"    location\n",[1994,2779,2780],{"class":1996,"line":2273},[1994,2781,2782],{"class":2007},"    twitterUsername\n",[1994,2784,2785],{"class":1996,"line":2299},[1994,2786,2787],{"class":2007},"    url\n",[1994,2789,2790],{"class":1996,"line":2326},[1994,2791,2792],{"class":2007},"    avatarUrl\n",[1994,2794,2795],{"class":1996,"line":2353},[1994,2796,2797],{"class":2007},"    websiteUrl\n",[1994,2799,2800],{"class":1996,"line":2373},[1994,2801,2802],{"class":2007},"    company\n",[1994,2804,2805],{"class":1996,"line":2390},[1994,2806,2807],{"class":2007},"    bio\n",[1994,2809,2810,2813,2815,2818,2820,2823,2825,2827],{"class":1996,"line":2396},[1994,2811,2812],{"class":2227},"    readme",[1994,2814,2737],{"class":2000},[1994,2816,2817],{"class":2007},"repository",[1994,2819,2314],{"class":2000},[1994,2821,2822],{"class":2007},"name",[1994,2824,2737],{"class":2000},[1994,2826,2734],{"class":2007},[1994,2828,2746],{"class":2000},[1994,2830,2831,2834,2836,2839,2841,2844],{"class":1996,"line":2401},[1994,2832,2833],{"class":2007},"      object",[1994,2835,2314],{"class":2000},[1994,2837,2838],{"class":2007},"expression",[1994,2840,2737],{"class":2000},[1994,2842,2843],{"class":2227},"\"HEAD:README.md\"",[1994,2845,2746],{"class":2000},[1994,2847,2848,2851,2854,2857],{"class":1996,"line":2407},[1994,2849,2850],{"class":2217},"        ...",[1994,2852,2853],{"class":2217}," on",[1994,2855,2856],{"class":2282}," Blob",[1994,2858,2859],{"class":2000}," {\n",[1994,2861,2862],{"class":1996,"line":2423},[1994,2863,2864],{"class":2007},"          text\n",[1994,2866,2867],{"class":1996,"line":2438},[1994,2868,2869],{"class":2000},"        }\n",[1994,2871,2872],{"class":1996,"line":2443},[1994,2873,2874],{"class":2000},"      }\n",[1994,2876,2877],{"class":1996,"line":2448},[1994,2878,2879],{"class":2000},"    }\n",[1994,2881,2882,2885],{"class":1996,"line":2454},[1994,2883,2884],{"class":2007},"    starredRepositories",[1994,2886,2859],{"class":2000},[1994,2888,2889],{"class":1996,"line":2472},[1994,2890,2891],{"class":2007},"      totalCount\n",[1994,2893,2894],{"class":1996,"line":2489},[1994,2895,2879],{"class":2000},[1994,2897,2898,2901],{"class":1996,"line":2495},[1994,2899,2900],{"class":2007},"    followers",[1994,2902,2859],{"class":2000},[1994,2904,2905],{"class":1996,"line":2506},[1994,2906,2891],{"class":2007},[1994,2908,2909],{"class":1996,"line":2518},[1994,2910,2879],{"class":2000},[1994,2912,2914,2917],{"class":1996,"line":2913},25,[1994,2915,2916],{"class":2007},"    following",[1994,2918,2859],{"class":2000},[1994,2920,2922],{"class":1996,"line":2921},26,[1994,2923,2891],{"class":2007},[1994,2925,2927],{"class":1996,"line":2926},27,[1994,2928,2879],{"class":2000},[1994,2930,2932,2935,2937,2940,2942,2945,2947,2950,2953,2956,2959,2962,2964,2967,2969,2972],{"class":1996,"line":2931},28,[1994,2933,2934],{"class":2007},"    organizations",[1994,2936,2314],{"class":2000},[1994,2938,2939],{"class":2007},"first",[1994,2941,2737],{"class":2000},[1994,2943,2944],{"class":2282},"3",[1994,2946,2341],{"class":2000},[1994,2948,2949],{"class":2007},"orderBy",[1994,2951,2952],{"class":2000},": {",[1994,2954,2955],{"class":2227},"field",[1994,2957,2958],{"class":2000},":",[1994,2960,2961],{"class":2282}," CREATED_AT",[1994,2963,2341],{"class":2000},[1994,2965,2966],{"class":2227},"direction",[1994,2968,2958],{"class":2000},[1994,2970,2971],{"class":2282}," DESC",[1994,2973,2974],{"class":2000},"}) {\n",[1994,2976,2978,2981],{"class":1996,"line":2977},29,[1994,2979,2980],{"class":2007},"      nodes",[1994,2982,2859],{"class":2000},[1994,2984,2986],{"class":1996,"line":2985},30,[1994,2987,2988],{"class":2007},"        name\n",[1994,2990,2992],{"class":1996,"line":2991},31,[1994,2993,2994],{"class":2007},"        description\n",[1994,2996,2998],{"class":1996,"line":2997},32,[1994,2999,3000],{"class":2007},"        url\n",[1994,3002,3004],{"class":1996,"line":3003},33,[1994,3005,3006],{"class":2007},"        avatarUrl\n",[1994,3008,3010,3013,3015,3017,3019,3022],{"class":1996,"line":3009},34,[1994,3011,3012],{"class":2007},"         membersWithRole",[1994,3014,2314],{"class":2000},[1994,3016,2939],{"class":2007},[1994,3018,2737],{"class":2000},[1994,3020,3021],{"class":2282},"10",[1994,3023,3024],{"class":2000},"){\n",[1994,3026,3028,3031],{"class":1996,"line":3027},35,[1994,3029,3030],{"class":2007},"          nodes",[1994,3032,3033],{"class":2000},"{\n",[1994,3035,3037],{"class":1996,"line":3036},36,[1994,3038,3039],{"class":2007},"            name\n",[1994,3041,3043],{"class":1996,"line":3042},37,[1994,3044,3045],{"class":2007},"            login\n",[1994,3047,3049],{"class":1996,"line":3048},38,[1994,3050,3051],{"class":2007},"            avatarUrl\n",[1994,3053,3055],{"class":1996,"line":3054},39,[1994,3056,3057],{"class":2000},"          }\n",[1994,3059,3061],{"class":1996,"line":3060},40,[1994,3062,2869],{"class":2000},[1994,3064,3066],{"class":1996,"line":3065},41,[1994,3067,2874],{"class":2000},[1994,3069,3071],{"class":1996,"line":3070},42,[1994,3072,2879],{"class":2000},[1994,3074,3076,3079,3081,3084,3086,3089,3091,3093,3095,3097,3099,3102,3104,3107,3109,3111,3113,3115,3117,3120,3122,3124,3126,3128],{"class":1996,"line":3075},43,[1994,3077,3078],{"class":2007},"    repositories",[1994,3080,2314],{"class":2000},[1994,3082,3083],{"class":2007},"visibility",[1994,3085,2958],{"class":2000},[1994,3087,3088],{"class":2282}," PUBLIC",[1994,3090,2341],{"class":2000},[1994,3092,2939],{"class":2007},[1994,3094,2737],{"class":2000},[1994,3096,3021],{"class":2282},[1994,3098,2341],{"class":2000},[1994,3100,3101],{"class":2007},"ownerAffiliations",[1994,3103,2958],{"class":2000},[1994,3105,3106],{"class":2282}," OWNER",[1994,3108,2341],{"class":2000},[1994,3110,2949],{"class":2007},[1994,3112,2952],{"class":2000},[1994,3114,2955],{"class":2227},[1994,3116,2958],{"class":2000},[1994,3118,3119],{"class":2282}," PUSHED_AT",[1994,3121,2341],{"class":2000},[1994,3123,2966],{"class":2227},[1994,3125,2958],{"class":2000},[1994,3127,2971],{"class":2282},[1994,3129,2974],{"class":2000},[1994,3131,3133],{"class":1996,"line":3132},44,[1994,3134,2891],{"class":2007},[1994,3136,3138,3140],{"class":1996,"line":3137},45,[1994,3139,2980],{"class":2007},[1994,3141,2859],{"class":2000},[1994,3143,3145],{"class":1996,"line":3144},46,[1994,3146,3147],{"class":2007},"        forkCount\n",[1994,3149,3151],{"class":1996,"line":3150},47,[1994,3152,3153],{"class":2007},"        isFork\n",[1994,3155,3157],{"class":1996,"line":3156},48,[1994,3158,2988],{"class":2007},[1994,3160,3162],{"class":1996,"line":3161},49,[1994,3163,2994],{"class":2007},[1994,3165,3167],{"class":1996,"line":3166},50,[1994,3168,3169],{"class":2007},"        descriptionHTML\n",[1994,3171,3173],{"class":1996,"line":3172},51,[1994,3174,3000],{"class":2007},[1994,3176,3178],{"class":1996,"line":3177},52,[1994,3179,3180],{"class":2007},"        createdAt\n",[1994,3182,3184],{"class":1996,"line":3183},53,[1994,3185,3186],{"class":2007},"        stargazerCount\n",[1994,3188,3190,3193,3195,3198,3200,3203],{"class":1996,"line":3189},54,[1994,3191,3192],{"class":2007},"        issues",[1994,3194,2314],{"class":2000},[1994,3196,3197],{"class":2007},"states",[1994,3199,2958],{"class":2000},[1994,3201,3202],{"class":2282}," OPEN",[1994,3204,2746],{"class":2000},[1994,3206,3208],{"class":1996,"line":3207},55,[1994,3209,3210],{"class":2007},"          totalCount\n",[1994,3212,3214],{"class":1996,"line":3213},56,[1994,3215,2869],{"class":2000},[1994,3217,3219,3222,3224,3226,3228,3230,3232,3234],{"class":1996,"line":3218},57,[1994,3220,3221],{"class":2227},"        readme",[1994,3223,2737],{"class":2000},[1994,3225,2293],{"class":2007},[1994,3227,2314],{"class":2000},[1994,3229,2838],{"class":2007},[1994,3231,2737],{"class":2000},[1994,3233,2843],{"class":2227},[1994,3235,2746],{"class":2000},[1994,3237,3239,3242,3244,3246],{"class":1996,"line":3238},58,[1994,3240,3241],{"class":2217},"          ...",[1994,3243,2853],{"class":2217},[1994,3245,2856],{"class":2282},[1994,3247,2859],{"class":2000},[1994,3249,3251],{"class":1996,"line":3250},59,[1994,3252,3253],{"class":2007},"            text\n",[1994,3255,3257],{"class":1996,"line":3256},60,[1994,3258,3057],{"class":2000},[1994,3260,3262],{"class":1996,"line":3261},61,[1994,3263,2869],{"class":2000},[1994,3265,3267],{"class":1996,"line":3266},62,[1994,3268,3269],{"class":2007},"        pushedAt\n",[1994,3271,3273,3276],{"class":1996,"line":3272},63,[1994,3274,3275],{"class":2007},"        commitComments",[1994,3277,2859],{"class":2000},[1994,3279,3281],{"class":1996,"line":3280},64,[1994,3282,3210],{"class":2007},[1994,3284,3286],{"class":1996,"line":3285},65,[1994,3287,2869],{"class":2000},[1994,3289,3291],{"class":1996,"line":3290},66,[1994,3292,2874],{"class":2000},[1994,3294,3296],{"class":1996,"line":3295},67,[1994,3297,2879],{"class":2000},[1994,3299,3301,3304],{"class":1996,"line":3300},68,[1994,3302,3303],{"class":2007},"    contributionsCollection",[1994,3305,3306],{"class":2000},"(\n",[1994,3308,3310,3313,3315],{"class":1996,"line":3309},69,[1994,3311,3312],{"class":2007},"      from",[1994,3314,2737],{"class":2000},[1994,3316,3317],{"class":2227},"\"2024-01-01T00:00:00Z\"\n",[1994,3319,3321,3324,3326],{"class":1996,"line":3320},70,[1994,3322,3323],{"class":2007},"      to",[1994,3325,2737],{"class":2000},[1994,3327,3328],{"class":2227},"\"2024-12-31T23:59:59Z\"\n",[1994,3330,3332],{"class":1996,"line":3331},71,[1994,3333,3334],{"class":2000},"    ) {\n",[1994,3336,3338],{"class":1996,"line":3337},72,[1994,3339,3340],{"class":2007},"      totalRepositoryContributions\n",[1994,3342,3344],{"class":1996,"line":3343},73,[1994,3345,3346],{"class":2007},"      totalRepositoriesWithContributedIssues\n",[1994,3348,3350],{"class":1996,"line":3349},74,[1994,3351,3352],{"class":2007},"      totalRepositoriesWithContributedCommits\n",[1994,3354,3356],{"class":1996,"line":3355},75,[1994,3357,3358],{"class":2007},"      totalCommitContributions\n",[1994,3360,3362],{"class":1996,"line":3361},76,[1994,3363,3364],{"class":2007},"      totalIssueContributions\n",[1994,3366,3368],{"class":1996,"line":3367},77,[1994,3369,3370],{"class":2007},"      totalPullRequestContributions\n",[1994,3372,3374],{"class":1996,"line":3373},78,[1994,3375,3376],{"class":2007},"      totalPullRequestReviewContributions\n",[1994,3378,3380],{"class":1996,"line":3379},79,[1994,3381,2879],{"class":2000},[1994,3383,3385,3388,3390,3393,3395,3398,3400,3402,3404,3407],{"class":1996,"line":3384},80,[1994,3386,3387],{"class":2007},"    sponsorshipsAsSponsor",[1994,3389,2314],{"class":2000},[1994,3391,3392],{"class":2007},"activeOnly",[1994,3394,2737],{"class":2000},[1994,3396,3397],{"class":2282},"true",[1994,3399,2341],{"class":2000},[1994,3401,2939],{"class":2007},[1994,3403,2737],{"class":2000},[1994,3405,3406],{"class":2282},"100",[1994,3408,2746],{"class":2000},[1994,3410,3412],{"class":1996,"line":3411},81,[1994,3413,2891],{"class":2007},[1994,3415,3417],{"class":1996,"line":3416},82,[1994,3418,2879],{"class":2000},[1994,3420,3422],{"class":1996,"line":3421},83,[1994,3423,3424],{"class":2000},"  }\n",[1994,3426,3428],{"class":1996,"line":3427},84,[1994,3429,3430],{"class":2000},"}\n",[1840,3432,3433],{},"The data returned then gets fed into our custom scoring algorithm. Next, the resulting score and profile gets passed to the LLM. And finally the generated letter, score, and metadata is stored in Directus to be retrieved on the frontend.",[1840,3435,3436,3437,3440],{},"Here’s what our complete ",[1991,3438,3439],{},"roast"," Nuxt server endpoint looks like.",[1985,3442,3446],{"className":3443,"code":3444,"language":3445,"meta":24,"style":24},"language-tsx shiki shiki-themes github-light github-light github-dark","// server/api/roast.post.ts\n\nimport { z } from 'zod';\nimport { generateObject } from 'ai';\nimport { createAnthropic } from '@ai-sdk/anthropic';\n\nimport userQuery from '~~/server/graphql/getUserProfile';\nimport orgQuery from '~~/server/graphql/getOrgProfile';\n\nimport type { GitHubUserData } from '~~/server/graphql/getUserProfile';\nimport type { GitHubOrgData } from '~~/server/graphql/getOrgProfile';\nimport type { RoastResponse } from '#shared/types/endpoints.js';\nimport type { H3Error } from 'h3';\n\n// Schema for the AI Payload to return proper JSON\nexport const aiPayloadSchema = z.object({\n    letter: z.string().min(1), // The letter in Markdown format\n    list: z.enum(['naughty', 'nice']), // The list the user belongs to\n    flagged: z.boolean().optional(), // Was the letter flagged as inappropriate?\n    flagged_reason: z.string().optional(), // Reason for why it was flagged\n});\n\n// Schema for the roast endpoint body\nexport const profileSchema = z.object({\n    username: z.string().min(1),\n    wishlist: z.string().optional(),\n    type: z.enum(['user', 'organization']).optional().default('user'),\n    mode: z.enum(['self', 'friend']).optional().default('self'),\n    roasted_by: z.string().optional(),\n    profileType: z.enum(['User', 'Organization']),\n});\n\n// Create the Anthropic client\nconst config = useRuntimeConfig();\nconst anthropic = createAnthropic({\n    apiKey: config.anthropicApiKey as string,\n});\n\nexport default defineEventHandler(async (event): Promise\u003CRoastResponse | H3Error> => {\n    const body = await readValidatedBody(event, (body) => profileSchema.parse(body));\n    const { username, wishlist, mode, roasted_by, profileType } = body;\n\n    // Check to see if the profile already exists in Directus if so, redirect to the profile\n    const [directusResponse] = await directusServer.request(\n        readItems('profiles', { filter: { username: { _eq: username } }, limit: 1 }),\n    );\n\n    if (directusResponse) {\n        return {\n            redirect: `/${username}`,\n        };\n    }\n\n    // Check to see if the user is logged in to GitHub if not, don't allow them to submit a letter to save on costs\n    const session = await requireUserSession(event);\n\n    if (!session) {\n        throw createError({\n            statusCode: 401,\n            message: 'Unauthorized. Please login to submit a letter to Santa.',\n        });\n    }\n\n    try {\n        const variables = { username };\n\n        const response = await $fetch('https://api.github.com/graphql', {\n            method: 'POST',\n            headers: {\n                Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,\n                'Content-Type': 'application/json',\n            },\n            body: {\n                query: profileType === 'User' ? userQuery : orgQuery,\n                variables,\n            },\n        });\n\n        const typedResponse = response as { data: { user?: GitHubUserData; organization?: GitHubOrgData } };\n\n        const profileData =\n            profileType === 'User'\n                ? (typedResponse.data.user as GitHubUserData)\n                : (typedResponse.data.organization as GitHubOrgData);\n\n        // Score the contributions based on the profile type\n        const score = calculateNiceScore(profileData, profileType);\n\n        const prompt = `\n            You are the open source Santa Claus. You determine who's open source contributions are naughty or nice.\n            Analyze the following Github ${profileType === 'User' ? 'user' : 'organization'}'s profile carefully and in detail.\n            We've determined the ${profileType}'s score based on their contributions. Whether they're on the nice list\n            or the naughty list, roast them accordingly. Write a short, funny letter in a snarky sarcastic tone.\n            Include a couple lines from the wish list in the letter if it's provided.\n            If the mode provided is \"friend\", then make a short mention of the roasted_by user in one of the paragraphs.\n\n            STRUCTURE:\n            - Intro\n            - 3 short paragraphs\n            - PS\n\n            RULES:\n            - Do NOT include a signature and like 'Yours, From Santa' in the letter.\n            - The letter should be in Markdown format.\n            - If someone uses profanity or asks for something inappropriate, do not roast them. Set the flagged field to true and provide a reason.\n\n            Wish List: ${wishlist} ${mode === 'friend' ? `Note: Wishlist provided by ${roasted_by}` : ''}\n            Profile: ${JSON.stringify(profileData)}\n            Score: ${score}\n            Mode: ${mode}\n            Roasted By: ${roasted_by}\n        `;\n\n        const aiResponse = await generateObject({\n            model: anthropic('claude-3-5-sonnet-20240620'),\n            schema: aiPayloadSchema,\n            maxTokens: 8192,\n            messages: [{ role: 'user', content: prompt }],\n        });\n\n        // If the user has organizations and membersWithRoles exist, loop through the organizations and add the members to the metadata as possible_roasts\n        const possibleRoasts: any[] = [];\n        if (profileType === 'User' && (profileData as GitHubUserData).organizations?.nodes) {\n            for (const org of (profileData as GitHubUserData).organizations.nodes ?? []) {\n                if (org?.membersWithRole?.nodes) {\n                    possibleRoasts.push(...org.membersWithRole.nodes);\n                }\n            }\n        }\n\n        // Generate metadata to store with the profile\n        const metadata = {\n            ai_usage: aiResponse.usage,\n            ai_response: aiResponse.object,\n            score: score,\n            possible_roasts: possibleRoasts,\n        };\n\n        // Store the profile in Directus\n        const directusResponse = await directusServer.request(\n            createItem('profiles', {\n                username,\n                letter: aiResponse.object.letter,\n                list: score.list,\n                wishlist,\n                mode,\n                score: score.finalScore,\n                roasted_by,\n                metadata,\n                type: profileType,\n            }),\n        );\n\n        return {\n            redirect: `/${username}`,\n            letter: directusResponse.letter,\n            list: directusResponse.list,\n            metadata: directusResponse.metadata,\n            roasted_by: directusResponse.roasted_by,\n            score: directusResponse.score,\n            type: directusResponse.type,\n            mode: directusResponse.mode,\n            username: directusResponse.username,\n            wishlist: directusResponse.wishlist,\n        };\n    } catch (error) {\n        console.error(JSON.stringify(error));\n        throw createError({\n            statusCode: 500,\n            message: 'Failed to roast profile',\n        });\n    }\n});\n\n","tsx",[1991,3447,3448,3453,3457,3469,3481,3493,3497,3511,3525,3529,3545,3560,3576,3592,3596,3600,3616,3634,3652,3666,3680,3684,3688,3693,3710,3727,3741,3773,3804,3817,3837,3841,3845,3849,3864,3876,3886,3890,3894,3943,3978,4017,4021,4026,4051,4069,4074,4078,4086,4093,4108,4113,4117,4121,4126,4143,4147,4158,4168,4178,4188,4193,4197,4201,4208,4221,4225,4247,4257,4262,4287,4299,4304,4309,4330,4335,4339,4343,4347,4393,4397,4407,4417,4432,4447,4452,4458,4474,4479,4492,4498,4522,4533,4539,4545,4551,4556,4562,4568,4574,4580,4585,4591,4597,4603,4609,4614,4646,4669,4680,4690,4700,4708,4713,4728,4742,4748,4758,4768,4773,4778,4784,4805,4831,4862,4871,4888,4894,4900,4905,4910,4916,4928,4934,4940,4946,4952,4957,4962,4968,4986,4998,5004,5010,5016,5022,5028,5034,5040,5046,5052,5058,5064,5069,5076,5089,5095,5101,5107,5113,5119,5125,5131,5137,5143,5148,5160,5180,5189,5199,5209,5214,5219],{"__ignoreMap":24},[1994,3449,3450],{"class":1996,"line":1997},[1994,3451,3452],{"class":2269},"// server/api/roast.post.ts\n",[1994,3454,3455],{"class":1996,"line":2004},[1994,3456,2264],{"emptyLinePlaceholder":1859},[1994,3458,3459,3461,3463,3465,3467],{"class":1996,"line":2014},[1994,3460,2218],{"class":2217},[1994,3462,2221],{"class":2000},[1994,3464,2224],{"class":2217},[1994,3466,2228],{"class":2227},[1994,3468,2231],{"class":2000},[1994,3470,3471,3473,3475,3477,3479],{"class":1996,"line":2022},[1994,3472,2218],{"class":2217},[1994,3474,2238],{"class":2000},[1994,3476,2224],{"class":2217},[1994,3478,2243],{"class":2227},[1994,3480,2231],{"class":2000},[1994,3482,3483,3485,3487,3489,3491],{"class":1996,"line":2030},[1994,3484,2218],{"class":2217},[1994,3486,2252],{"class":2000},[1994,3488,2224],{"class":2217},[1994,3490,2257],{"class":2227},[1994,3492,2231],{"class":2000},[1994,3494,3495],{"class":1996,"line":2273},[1994,3496,2264],{"emptyLinePlaceholder":1859},[1994,3498,3499,3501,3504,3506,3509],{"class":1996,"line":2299},[1994,3500,2218],{"class":2217},[1994,3502,3503],{"class":2000}," userQuery ",[1994,3505,2224],{"class":2217},[1994,3507,3508],{"class":2227}," '~~/server/graphql/getUserProfile'",[1994,3510,2231],{"class":2000},[1994,3512,3513,3515,3518,3520,3523],{"class":1996,"line":2326},[1994,3514,2218],{"class":2217},[1994,3516,3517],{"class":2000}," orgQuery ",[1994,3519,2224],{"class":2217},[1994,3521,3522],{"class":2227}," '~~/server/graphql/getOrgProfile'",[1994,3524,2231],{"class":2000},[1994,3526,3527],{"class":1996,"line":2353},[1994,3528,2264],{"emptyLinePlaceholder":1859},[1994,3530,3531,3533,3536,3539,3541,3543],{"class":1996,"line":2373},[1994,3532,2218],{"class":2217},[1994,3534,3535],{"class":2217}," type",[1994,3537,3538],{"class":2000}," { GitHubUserData } ",[1994,3540,2224],{"class":2217},[1994,3542,3508],{"class":2227},[1994,3544,2231],{"class":2000},[1994,3546,3547,3549,3551,3554,3556,3558],{"class":1996,"line":2390},[1994,3548,2218],{"class":2217},[1994,3550,3535],{"class":2217},[1994,3552,3553],{"class":2000}," { GitHubOrgData } ",[1994,3555,2224],{"class":2217},[1994,3557,3522],{"class":2227},[1994,3559,2231],{"class":2000},[1994,3561,3562,3564,3566,3569,3571,3574],{"class":1996,"line":2396},[1994,3563,2218],{"class":2217},[1994,3565,3535],{"class":2217},[1994,3567,3568],{"class":2000}," { RoastResponse } ",[1994,3570,2224],{"class":2217},[1994,3572,3573],{"class":2227}," '#shared/types/endpoints.js'",[1994,3575,2231],{"class":2000},[1994,3577,3578,3580,3582,3585,3587,3590],{"class":1996,"line":2401},[1994,3579,2218],{"class":2217},[1994,3581,3535],{"class":2217},[1994,3583,3584],{"class":2000}," { H3Error } ",[1994,3586,2224],{"class":2217},[1994,3588,3589],{"class":2227}," 'h3'",[1994,3591,2231],{"class":2000},[1994,3593,3594],{"class":1996,"line":2407},[1994,3595,2264],{"emptyLinePlaceholder":1859},[1994,3597,3598],{"class":1996,"line":2423},[1994,3599,2270],{"class":2269},[1994,3601,3602,3604,3606,3608,3610,3612,3614],{"class":1996,"line":2438},[1994,3603,2276],{"class":2217},[1994,3605,2279],{"class":2217},[1994,3607,2283],{"class":2282},[1994,3609,2286],{"class":2217},[1994,3611,2289],{"class":2000},[1994,3613,2293],{"class":2292},[1994,3615,2296],{"class":2000},[1994,3617,3618,3620,3622,3624,3626,3628,3630,3632],{"class":1996,"line":2443},[1994,3619,2302],{"class":2000},[1994,3621,2305],{"class":2292},[1994,3623,2308],{"class":2000},[1994,3625,2311],{"class":2292},[1994,3627,2314],{"class":2000},[1994,3629,2317],{"class":2282},[1994,3631,2320],{"class":2000},[1994,3633,2323],{"class":2269},[1994,3635,3636,3638,3640,3642,3644,3646,3648,3650],{"class":1996,"line":2448},[1994,3637,2329],{"class":2000},[1994,3639,2332],{"class":2292},[1994,3641,2335],{"class":2000},[1994,3643,2338],{"class":2227},[1994,3645,2341],{"class":2000},[1994,3647,2344],{"class":2227},[1994,3649,2347],{"class":2000},[1994,3651,2350],{"class":2269},[1994,3653,3654,3656,3658,3660,3662,3664],{"class":1996,"line":2454},[1994,3655,2356],{"class":2000},[1994,3657,2359],{"class":2292},[1994,3659,2308],{"class":2000},[1994,3661,2364],{"class":2292},[1994,3663,2367],{"class":2000},[1994,3665,2370],{"class":2269},[1994,3667,3668,3670,3672,3674,3676,3678],{"class":1996,"line":2472},[1994,3669,2376],{"class":2000},[1994,3671,2305],{"class":2292},[1994,3673,2308],{"class":2000},[1994,3675,2364],{"class":2292},[1994,3677,2367],{"class":2000},[1994,3679,2387],{"class":2269},[1994,3681,3682],{"class":1996,"line":2489},[1994,3683,2393],{"class":2000},[1994,3685,3686],{"class":1996,"line":2495},[1994,3687,2264],{"emptyLinePlaceholder":1859},[1994,3689,3690],{"class":1996,"line":2506},[1994,3691,3692],{"class":2269},"// Schema for the roast endpoint body\n",[1994,3694,3695,3697,3699,3702,3704,3706,3708],{"class":1996,"line":2518},[1994,3696,2276],{"class":2217},[1994,3698,2279],{"class":2217},[1994,3700,3701],{"class":2282}," profileSchema",[1994,3703,2286],{"class":2217},[1994,3705,2289],{"class":2000},[1994,3707,2293],{"class":2292},[1994,3709,2296],{"class":2000},[1994,3711,3712,3715,3717,3719,3721,3723,3725],{"class":1996,"line":2913},[1994,3713,3714],{"class":2000},"    username: z.",[1994,3716,2305],{"class":2292},[1994,3718,2308],{"class":2000},[1994,3720,2311],{"class":2292},[1994,3722,2314],{"class":2000},[1994,3724,2317],{"class":2282},[1994,3726,2486],{"class":2000},[1994,3728,3729,3732,3734,3736,3738],{"class":1996,"line":2921},[1994,3730,3731],{"class":2000},"    wishlist: z.",[1994,3733,2305],{"class":2292},[1994,3735,2308],{"class":2000},[1994,3737,2364],{"class":2292},[1994,3739,3740],{"class":2000},"(),\n",[1994,3742,3743,3746,3748,3750,3752,3754,3757,3760,3762,3764,3767,3769,3771],{"class":1996,"line":2926},[1994,3744,3745],{"class":2000},"    type: z.",[1994,3747,2332],{"class":2292},[1994,3749,2335],{"class":2000},[1994,3751,2512],{"class":2227},[1994,3753,2341],{"class":2000},[1994,3755,3756],{"class":2227},"'organization'",[1994,3758,3759],{"class":2000},"]).",[1994,3761,2364],{"class":2292},[1994,3763,2308],{"class":2000},[1994,3765,3766],{"class":2292},"default",[1994,3768,2314],{"class":2000},[1994,3770,2512],{"class":2227},[1994,3772,2486],{"class":2000},[1994,3774,3775,3778,3780,3782,3785,3787,3790,3792,3794,3796,3798,3800,3802],{"class":1996,"line":2931},[1994,3776,3777],{"class":2000},"    mode: z.",[1994,3779,2332],{"class":2292},[1994,3781,2335],{"class":2000},[1994,3783,3784],{"class":2227},"'self'",[1994,3786,2341],{"class":2000},[1994,3788,3789],{"class":2227},"'friend'",[1994,3791,3759],{"class":2000},[1994,3793,2364],{"class":2292},[1994,3795,2308],{"class":2000},[1994,3797,3766],{"class":2292},[1994,3799,2314],{"class":2000},[1994,3801,3784],{"class":2227},[1994,3803,2486],{"class":2000},[1994,3805,3806,3809,3811,3813,3815],{"class":1996,"line":2977},[1994,3807,3808],{"class":2000},"    roasted_by: z.",[1994,3810,2305],{"class":2292},[1994,3812,2308],{"class":2000},[1994,3814,2364],{"class":2292},[1994,3816,3740],{"class":2000},[1994,3818,3819,3822,3824,3826,3829,3831,3834],{"class":1996,"line":2985},[1994,3820,3821],{"class":2000},"    profileType: z.",[1994,3823,2332],{"class":2292},[1994,3825,2335],{"class":2000},[1994,3827,3828],{"class":2227},"'User'",[1994,3830,2341],{"class":2000},[1994,3832,3833],{"class":2227},"'Organization'",[1994,3835,3836],{"class":2000},"]),\n",[1994,3838,3839],{"class":1996,"line":2991},[1994,3840,2393],{"class":2000},[1994,3842,3843],{"class":1996,"line":2997},[1994,3844,2264],{"emptyLinePlaceholder":1859},[1994,3846,3847],{"class":1996,"line":3003},[1994,3848,2404],{"class":2269},[1994,3850,3851,3853,3856,3858,3861],{"class":1996,"line":3009},[1994,3852,2410],{"class":2217},[1994,3854,3855],{"class":2282}," config",[1994,3857,2286],{"class":2217},[1994,3859,3860],{"class":2292}," useRuntimeConfig",[1994,3862,3863],{"class":2000},"();\n",[1994,3865,3866,3868,3870,3872,3874],{"class":1996,"line":3027},[1994,3867,2410],{"class":2217},[1994,3869,2413],{"class":2282},[1994,3871,2286],{"class":2217},[1994,3873,2418],{"class":2292},[1994,3875,2296],{"class":2000},[1994,3877,3878,3880,3882,3884],{"class":1996,"line":3036},[1994,3879,2426],{"class":2000},[1994,3881,2429],{"class":2217},[1994,3883,2432],{"class":2282},[1994,3885,2435],{"class":2000},[1994,3887,3888],{"class":1996,"line":3042},[1994,3889,2393],{"class":2000},[1994,3891,3892],{"class":1996,"line":3048},[1994,3893,2264],{"emptyLinePlaceholder":1859},[1994,3895,3896,3898,3901,3904,3906,3909,3912,3915,3918,3920,3923,3926,3929,3932,3935,3938,3941],{"class":1996,"line":3054},[1994,3897,2276],{"class":2217},[1994,3899,3900],{"class":2217}," default",[1994,3902,3903],{"class":2292}," defineEventHandler",[1994,3905,2314],{"class":2000},[1994,3907,3908],{"class":2217},"async",[1994,3910,3911],{"class":2000}," (",[1994,3913,3914],{"class":2007},"event",[1994,3916,3917],{"class":2000},")",[1994,3919,2958],{"class":2217},[1994,3921,3922],{"class":2292}," Promise",[1994,3924,3925],{"class":2000},"\u003C",[1994,3927,3928],{"class":2292},"RoastResponse",[1994,3930,3931],{"class":2217}," |",[1994,3933,3934],{"class":2292}," H3Error",[1994,3936,3937],{"class":2000},"> ",[1994,3939,3940],{"class":2217},"=>",[1994,3942,2859],{"class":2000},[1994,3944,3945,3948,3951,3953,3955,3958,3961,3964,3967,3969,3972,3975],{"class":1996,"line":3060},[1994,3946,3947],{"class":2217},"    const",[1994,3949,3950],{"class":2282}," body",[1994,3952,2286],{"class":2217},[1994,3954,2464],{"class":2217},[1994,3956,3957],{"class":2292}," readValidatedBody",[1994,3959,3960],{"class":2000},"(event, (",[1994,3962,3963],{"class":2007},"body",[1994,3965,3966],{"class":2000},") ",[1994,3968,3940],{"class":2217},[1994,3970,3971],{"class":2000}," profileSchema.",[1994,3973,3974],{"class":2292},"parse",[1994,3976,3977],{"class":2000},"(body));\n",[1994,3979,3980,3982,3985,3988,3990,3993,3995,3998,4000,4003,4005,4008,4011,4014],{"class":1996,"line":3065},[1994,3981,3947],{"class":2217},[1994,3983,3984],{"class":2000}," { ",[1994,3986,3987],{"class":2282},"username",[1994,3989,2341],{"class":2000},[1994,3991,3992],{"class":2282},"wishlist",[1994,3994,2341],{"class":2000},[1994,3996,3997],{"class":2282},"mode",[1994,3999,2341],{"class":2000},[1994,4001,4002],{"class":2282},"roasted_by",[1994,4004,2341],{"class":2000},[1994,4006,4007],{"class":2282},"profileType",[1994,4009,4010],{"class":2000}," } ",[1994,4012,4013],{"class":2217},"=",[1994,4015,4016],{"class":2000}," body;\n",[1994,4018,4019],{"class":1996,"line":3070},[1994,4020,2264],{"emptyLinePlaceholder":1859},[1994,4022,4023],{"class":1996,"line":3075},[1994,4024,4025],{"class":2269},"    // Check to see if the profile already exists in Directus if so, redirect to the profile\n",[1994,4027,4028,4030,4033,4036,4039,4041,4043,4046,4049],{"class":1996,"line":3132},[1994,4029,3947],{"class":2217},[1994,4031,4032],{"class":2000}," [",[1994,4034,4035],{"class":2282},"directusResponse",[1994,4037,4038],{"class":2000},"] ",[1994,4040,4013],{"class":2217},[1994,4042,2464],{"class":2217},[1994,4044,4045],{"class":2000}," directusServer.",[1994,4047,4048],{"class":2292},"request",[1994,4050,3306],{"class":2000},[1994,4052,4053,4056,4058,4061,4064,4066],{"class":1996,"line":3137},[1994,4054,4055],{"class":2292},"        readItems",[1994,4057,2314],{"class":2000},[1994,4059,4060],{"class":2227},"'profiles'",[1994,4062,4063],{"class":2000},", { filter: { username: { _eq: username } }, limit: ",[1994,4065,2317],{"class":2282},[1994,4067,4068],{"class":2000}," }),\n",[1994,4070,4071],{"class":1996,"line":3144},[1994,4072,4073],{"class":2000},"    );\n",[1994,4075,4076],{"class":1996,"line":3150},[1994,4077,2264],{"emptyLinePlaceholder":1859},[1994,4079,4080,4083],{"class":1996,"line":3156},[1994,4081,4082],{"class":2217},"    if",[1994,4084,4085],{"class":2000}," (directusResponse) {\n",[1994,4087,4088,4091],{"class":1996,"line":3161},[1994,4089,4090],{"class":2217},"        return",[1994,4092,2859],{"class":2000},[1994,4094,4095,4098,4101,4103,4106],{"class":1996,"line":3166},[1994,4096,4097],{"class":2000},"            redirect: ",[1994,4099,4100],{"class":2227},"`/${",[1994,4102,3987],{"class":2000},[1994,4104,4105],{"class":2227},"}`",[1994,4107,2435],{"class":2000},[1994,4109,4110],{"class":1996,"line":3172},[1994,4111,4112],{"class":2000},"        };\n",[1994,4114,4115],{"class":1996,"line":3177},[1994,4116,2879],{"class":2000},[1994,4118,4119],{"class":1996,"line":3183},[1994,4120,2264],{"emptyLinePlaceholder":1859},[1994,4122,4123],{"class":1996,"line":3189},[1994,4124,4125],{"class":2269},"    // Check to see if the user is logged in to GitHub if not, don't allow them to submit a letter to save on costs\n",[1994,4127,4128,4130,4133,4135,4137,4140],{"class":1996,"line":3207},[1994,4129,3947],{"class":2217},[1994,4131,4132],{"class":2282}," session",[1994,4134,2286],{"class":2217},[1994,4136,2464],{"class":2217},[1994,4138,4139],{"class":2292}," requireUserSession",[1994,4141,4142],{"class":2000},"(event);\n",[1994,4144,4145],{"class":1996,"line":3213},[1994,4146,2264],{"emptyLinePlaceholder":1859},[1994,4148,4149,4151,4153,4155],{"class":1996,"line":3218},[1994,4150,4082],{"class":2217},[1994,4152,3911],{"class":2000},[1994,4154,2743],{"class":2217},[1994,4156,4157],{"class":2000},"session) {\n",[1994,4159,4160,4163,4166],{"class":1996,"line":3238},[1994,4161,4162],{"class":2217},"        throw",[1994,4164,4165],{"class":2292}," createError",[1994,4167,2296],{"class":2000},[1994,4169,4170,4173,4176],{"class":1996,"line":3250},[1994,4171,4172],{"class":2000},"            statusCode: ",[1994,4174,4175],{"class":2282},"401",[1994,4177,2435],{"class":2000},[1994,4179,4180,4183,4186],{"class":1996,"line":3256},[1994,4181,4182],{"class":2000},"            message: ",[1994,4184,4185],{"class":2227},"'Unauthorized. Please login to submit a letter to Santa.'",[1994,4187,2435],{"class":2000},[1994,4189,4190],{"class":1996,"line":3261},[1994,4191,4192],{"class":2000},"        });\n",[1994,4194,4195],{"class":1996,"line":3266},[1994,4196,2879],{"class":2000},[1994,4198,4199],{"class":1996,"line":3272},[1994,4200,2264],{"emptyLinePlaceholder":1859},[1994,4202,4203,4206],{"class":1996,"line":3280},[1994,4204,4205],{"class":2217},"    try",[1994,4207,2859],{"class":2000},[1994,4209,4210,4213,4216,4218],{"class":1996,"line":3285},[1994,4211,4212],{"class":2217},"        const",[1994,4214,4215],{"class":2282}," variables",[1994,4217,2286],{"class":2217},[1994,4219,4220],{"class":2000}," { username };\n",[1994,4222,4223],{"class":1996,"line":3290},[1994,4224,2264],{"emptyLinePlaceholder":1859},[1994,4226,4227,4229,4232,4234,4236,4239,4241,4244],{"class":1996,"line":3295},[1994,4228,4212],{"class":2217},[1994,4230,4231],{"class":2282}," response",[1994,4233,2286],{"class":2217},[1994,4235,2464],{"class":2217},[1994,4237,4238],{"class":2292}," $fetch",[1994,4240,2314],{"class":2000},[1994,4242,4243],{"class":2227},"'https://api.github.com/graphql'",[1994,4245,4246],{"class":2000},", {\n",[1994,4248,4249,4252,4255],{"class":1996,"line":3300},[1994,4250,4251],{"class":2000},"            method: ",[1994,4253,4254],{"class":2227},"'POST'",[1994,4256,2435],{"class":2000},[1994,4258,4259],{"class":1996,"line":3309},[1994,4260,4261],{"class":2000},"            headers: {\n",[1994,4263,4264,4267,4270,4273,4275,4278,4280,4283,4285],{"class":1996,"line":3320},[1994,4265,4266],{"class":2000},"                Authorization: ",[1994,4268,4269],{"class":2227},"`Bearer ${",[1994,4271,4272],{"class":2000},"process",[1994,4274,2057],{"class":2227},[1994,4276,4277],{"class":2000},"env",[1994,4279,2057],{"class":2227},[1994,4281,4282],{"class":2282},"GITHUB_TOKEN",[1994,4284,4105],{"class":2227},[1994,4286,2435],{"class":2000},[1994,4288,4289,4292,4294,4297],{"class":1996,"line":3331},[1994,4290,4291],{"class":2227},"                'Content-Type'",[1994,4293,2737],{"class":2000},[1994,4295,4296],{"class":2227},"'application/json'",[1994,4298,2435],{"class":2000},[1994,4300,4301],{"class":1996,"line":3337},[1994,4302,4303],{"class":2000},"            },\n",[1994,4305,4306],{"class":1996,"line":3343},[1994,4307,4308],{"class":2000},"            body: {\n",[1994,4310,4311,4314,4317,4320,4323,4325,4327],{"class":1996,"line":3349},[1994,4312,4313],{"class":2000},"                query: profileType ",[1994,4315,4316],{"class":2217},"===",[1994,4318,4319],{"class":2227}," 'User'",[1994,4321,4322],{"class":2217}," ?",[1994,4324,3503],{"class":2000},[1994,4326,2958],{"class":2217},[1994,4328,4329],{"class":2000}," orgQuery,\n",[1994,4331,4332],{"class":1996,"line":3355},[1994,4333,4334],{"class":2000},"                variables,\n",[1994,4336,4337],{"class":1996,"line":3361},[1994,4338,4303],{"class":2000},[1994,4340,4341],{"class":1996,"line":3367},[1994,4342,4192],{"class":2000},[1994,4344,4345],{"class":1996,"line":3373},[1994,4346,2264],{"emptyLinePlaceholder":1859},[1994,4348,4349,4351,4354,4356,4359,4361,4363,4366,4368,4370,4373,4376,4379,4382,4385,4387,4390],{"class":1996,"line":3379},[1994,4350,4212],{"class":2217},[1994,4352,4353],{"class":2282}," typedResponse",[1994,4355,2286],{"class":2217},[1994,4357,4358],{"class":2000}," response ",[1994,4360,2429],{"class":2217},[1994,4362,3984],{"class":2000},[1994,4364,4365],{"class":2007},"data",[1994,4367,2958],{"class":2217},[1994,4369,3984],{"class":2000},[1994,4371,4372],{"class":2007},"user",[1994,4374,4375],{"class":2217},"?:",[1994,4377,4378],{"class":2292}," GitHubUserData",[1994,4380,4381],{"class":2000},"; ",[1994,4383,4384],{"class":2007},"organization",[1994,4386,4375],{"class":2217},[1994,4388,4389],{"class":2292}," GitHubOrgData",[1994,4391,4392],{"class":2000}," } };\n",[1994,4394,4395],{"class":1996,"line":3384},[1994,4396,2264],{"emptyLinePlaceholder":1859},[1994,4398,4399,4401,4404],{"class":1996,"line":3411},[1994,4400,4212],{"class":2217},[1994,4402,4403],{"class":2282}," profileData",[1994,4405,4406],{"class":2217}," =\n",[1994,4408,4409,4412,4414],{"class":1996,"line":3416},[1994,4410,4411],{"class":2000},"            profileType ",[1994,4413,4316],{"class":2217},[1994,4415,4416],{"class":2227}," 'User'\n",[1994,4418,4419,4422,4425,4427,4429],{"class":1996,"line":3421},[1994,4420,4421],{"class":2217},"                ?",[1994,4423,4424],{"class":2000}," (typedResponse.data.user ",[1994,4426,2429],{"class":2217},[1994,4428,4378],{"class":2292},[1994,4430,4431],{"class":2000},")\n",[1994,4433,4434,4437,4440,4442,4444],{"class":1996,"line":3427},[1994,4435,4436],{"class":2217},"                :",[1994,4438,4439],{"class":2000}," (typedResponse.data.organization ",[1994,4441,2429],{"class":2217},[1994,4443,4389],{"class":2292},[1994,4445,4446],{"class":2000},");\n",[1994,4448,4450],{"class":1996,"line":4449},85,[1994,4451,2264],{"emptyLinePlaceholder":1859},[1994,4453,4455],{"class":1996,"line":4454},86,[1994,4456,4457],{"class":2269},"        // Score the contributions based on the profile type\n",[1994,4459,4461,4463,4466,4468,4471],{"class":1996,"line":4460},87,[1994,4462,4212],{"class":2217},[1994,4464,4465],{"class":2282}," score",[1994,4467,2286],{"class":2217},[1994,4469,4470],{"class":2292}," calculateNiceScore",[1994,4472,4473],{"class":2000},"(profileData, profileType);\n",[1994,4475,4477],{"class":1996,"line":4476},88,[1994,4478,2264],{"emptyLinePlaceholder":1859},[1994,4480,4482,4484,4487,4489],{"class":1996,"line":4481},89,[1994,4483,4212],{"class":2217},[1994,4485,4486],{"class":2282}," prompt",[1994,4488,2286],{"class":2217},[1994,4490,4491],{"class":2227}," `\n",[1994,4493,4495],{"class":1996,"line":4494},90,[1994,4496,4497],{"class":2227},"            You are the open source Santa Claus. You determine who's open source contributions are naughty or nice.\n",[1994,4499,4501,4504,4506,4509,4511,4513,4516,4519],{"class":1996,"line":4500},91,[1994,4502,4503],{"class":2227},"            Analyze the following Github ${",[1994,4505,4007],{"class":2000},[1994,4507,4508],{"class":2217}," ===",[1994,4510,4319],{"class":2227},[1994,4512,4322],{"class":2217},[1994,4514,4515],{"class":2227}," 'user'",[1994,4517,4518],{"class":2217}," :",[1994,4520,4521],{"class":2227}," 'organization'}'s profile carefully and in detail.\n",[1994,4523,4525,4528,4530],{"class":1996,"line":4524},92,[1994,4526,4527],{"class":2227},"            We've determined the ${",[1994,4529,4007],{"class":2000},[1994,4531,4532],{"class":2227},"}'s score based on their contributions. Whether they're on the nice list\n",[1994,4534,4536],{"class":1996,"line":4535},93,[1994,4537,4538],{"class":2227},"            or the naughty list, roast them accordingly. Write a short, funny letter in a snarky sarcastic tone.\n",[1994,4540,4542],{"class":1996,"line":4541},94,[1994,4543,4544],{"class":2227},"            Include a couple lines from the wish list in the letter if it's provided.\n",[1994,4546,4548],{"class":1996,"line":4547},95,[1994,4549,4550],{"class":2227},"            If the mode provided is \"friend\", then make a short mention of the roasted_by user in one of the paragraphs.\n",[1994,4552,4554],{"class":1996,"line":4553},96,[1994,4555,2264],{"emptyLinePlaceholder":1859},[1994,4557,4559],{"class":1996,"line":4558},97,[1994,4560,4561],{"class":2227},"            STRUCTURE:\n",[1994,4563,4565],{"class":1996,"line":4564},98,[1994,4566,4567],{"class":2227},"            - Intro\n",[1994,4569,4571],{"class":1996,"line":4570},99,[1994,4572,4573],{"class":2227},"            - 3 short paragraphs\n",[1994,4575,4577],{"class":1996,"line":4576},100,[1994,4578,4579],{"class":2227},"            - PS\n",[1994,4581,4583],{"class":1996,"line":4582},101,[1994,4584,2264],{"emptyLinePlaceholder":1859},[1994,4586,4588],{"class":1996,"line":4587},102,[1994,4589,4590],{"class":2227},"            RULES:\n",[1994,4592,4594],{"class":1996,"line":4593},103,[1994,4595,4596],{"class":2227},"            - Do NOT include a signature and like 'Yours, From Santa' in the letter.\n",[1994,4598,4600],{"class":1996,"line":4599},104,[1994,4601,4602],{"class":2227},"            - The letter should be in Markdown format.\n",[1994,4604,4606],{"class":1996,"line":4605},105,[1994,4607,4608],{"class":2227},"            - If someone uses profanity or asks for something inappropriate, do not roast them. Set the flagged field to true and provide a reason.\n",[1994,4610,4612],{"class":1996,"line":4611},106,[1994,4613,2264],{"emptyLinePlaceholder":1859},[1994,4615,4617,4620,4622,4625,4627,4629,4632,4634,4637,4639,4641,4643],{"class":1996,"line":4616},107,[1994,4618,4619],{"class":2227},"            Wish List: ${",[1994,4621,3992],{"class":2000},[1994,4623,4624],{"class":2227},"} ${",[1994,4626,3997],{"class":2000},[1994,4628,4508],{"class":2217},[1994,4630,4631],{"class":2227}," 'friend'",[1994,4633,4322],{"class":2217},[1994,4635,4636],{"class":2227}," `Note: Wishlist provided by ${",[1994,4638,4002],{"class":2000},[1994,4640,4105],{"class":2227},[1994,4642,4518],{"class":2217},[1994,4644,4645],{"class":2227}," ''}\n",[1994,4647,4649,4652,4655,4657,4660,4662,4665,4667],{"class":1996,"line":4648},108,[1994,4650,4651],{"class":2227},"            Profile: ${",[1994,4653,4654],{"class":2282},"JSON",[1994,4656,2057],{"class":2227},[1994,4658,4659],{"class":2292},"stringify",[1994,4661,2314],{"class":2227},[1994,4663,4664],{"class":2000},"profileData",[1994,4666,3917],{"class":2227},[1994,4668,3430],{"class":2227},[1994,4670,4672,4675,4678],{"class":1996,"line":4671},109,[1994,4673,4674],{"class":2227},"            Score: ${",[1994,4676,4677],{"class":2000},"score",[1994,4679,3430],{"class":2227},[1994,4681,4683,4686,4688],{"class":1996,"line":4682},110,[1994,4684,4685],{"class":2227},"            Mode: ${",[1994,4687,3997],{"class":2000},[1994,4689,3430],{"class":2227},[1994,4691,4693,4696,4698],{"class":1996,"line":4692},111,[1994,4694,4695],{"class":2227},"            Roasted By: ${",[1994,4697,4002],{"class":2000},[1994,4699,3430],{"class":2227},[1994,4701,4703,4706],{"class":1996,"line":4702},112,[1994,4704,4705],{"class":2227},"        `",[1994,4707,2231],{"class":2000},[1994,4709,4711],{"class":1996,"line":4710},113,[1994,4712,2264],{"emptyLinePlaceholder":1859},[1994,4714,4716,4718,4720,4722,4724,4726],{"class":1996,"line":4715},114,[1994,4717,4212],{"class":2217},[1994,4719,2459],{"class":2282},[1994,4721,2286],{"class":2217},[1994,4723,2464],{"class":2217},[1994,4725,2467],{"class":2292},[1994,4727,2296],{"class":2000},[1994,4729,4731,4734,4736,4738,4740],{"class":1996,"line":4730},115,[1994,4732,4733],{"class":2000},"            model: ",[1994,4735,2478],{"class":2292},[1994,4737,2314],{"class":2000},[1994,4739,2483],{"class":2227},[1994,4741,2486],{"class":2000},[1994,4743,4745],{"class":1996,"line":4744},116,[1994,4746,4747],{"class":2000},"            schema: aiPayloadSchema,\n",[1994,4749,4751,4754,4756],{"class":1996,"line":4750},117,[1994,4752,4753],{"class":2000},"            maxTokens: ",[1994,4755,2501],{"class":2282},[1994,4757,2435],{"class":2000},[1994,4759,4761,4764,4766],{"class":1996,"line":4760},118,[1994,4762,4763],{"class":2000},"            messages: [{ role: ",[1994,4765,2512],{"class":2227},[1994,4767,2515],{"class":2000},[1994,4769,4771],{"class":1996,"line":4770},119,[1994,4772,4192],{"class":2000},[1994,4774,4776],{"class":1996,"line":4775},120,[1994,4777,2264],{"emptyLinePlaceholder":1859},[1994,4779,4781],{"class":1996,"line":4780},121,[1994,4782,4783],{"class":2269},"        // If the user has organizations and membersWithRoles exist, loop through the organizations and add the members to the metadata as possible_roasts\n",[1994,4785,4787,4789,4792,4794,4797,4800,4802],{"class":1996,"line":4786},122,[1994,4788,4212],{"class":2217},[1994,4790,4791],{"class":2282}," possibleRoasts",[1994,4793,2958],{"class":2217},[1994,4795,4796],{"class":2282}," any",[1994,4798,4799],{"class":2000},"[] ",[1994,4801,4013],{"class":2217},[1994,4803,4804],{"class":2000}," [];\n",[1994,4806,4808,4811,4814,4816,4818,4821,4824,4826,4828],{"class":1996,"line":4807},123,[1994,4809,4810],{"class":2217},"        if",[1994,4812,4813],{"class":2000}," (profileType ",[1994,4815,4316],{"class":2217},[1994,4817,4319],{"class":2227},[1994,4819,4820],{"class":2217}," &&",[1994,4822,4823],{"class":2000}," (profileData ",[1994,4825,2429],{"class":2217},[1994,4827,4378],{"class":2292},[1994,4829,4830],{"class":2000},").organizations?.nodes) {\n",[1994,4832,4834,4837,4839,4841,4844,4847,4849,4851,4853,4856,4859],{"class":1996,"line":4833},124,[1994,4835,4836],{"class":2217},"            for",[1994,4838,3911],{"class":2000},[1994,4840,2410],{"class":2217},[1994,4842,4843],{"class":2282}," org",[1994,4845,4846],{"class":2217}," of",[1994,4848,4823],{"class":2000},[1994,4850,2429],{"class":2217},[1994,4852,4378],{"class":2292},[1994,4854,4855],{"class":2000},").organizations.nodes ",[1994,4857,4858],{"class":2217},"??",[1994,4860,4861],{"class":2000}," []) {\n",[1994,4863,4865,4868],{"class":1996,"line":4864},125,[1994,4866,4867],{"class":2217},"                if",[1994,4869,4870],{"class":2000}," (org?.membersWithRole?.nodes) {\n",[1994,4872,4874,4877,4880,4882,4885],{"class":1996,"line":4873},126,[1994,4875,4876],{"class":2000},"                    possibleRoasts.",[1994,4878,4879],{"class":2292},"push",[1994,4881,2314],{"class":2000},[1994,4883,4884],{"class":2217},"...",[1994,4886,4887],{"class":2000},"org.membersWithRole.nodes);\n",[1994,4889,4891],{"class":1996,"line":4890},127,[1994,4892,4893],{"class":2000},"                }\n",[1994,4895,4897],{"class":1996,"line":4896},128,[1994,4898,4899],{"class":2000},"            }\n",[1994,4901,4903],{"class":1996,"line":4902},129,[1994,4904,2869],{"class":2000},[1994,4906,4908],{"class":1996,"line":4907},130,[1994,4909,2264],{"emptyLinePlaceholder":1859},[1994,4911,4913],{"class":1996,"line":4912},131,[1994,4914,4915],{"class":2269},"        // Generate metadata to store with the profile\n",[1994,4917,4919,4921,4924,4926],{"class":1996,"line":4918},132,[1994,4920,4212],{"class":2217},[1994,4922,4923],{"class":2282}," metadata",[1994,4925,2286],{"class":2217},[1994,4927,2859],{"class":2000},[1994,4929,4931],{"class":1996,"line":4930},133,[1994,4932,4933],{"class":2000},"            ai_usage: aiResponse.usage,\n",[1994,4935,4937],{"class":1996,"line":4936},134,[1994,4938,4939],{"class":2000},"            ai_response: aiResponse.object,\n",[1994,4941,4943],{"class":1996,"line":4942},135,[1994,4944,4945],{"class":2000},"            score: score,\n",[1994,4947,4949],{"class":1996,"line":4948},136,[1994,4950,4951],{"class":2000},"            possible_roasts: possibleRoasts,\n",[1994,4953,4955],{"class":1996,"line":4954},137,[1994,4956,4112],{"class":2000},[1994,4958,4960],{"class":1996,"line":4959},138,[1994,4961,2264],{"emptyLinePlaceholder":1859},[1994,4963,4965],{"class":1996,"line":4964},139,[1994,4966,4967],{"class":2269},"        // Store the profile in Directus\n",[1994,4969,4971,4973,4976,4978,4980,4982,4984],{"class":1996,"line":4970},140,[1994,4972,4212],{"class":2217},[1994,4974,4975],{"class":2282}," directusResponse",[1994,4977,2286],{"class":2217},[1994,4979,2464],{"class":2217},[1994,4981,4045],{"class":2000},[1994,4983,4048],{"class":2292},[1994,4985,3306],{"class":2000},[1994,4987,4989,4992,4994,4996],{"class":1996,"line":4988},141,[1994,4990,4991],{"class":2292},"            createItem",[1994,4993,2314],{"class":2000},[1994,4995,4060],{"class":2227},[1994,4997,4246],{"class":2000},[1994,4999,5001],{"class":1996,"line":5000},142,[1994,5002,5003],{"class":2000},"                username,\n",[1994,5005,5007],{"class":1996,"line":5006},143,[1994,5008,5009],{"class":2000},"                letter: aiResponse.object.letter,\n",[1994,5011,5013],{"class":1996,"line":5012},144,[1994,5014,5015],{"class":2000},"                list: score.list,\n",[1994,5017,5019],{"class":1996,"line":5018},145,[1994,5020,5021],{"class":2000},"                wishlist,\n",[1994,5023,5025],{"class":1996,"line":5024},146,[1994,5026,5027],{"class":2000},"                mode,\n",[1994,5029,5031],{"class":1996,"line":5030},147,[1994,5032,5033],{"class":2000},"                score: score.finalScore,\n",[1994,5035,5037],{"class":1996,"line":5036},148,[1994,5038,5039],{"class":2000},"                roasted_by,\n",[1994,5041,5043],{"class":1996,"line":5042},149,[1994,5044,5045],{"class":2000},"                metadata,\n",[1994,5047,5049],{"class":1996,"line":5048},150,[1994,5050,5051],{"class":2000},"                type: profileType,\n",[1994,5053,5055],{"class":1996,"line":5054},151,[1994,5056,5057],{"class":2000},"            }),\n",[1994,5059,5061],{"class":1996,"line":5060},152,[1994,5062,5063],{"class":2000},"        );\n",[1994,5065,5067],{"class":1996,"line":5066},153,[1994,5068,2264],{"emptyLinePlaceholder":1859},[1994,5070,5072,5074],{"class":1996,"line":5071},154,[1994,5073,4090],{"class":2217},[1994,5075,2859],{"class":2000},[1994,5077,5079,5081,5083,5085,5087],{"class":1996,"line":5078},155,[1994,5080,4097],{"class":2000},[1994,5082,4100],{"class":2227},[1994,5084,3987],{"class":2000},[1994,5086,4105],{"class":2227},[1994,5088,2435],{"class":2000},[1994,5090,5092],{"class":1996,"line":5091},156,[1994,5093,5094],{"class":2000},"            letter: directusResponse.letter,\n",[1994,5096,5098],{"class":1996,"line":5097},157,[1994,5099,5100],{"class":2000},"            list: directusResponse.list,\n",[1994,5102,5104],{"class":1996,"line":5103},158,[1994,5105,5106],{"class":2000},"            metadata: directusResponse.metadata,\n",[1994,5108,5110],{"class":1996,"line":5109},159,[1994,5111,5112],{"class":2000},"            roasted_by: directusResponse.roasted_by,\n",[1994,5114,5116],{"class":1996,"line":5115},160,[1994,5117,5118],{"class":2000},"            score: directusResponse.score,\n",[1994,5120,5122],{"class":1996,"line":5121},161,[1994,5123,5124],{"class":2000},"            type: directusResponse.type,\n",[1994,5126,5128],{"class":1996,"line":5127},162,[1994,5129,5130],{"class":2000},"            mode: directusResponse.mode,\n",[1994,5132,5134],{"class":1996,"line":5133},163,[1994,5135,5136],{"class":2000},"            username: directusResponse.username,\n",[1994,5138,5140],{"class":1996,"line":5139},164,[1994,5141,5142],{"class":2000},"            wishlist: directusResponse.wishlist,\n",[1994,5144,5146],{"class":1996,"line":5145},165,[1994,5147,4112],{"class":2000},[1994,5149,5151,5154,5157],{"class":1996,"line":5150},166,[1994,5152,5153],{"class":2000},"    } ",[1994,5155,5156],{"class":2217},"catch",[1994,5158,5159],{"class":2000}," (error) {\n",[1994,5161,5163,5166,5169,5171,5173,5175,5177],{"class":1996,"line":5162},167,[1994,5164,5165],{"class":2000},"        console.",[1994,5167,5168],{"class":2292},"error",[1994,5170,2314],{"class":2000},[1994,5172,4654],{"class":2282},[1994,5174,2057],{"class":2000},[1994,5176,4659],{"class":2292},[1994,5178,5179],{"class":2000},"(error));\n",[1994,5181,5183,5185,5187],{"class":1996,"line":5182},168,[1994,5184,4162],{"class":2217},[1994,5186,4165],{"class":2292},[1994,5188,2296],{"class":2000},[1994,5190,5192,5194,5197],{"class":1996,"line":5191},169,[1994,5193,4172],{"class":2000},[1994,5195,5196],{"class":2282},"500",[1994,5198,2435],{"class":2000},[1994,5200,5202,5204,5207],{"class":1996,"line":5201},170,[1994,5203,4182],{"class":2000},[1994,5205,5206],{"class":2227},"'Failed to roast profile'",[1994,5208,2435],{"class":2000},[1994,5210,5212],{"class":1996,"line":5211},171,[1994,5213,4192],{"class":2000},[1994,5215,5217],{"class":1996,"line":5216},172,[1994,5218,2879],{"class":2000},[1994,5220,5222],{"class":1996,"line":5221},173,[1994,5223,2393],{"class":2000},[1977,5225,5227],{"id":5226},"spicyness-meter","Spicyness Meter ✅",[1840,5229,5230,5231],{},"We wanted a way for users to engage with letters other than their own and cast a vote on the spiciest letters, so we created the spicemeter. You can increase your opinion of the spiciness by left-clicking or decrease by right-clicking. ",[1844,5232,5235],{"href":5233,"rel":5234},"https://www.youtube.com/watch?v=4xgx4k83zzc",[1848],"These go to eleven.",[1840,5237,5238],{},[1872,5239],{"alt":5240,"src":5241},"Level of spicy-ness set to 7","/img/os-salty-santa-11.png",[1840,5243,5244,5245,5250],{},"The inspiration for this was taken from ",[1844,5246,5249],{"href":5247,"rel":5248},"https://www.joshwcomeau.com/",[1848],"Josh Comeau"," and his awesome blog. Instead of a simple like button, there’s an interactive heart button that you can mash up to 16 times.",[1840,5252,5253],{},[1872,5254],{"alt":5255,"src":5256},"Heart button on Josh Comeau's blog","/img/os-salty-santa-10.png",[1840,5258,5259],{},"It seems like such a simple interaction until you factor in that each person should only get X number of likes on any given post. Here’s how it works.",[1939,5261,5262,5269,5272],{},[1942,5263,5264,5265,5268],{},"We get the IP from the request ",[1991,5266,5267],{},"x-forwarded-for"," header",[1942,5270,5271],{},"We keep that secure by creating a hash of the IP.",[1942,5273,5274,5275,5277],{},"We store the hash and the count in our ",[1991,5276,2076],{}," Directus collection to track individual user interactions",[1985,5279,5281],{"className":3443,"code":5280,"language":3445,"meta":24,"style":24},"// server/api/profiles/[username]/likes.post.ts\nimport type { LikesResponse } from '~~/shared/types/endpoints.js';\n\nexport default defineEventHandler(async (event): Promise\u003CLikesResponse> => {\n    const username = getRouterParam(event, 'username');\n\n    if (!username) throw createError({ statusCode: 400, message: 'Missing username. username is required.' });\n\n    const ip =\n        (event.node.req.headers['x-forwarded-for'] as string) ||\n        (event.node.req.headers['x-vercel-forwarded-for'] as string);\n\n    const visitorHash = createVisitorHash(ip, process.env.SALT as string);\n\n    try {\n        // Get existing profile with all likes\n        const existingProfile = await directusServer.request(\n            readItem('profiles', username, {\n                fields: [\n                    'username',\n                    {\n                        likes: ['id', 'visitor_hash', 'profile', 'count'],\n                    },\n                ],\n            }),\n        );\n\n        if (!existingProfile) {\n            throw createError({ statusCode: 404, message: 'Profile not found.' });\n        }\n\n        // Get user's specific like record\n        const userLike = existingProfile.likes?.find(like => like.visitor_hash === visitorHash);\n\n        const body = await readBody(event);\n        const newCount = Math.min(Math.max(body.count || 0, 0), 11);\n\n        let like;\n\n        if (userLike) {\n            // Update existing like record\n            like = await directusServer.request(\n                updateItem('likes', userLike.id, {\n                    profile: existingProfile.username,\n                    count: newCount,\n                }),\n            );\n        } else {\n            // Create new like record\n            like = await directusServer.request(\n                    createItem('likes', {\n                        profile: existingProfile.username,\n                        visitor_hash: visitorHash,\n                        count: newCount,\n                    }),\n            );\n        }\n\n        // Calculate total likes by summing all likes\n        const totalLikes = existingProfile.likes?.reduce((sum, like) => {\n            // If this is the user's like, use the new count\n            if (like.visitor_hash === visitorHash) {\n                return sum + newCount;\n            }\n            return sum + (like.count || 0);\n        }, 0);\n\n        const response: LikesResponse = {\n            username: existingProfile.username,\n            totalLikes: totalLikes || 0,\n            userLikeCount: newCount,\n        };\n\n        return response;\n    } catch (error) {\n        console.error('Error updating like count:', error);\n        throw createError({\n            statusCode: 500,\n            message: 'Failed to update like count.',\n        });\n    }\n});\n\n",[1991,5282,5283,5288,5304,5308,5341,5361,5365,5396,5400,5409,5428,5443,5447,5472,5476,5482,5487,5504,5516,5521,5528,5533,5559,5564,5569,5573,5577,5581,5592,5611,5615,5619,5624,5655,5659,5674,5714,5718,5726,5730,5737,5742,5757,5770,5775,5780,5785,5790,5800,5805,5819,5830,5835,5840,5845,5850,5854,5858,5862,5867,5897,5902,5915,5929,5933,5951,5960,5964,5979,5984,5995,6000,6004,6008,6015,6023,6037,6045,6053,6062,6066,6070],{"__ignoreMap":24},[1994,5284,5285],{"class":1996,"line":1997},[1994,5286,5287],{"class":2269},"// server/api/profiles/[username]/likes.post.ts\n",[1994,5289,5290,5292,5294,5297,5299,5302],{"class":1996,"line":2004},[1994,5291,2218],{"class":2217},[1994,5293,3535],{"class":2217},[1994,5295,5296],{"class":2000}," { LikesResponse } ",[1994,5298,2224],{"class":2217},[1994,5300,5301],{"class":2227}," '~~/shared/types/endpoints.js'",[1994,5303,2231],{"class":2000},[1994,5305,5306],{"class":1996,"line":2014},[1994,5307,2264],{"emptyLinePlaceholder":1859},[1994,5309,5310,5312,5314,5316,5318,5320,5322,5324,5326,5328,5330,5332,5335,5337,5339],{"class":1996,"line":2022},[1994,5311,2276],{"class":2217},[1994,5313,3900],{"class":2217},[1994,5315,3903],{"class":2292},[1994,5317,2314],{"class":2000},[1994,5319,3908],{"class":2217},[1994,5321,3911],{"class":2000},[1994,5323,3914],{"class":2007},[1994,5325,3917],{"class":2000},[1994,5327,2958],{"class":2217},[1994,5329,3922],{"class":2292},[1994,5331,3925],{"class":2000},[1994,5333,5334],{"class":2292},"LikesResponse",[1994,5336,3937],{"class":2000},[1994,5338,3940],{"class":2217},[1994,5340,2859],{"class":2000},[1994,5342,5343,5345,5348,5350,5353,5356,5359],{"class":1996,"line":2030},[1994,5344,3947],{"class":2217},[1994,5346,5347],{"class":2282}," username",[1994,5349,2286],{"class":2217},[1994,5351,5352],{"class":2292}," getRouterParam",[1994,5354,5355],{"class":2000},"(event, ",[1994,5357,5358],{"class":2227},"'username'",[1994,5360,4446],{"class":2000},[1994,5362,5363],{"class":1996,"line":2273},[1994,5364,2264],{"emptyLinePlaceholder":1859},[1994,5366,5367,5369,5371,5373,5376,5379,5381,5384,5387,5390,5393],{"class":1996,"line":2299},[1994,5368,4082],{"class":2217},[1994,5370,3911],{"class":2000},[1994,5372,2743],{"class":2217},[1994,5374,5375],{"class":2000},"username) ",[1994,5377,5378],{"class":2217},"throw",[1994,5380,4165],{"class":2292},[1994,5382,5383],{"class":2000},"({ statusCode: ",[1994,5385,5386],{"class":2282},"400",[1994,5388,5389],{"class":2000},", message: ",[1994,5391,5392],{"class":2227},"'Missing username. username is required.'",[1994,5394,5395],{"class":2000}," });\n",[1994,5397,5398],{"class":1996,"line":2326},[1994,5399,2264],{"emptyLinePlaceholder":1859},[1994,5401,5402,5404,5407],{"class":1996,"line":2353},[1994,5403,3947],{"class":2217},[1994,5405,5406],{"class":2282}," ip",[1994,5408,4406],{"class":2217},[1994,5410,5411,5414,5417,5419,5421,5423,5425],{"class":1996,"line":2373},[1994,5412,5413],{"class":2000},"        (event.node.req.headers[",[1994,5415,5416],{"class":2227},"'x-forwarded-for'",[1994,5418,4038],{"class":2000},[1994,5420,2429],{"class":2217},[1994,5422,2432],{"class":2282},[1994,5424,3966],{"class":2000},[1994,5426,5427],{"class":2217},"||\n",[1994,5429,5430,5432,5435,5437,5439,5441],{"class":1996,"line":2390},[1994,5431,5413],{"class":2000},[1994,5433,5434],{"class":2227},"'x-vercel-forwarded-for'",[1994,5436,4038],{"class":2000},[1994,5438,2429],{"class":2217},[1994,5440,2432],{"class":2282},[1994,5442,4446],{"class":2000},[1994,5444,5445],{"class":1996,"line":2396},[1994,5446,2264],{"emptyLinePlaceholder":1859},[1994,5448,5449,5451,5454,5456,5459,5462,5465,5468,5470],{"class":1996,"line":2401},[1994,5450,3947],{"class":2217},[1994,5452,5453],{"class":2282}," visitorHash",[1994,5455,2286],{"class":2217},[1994,5457,5458],{"class":2292}," createVisitorHash",[1994,5460,5461],{"class":2000},"(ip, process.env.",[1994,5463,5464],{"class":2282},"SALT",[1994,5466,5467],{"class":2217}," as",[1994,5469,2432],{"class":2282},[1994,5471,4446],{"class":2000},[1994,5473,5474],{"class":1996,"line":2407},[1994,5475,2264],{"emptyLinePlaceholder":1859},[1994,5477,5478,5480],{"class":1996,"line":2423},[1994,5479,4205],{"class":2217},[1994,5481,2859],{"class":2000},[1994,5483,5484],{"class":1996,"line":2438},[1994,5485,5486],{"class":2269},"        // Get existing profile with all likes\n",[1994,5488,5489,5491,5494,5496,5498,5500,5502],{"class":1996,"line":2443},[1994,5490,4212],{"class":2217},[1994,5492,5493],{"class":2282}," existingProfile",[1994,5495,2286],{"class":2217},[1994,5497,2464],{"class":2217},[1994,5499,4045],{"class":2000},[1994,5501,4048],{"class":2292},[1994,5503,3306],{"class":2000},[1994,5505,5506,5509,5511,5513],{"class":1996,"line":2448},[1994,5507,5508],{"class":2292},"            readItem",[1994,5510,2314],{"class":2000},[1994,5512,4060],{"class":2227},[1994,5514,5515],{"class":2000},", username, {\n",[1994,5517,5518],{"class":1996,"line":2454},[1994,5519,5520],{"class":2000},"                fields: [\n",[1994,5522,5523,5526],{"class":1996,"line":2472},[1994,5524,5525],{"class":2227},"                    'username'",[1994,5527,2435],{"class":2000},[1994,5529,5530],{"class":1996,"line":2489},[1994,5531,5532],{"class":2000},"                    {\n",[1994,5534,5535,5538,5541,5543,5546,5548,5551,5553,5556],{"class":1996,"line":2495},[1994,5536,5537],{"class":2000},"                        likes: [",[1994,5539,5540],{"class":2227},"'id'",[1994,5542,2341],{"class":2000},[1994,5544,5545],{"class":2227},"'visitor_hash'",[1994,5547,2341],{"class":2000},[1994,5549,5550],{"class":2227},"'profile'",[1994,5552,2341],{"class":2000},[1994,5554,5555],{"class":2227},"'count'",[1994,5557,5558],{"class":2000},"],\n",[1994,5560,5561],{"class":1996,"line":2506},[1994,5562,5563],{"class":2000},"                    },\n",[1994,5565,5566],{"class":1996,"line":2518},[1994,5567,5568],{"class":2000},"                ],\n",[1994,5570,5571],{"class":1996,"line":2913},[1994,5572,5057],{"class":2000},[1994,5574,5575],{"class":1996,"line":2921},[1994,5576,5063],{"class":2000},[1994,5578,5579],{"class":1996,"line":2926},[1994,5580,2264],{"emptyLinePlaceholder":1859},[1994,5582,5583,5585,5587,5589],{"class":1996,"line":2931},[1994,5584,4810],{"class":2217},[1994,5586,3911],{"class":2000},[1994,5588,2743],{"class":2217},[1994,5590,5591],{"class":2000},"existingProfile) {\n",[1994,5593,5594,5597,5599,5601,5604,5606,5609],{"class":1996,"line":2977},[1994,5595,5596],{"class":2217},"            throw",[1994,5598,4165],{"class":2292},[1994,5600,5383],{"class":2000},[1994,5602,5603],{"class":2282},"404",[1994,5605,5389],{"class":2000},[1994,5607,5608],{"class":2227},"'Profile not found.'",[1994,5610,5395],{"class":2000},[1994,5612,5613],{"class":1996,"line":2985},[1994,5614,2869],{"class":2000},[1994,5616,5617],{"class":1996,"line":2991},[1994,5618,2264],{"emptyLinePlaceholder":1859},[1994,5620,5621],{"class":1996,"line":2997},[1994,5622,5623],{"class":2269},"        // Get user's specific like record\n",[1994,5625,5626,5628,5631,5633,5636,5639,5641,5644,5647,5650,5652],{"class":1996,"line":3003},[1994,5627,4212],{"class":2217},[1994,5629,5630],{"class":2282}," userLike",[1994,5632,2286],{"class":2217},[1994,5634,5635],{"class":2000}," existingProfile.likes?.",[1994,5637,5638],{"class":2292},"find",[1994,5640,2314],{"class":2000},[1994,5642,5643],{"class":2007},"like",[1994,5645,5646],{"class":2217}," =>",[1994,5648,5649],{"class":2000}," like.visitor_hash ",[1994,5651,4316],{"class":2217},[1994,5653,5654],{"class":2000}," visitorHash);\n",[1994,5656,5657],{"class":1996,"line":3009},[1994,5658,2264],{"emptyLinePlaceholder":1859},[1994,5660,5661,5663,5665,5667,5669,5672],{"class":1996,"line":3027},[1994,5662,4212],{"class":2217},[1994,5664,3950],{"class":2282},[1994,5666,2286],{"class":2217},[1994,5668,2464],{"class":2217},[1994,5670,5671],{"class":2292}," readBody",[1994,5673,4142],{"class":2000},[1994,5675,5676,5678,5681,5683,5686,5688,5691,5694,5697,5700,5703,5705,5707,5709,5712],{"class":1996,"line":3036},[1994,5677,4212],{"class":2217},[1994,5679,5680],{"class":2282}," newCount",[1994,5682,2286],{"class":2217},[1994,5684,5685],{"class":2000}," Math.",[1994,5687,2311],{"class":2292},[1994,5689,5690],{"class":2000},"(Math.",[1994,5692,5693],{"class":2292},"max",[1994,5695,5696],{"class":2000},"(body.count ",[1994,5698,5699],{"class":2217},"||",[1994,5701,5702],{"class":2282}," 0",[1994,5704,2341],{"class":2000},[1994,5706,1857],{"class":2282},[1994,5708,2320],{"class":2000},[1994,5710,5711],{"class":2282},"11",[1994,5713,4446],{"class":2000},[1994,5715,5716],{"class":1996,"line":3042},[1994,5717,2264],{"emptyLinePlaceholder":1859},[1994,5719,5720,5723],{"class":1996,"line":3048},[1994,5721,5722],{"class":2217},"        let",[1994,5724,5725],{"class":2000}," like;\n",[1994,5727,5728],{"class":1996,"line":3054},[1994,5729,2264],{"emptyLinePlaceholder":1859},[1994,5731,5732,5734],{"class":1996,"line":3060},[1994,5733,4810],{"class":2217},[1994,5735,5736],{"class":2000}," (userLike) {\n",[1994,5738,5739],{"class":1996,"line":3065},[1994,5740,5741],{"class":2269},"            // Update existing like record\n",[1994,5743,5744,5747,5749,5751,5753,5755],{"class":1996,"line":3070},[1994,5745,5746],{"class":2000},"            like ",[1994,5748,4013],{"class":2217},[1994,5750,2464],{"class":2217},[1994,5752,4045],{"class":2000},[1994,5754,4048],{"class":2292},[1994,5756,3306],{"class":2000},[1994,5758,5759,5762,5764,5767],{"class":1996,"line":3075},[1994,5760,5761],{"class":2292},"                updateItem",[1994,5763,2314],{"class":2000},[1994,5765,5766],{"class":2227},"'likes'",[1994,5768,5769],{"class":2000},", userLike.id, {\n",[1994,5771,5772],{"class":1996,"line":3132},[1994,5773,5774],{"class":2000},"                    profile: existingProfile.username,\n",[1994,5776,5777],{"class":1996,"line":3137},[1994,5778,5779],{"class":2000},"                    count: newCount,\n",[1994,5781,5782],{"class":1996,"line":3144},[1994,5783,5784],{"class":2000},"                }),\n",[1994,5786,5787],{"class":1996,"line":3150},[1994,5788,5789],{"class":2000},"            );\n",[1994,5791,5792,5795,5798],{"class":1996,"line":3156},[1994,5793,5794],{"class":2000},"        } ",[1994,5796,5797],{"class":2217},"else",[1994,5799,2859],{"class":2000},[1994,5801,5802],{"class":1996,"line":3161},[1994,5803,5804],{"class":2269},"            // Create new like record\n",[1994,5806,5807,5809,5811,5813,5815,5817],{"class":1996,"line":3166},[1994,5808,5746],{"class":2000},[1994,5810,4013],{"class":2217},[1994,5812,2464],{"class":2217},[1994,5814,4045],{"class":2000},[1994,5816,4048],{"class":2292},[1994,5818,3306],{"class":2000},[1994,5820,5821,5824,5826,5828],{"class":1996,"line":3172},[1994,5822,5823],{"class":2292},"                    createItem",[1994,5825,2314],{"class":2000},[1994,5827,5766],{"class":2227},[1994,5829,4246],{"class":2000},[1994,5831,5832],{"class":1996,"line":3177},[1994,5833,5834],{"class":2000},"                        profile: existingProfile.username,\n",[1994,5836,5837],{"class":1996,"line":3183},[1994,5838,5839],{"class":2000},"                        visitor_hash: visitorHash,\n",[1994,5841,5842],{"class":1996,"line":3189},[1994,5843,5844],{"class":2000},"                        count: newCount,\n",[1994,5846,5847],{"class":1996,"line":3207},[1994,5848,5849],{"class":2000},"                    }),\n",[1994,5851,5852],{"class":1996,"line":3213},[1994,5853,5789],{"class":2000},[1994,5855,5856],{"class":1996,"line":3218},[1994,5857,2869],{"class":2000},[1994,5859,5860],{"class":1996,"line":3238},[1994,5861,2264],{"emptyLinePlaceholder":1859},[1994,5863,5864],{"class":1996,"line":3250},[1994,5865,5866],{"class":2269},"        // Calculate total likes by summing all likes\n",[1994,5868,5869,5871,5874,5876,5878,5881,5884,5887,5889,5891,5893,5895],{"class":1996,"line":3256},[1994,5870,4212],{"class":2217},[1994,5872,5873],{"class":2282}," totalLikes",[1994,5875,2286],{"class":2217},[1994,5877,5635],{"class":2000},[1994,5879,5880],{"class":2292},"reduce",[1994,5882,5883],{"class":2000},"((",[1994,5885,5886],{"class":2007},"sum",[1994,5888,2341],{"class":2000},[1994,5890,5643],{"class":2007},[1994,5892,3966],{"class":2000},[1994,5894,3940],{"class":2217},[1994,5896,2859],{"class":2000},[1994,5898,5899],{"class":1996,"line":3261},[1994,5900,5901],{"class":2269},"            // If this is the user's like, use the new count\n",[1994,5903,5904,5907,5910,5912],{"class":1996,"line":3266},[1994,5905,5906],{"class":2217},"            if",[1994,5908,5909],{"class":2000}," (like.visitor_hash ",[1994,5911,4316],{"class":2217},[1994,5913,5914],{"class":2000}," visitorHash) {\n",[1994,5916,5917,5920,5923,5926],{"class":1996,"line":3272},[1994,5918,5919],{"class":2217},"                return",[1994,5921,5922],{"class":2000}," sum ",[1994,5924,5925],{"class":2217},"+",[1994,5927,5928],{"class":2000}," newCount;\n",[1994,5930,5931],{"class":1996,"line":3280},[1994,5932,4899],{"class":2000},[1994,5934,5935,5938,5940,5942,5945,5947,5949],{"class":1996,"line":3285},[1994,5936,5937],{"class":2217},"            return",[1994,5939,5922],{"class":2000},[1994,5941,5925],{"class":2217},[1994,5943,5944],{"class":2000}," (like.count ",[1994,5946,5699],{"class":2217},[1994,5948,5702],{"class":2282},[1994,5950,4446],{"class":2000},[1994,5952,5953,5956,5958],{"class":1996,"line":3290},[1994,5954,5955],{"class":2000},"        }, ",[1994,5957,1857],{"class":2282},[1994,5959,4446],{"class":2000},[1994,5961,5962],{"class":1996,"line":3295},[1994,5963,2264],{"emptyLinePlaceholder":1859},[1994,5965,5966,5968,5970,5972,5975,5977],{"class":1996,"line":3300},[1994,5967,4212],{"class":2217},[1994,5969,4231],{"class":2282},[1994,5971,2958],{"class":2217},[1994,5973,5974],{"class":2292}," LikesResponse",[1994,5976,2286],{"class":2217},[1994,5978,2859],{"class":2000},[1994,5980,5981],{"class":1996,"line":3309},[1994,5982,5983],{"class":2000},"            username: existingProfile.username,\n",[1994,5985,5986,5989,5991,5993],{"class":1996,"line":3320},[1994,5987,5988],{"class":2000},"            totalLikes: totalLikes ",[1994,5990,5699],{"class":2217},[1994,5992,5702],{"class":2282},[1994,5994,2435],{"class":2000},[1994,5996,5997],{"class":1996,"line":3331},[1994,5998,5999],{"class":2000},"            userLikeCount: newCount,\n",[1994,6001,6002],{"class":1996,"line":3337},[1994,6003,4112],{"class":2000},[1994,6005,6006],{"class":1996,"line":3343},[1994,6007,2264],{"emptyLinePlaceholder":1859},[1994,6009,6010,6012],{"class":1996,"line":3349},[1994,6011,4090],{"class":2217},[1994,6013,6014],{"class":2000}," response;\n",[1994,6016,6017,6019,6021],{"class":1996,"line":3355},[1994,6018,5153],{"class":2000},[1994,6020,5156],{"class":2217},[1994,6022,5159],{"class":2000},[1994,6024,6025,6027,6029,6031,6034],{"class":1996,"line":3361},[1994,6026,5165],{"class":2000},[1994,6028,5168],{"class":2292},[1994,6030,2314],{"class":2000},[1994,6032,6033],{"class":2227},"'Error updating like count:'",[1994,6035,6036],{"class":2000},", error);\n",[1994,6038,6039,6041,6043],{"class":1996,"line":3367},[1994,6040,4162],{"class":2217},[1994,6042,4165],{"class":2292},[1994,6044,2296],{"class":2000},[1994,6046,6047,6049,6051],{"class":1996,"line":3373},[1994,6048,4172],{"class":2000},[1994,6050,5196],{"class":2282},[1994,6052,2435],{"class":2000},[1994,6054,6055,6057,6060],{"class":1996,"line":3379},[1994,6056,4182],{"class":2000},[1994,6058,6059],{"class":2227},"'Failed to update like count.'",[1994,6061,2435],{"class":2000},[1994,6063,6064],{"class":1996,"line":3384},[1994,6065,4192],{"class":2000},[1994,6067,6068],{"class":1996,"line":3411},[1994,6069,2879],{"class":2000},[1994,6071,6072],{"class":1996,"line":3416},[1994,6073,2393],{"class":2000},[1977,6075,6077],{"id":6076},"the-nice-list","The Nice List ✅",[1840,6079,6080],{},"After you figure out if you’re on the naughty or nice list, you might want to see if your friends made the list next. So we build a page to show each list side by side, sorted by the number of likes or “spice level”.",[1840,6082,6083],{},[1872,6084],{"alt":6085,"src":6086},"Open source Santa's List","/img/os-salty-santa-8.png",[1840,6088,6089,6090,6095],{},"We use ",[1844,6091,6094],{"href":6092,"rel":6093},"https://nitro.build/guide/cache#cached-event-handlers",[1848],"cached event handlers"," from Nuxt / Nitro here to cache the data for a short period of time to prevent hammering the Directus API if there’s a lot of users on the page.",[1840,6097,6098],{},"After hearing feedback from teammates about privacy concerns, we added a simple switch that lets users opt out of appearing on the public list.",[1840,6100,6101],{},[1872,6102],{"alt":6103,"src":6104},"Opt out button for users","/img/os-salty-santa-9.png",[1977,6106,6108],{"id":6107},"dynamic-og-images","Dynamic OG Images ✅",[1840,6110,6111,6112,6120],{},"Fun social sharing / OG images seem to have become a thing in my projects. And if I’m building a Nuxt project - I always reach for the ",[1844,6113,6116,6119],{"href":6114,"rel":6115},"https://github.com/nuxt-modules/og-image",[1848],[1991,6117,6118],{},"nuxt-og-image"," module"," by rockstar Harlan Wilton.",[1840,6122,6123],{},[1872,6124],{"alt":6125,"src":6126},"OS Salty Santa OG Image on social media","/img/os-salty-santa-7.png",[1840,6128,6129,6130,6133],{},"It’s as simple as creating a separate Vue component for image design and then calling ",[1991,6131,6132],{},"defineOgImageComponent"," in your Nuxt page.",[1985,6135,6137],{"className":3443,"code":6136,"language":3445,"meta":24,"style":24},"// app/components/OgImage/Username.vue\n\u003Cscript setup lang=\"ts\">\nconst props = withDefaults(\n    defineProps\u003C{\n        username?: string;\n        avatarUrl?: string;\n    }>(),\n    {\n        username: 'random_hacker_323',\n    },\n);\n\u003C/script>\n\n\u003Ctemplate>\n    \u003Cdiv class=\"w-full h-full flex flex-col bg-red-900 p-12\">\n        \u003C!-- do template-y stuff here -->\n        \u003C/div>\n\u003C/template>\n",[1991,6138,6139,6144,6165,6170,6175,6185,6194,6199,6204,6214,6219,6223,6232,6236,6245,6262,6267,6276],{"__ignoreMap":24},[1994,6140,6141],{"class":1996,"line":1997},[1994,6142,6143],{"class":2269},"// app/components/OgImage/Username.vue\n",[1994,6145,6146,6148,6151,6154,6157,6159,6162],{"class":1996,"line":2004},[1994,6147,3925],{"class":2000},[1994,6149,1927],{"class":6150},"sovSZ",[1994,6152,6153],{"class":2292}," setup",[1994,6155,6156],{"class":2292}," lang",[1994,6158,4013],{"class":2217},[1994,6160,6161],{"class":2227},"\"ts\"",[1994,6163,6164],{"class":2000},">\n",[1994,6166,6167],{"class":1996,"line":2014},[1994,6168,6169],{"class":2000},"const props = withDefaults(\n",[1994,6171,6172],{"class":1996,"line":2022},[1994,6173,6174],{"class":2000},"    defineProps\u003C{\n",[1994,6176,6177,6180,6182],{"class":1996,"line":2030},[1994,6178,6179],{"class":2000},"        username",[1994,6181,4375],{"class":2217},[1994,6183,6184],{"class":2000}," string;\n",[1994,6186,6187,6190,6192],{"class":1996,"line":2273},[1994,6188,6189],{"class":2000},"        avatarUrl",[1994,6191,4375],{"class":2217},[1994,6193,6184],{"class":2000},[1994,6195,6196],{"class":1996,"line":2299},[1994,6197,6198],{"class":2000},"    }>(),\n",[1994,6200,6201],{"class":1996,"line":2326},[1994,6202,6203],{"class":2000},"    {\n",[1994,6205,6206,6209,6212],{"class":1996,"line":2353},[1994,6207,6208],{"class":2000},"        username: ",[1994,6210,6211],{"class":2227},"'random_hacker_323'",[1994,6213,2435],{"class":2000},[1994,6215,6216],{"class":1996,"line":2373},[1994,6217,6218],{"class":2000},"    },\n",[1994,6220,6221],{"class":1996,"line":2390},[1994,6222,4446],{"class":2000},[1994,6224,6225,6228,6230],{"class":1996,"line":2396},[1994,6226,6227],{"class":2000},"\u003C/",[1994,6229,1927],{"class":6150},[1994,6231,6164],{"class":2000},[1994,6233,6234],{"class":1996,"line":2401},[1994,6235,2264],{"emptyLinePlaceholder":1859},[1994,6237,6238,6240,6243],{"class":1996,"line":2407},[1994,6239,3925],{"class":2000},[1994,6241,6242],{"class":6150},"template",[1994,6244,6164],{"class":2000},[1994,6246,6247,6250,6252,6255,6257,6260],{"class":1996,"line":2423},[1994,6248,6249],{"class":2000},"    \u003C",[1994,6251,1917],{"class":6150},[1994,6253,6254],{"class":2292}," class",[1994,6256,4013],{"class":2217},[1994,6258,6259],{"class":2227},"\"w-full h-full flex flex-col bg-red-900 p-12\"",[1994,6261,6164],{"class":2000},[1994,6263,6264],{"class":1996,"line":2438},[1994,6265,6266],{"class":2000},"        \u003C!-- do template-y stuff here -->\n",[1994,6268,6269,6272,6274],{"class":1996,"line":2443},[1994,6270,6271],{"class":2000},"        \u003C/",[1994,6273,1917],{"class":6150},[1994,6275,6164],{"class":2000},[1994,6277,6278,6280,6282],{"class":1996,"line":2448},[1994,6279,6227],{"class":2000},[1994,6281,6242],{"class":6150},[1994,6283,6164],{"class":2000},[1985,6285,6287],{"className":3443,"code":6286,"language":3445,"meta":24,"style":24},"// app/pages/[username].vue\n\u003Cscript setup lang=\"ts\">\nconst username = computed(() => route.params.username);\nconst avatarUrl = computed(() => `https://github.com/${username.value}.png`);\n\ndefineOgImageComponent('Username', {\n    username: username.value,\n    avatarUrl: avatarUrl.value,\n});\n\u003C/script>\n",[1991,6288,6289,6294,6310,6315,6320,6324,6329,6334,6339,6343],{"__ignoreMap":24},[1994,6290,6291],{"class":1996,"line":1997},[1994,6292,6293],{"class":2269},"// app/pages/[username].vue\n",[1994,6295,6296,6298,6300,6302,6304,6306,6308],{"class":1996,"line":2004},[1994,6297,3925],{"class":2000},[1994,6299,1927],{"class":6150},[1994,6301,6153],{"class":2292},[1994,6303,6156],{"class":2292},[1994,6305,4013],{"class":2217},[1994,6307,6161],{"class":2227},[1994,6309,6164],{"class":2000},[1994,6311,6312],{"class":1996,"line":2014},[1994,6313,6314],{"class":2000},"const username = computed(() => route.params.username);\n",[1994,6316,6317],{"class":1996,"line":2022},[1994,6318,6319],{"class":2000},"const avatarUrl = computed(() => `https://github.com/${username.value}.png`);\n",[1994,6321,6322],{"class":1996,"line":2030},[1994,6323,2264],{"emptyLinePlaceholder":1859},[1994,6325,6326],{"class":1996,"line":2273},[1994,6327,6328],{"class":2000},"defineOgImageComponent('Username', {\n",[1994,6330,6331],{"class":1996,"line":2299},[1994,6332,6333],{"class":2000},"    username: username.value,\n",[1994,6335,6336],{"class":1996,"line":2326},[1994,6337,6338],{"class":2000},"    avatarUrl: avatarUrl.value,\n",[1994,6340,6341],{"class":1996,"line":2353},[1994,6342,2393],{"class":2000},[1994,6344,6345,6347,6349],{"class":1996,"line":2373},[1994,6346,6227],{"class":2000},[1994,6348,1927],{"class":6150},[1994,6350,6164],{"class":2000},[1840,6352,6353,6354,6357],{},"There can still be a few gotchas depending on the rendering method and the host you’re using. I almost always end up add the ",[1991,6355,6356],{},"sharp"," module as a dependency. This site is using SSR and hosted on Vercel and 🤞 we haven’t had any major issues yet.",[1977,6359,6361],{"id":6360},"santa-reads-aloud","Santa Reads Aloud ❌",[1840,6363,6364],{},"Some features just don’t make the final cut. This one got axed not because it didn’t work or wasn’t awesome - but for cost purposes.",[1840,6366,6367,6368,6373,6374,2057],{},"Mr ",[1844,6369,6372],{"href":6370,"rel":6371},"https://directus.io/team/pedro-pizarro",[1848],"Pedro Pizzaro"," – one of our AEs is freaking awesome at voiceover. And he recorded a custom salty sample voice that we used to create a custom voice at ",[1844,6375,6378],{"href":6376,"rel":6377},"https://elevenlabs.io",[1848],"ElevenLabs",[1840,6380,6381],{},"Once you sent your letter to Santa, we’d send the generated text to their API to generate speech and then play it back to you on your profile page. But the amount of credits we’d burn through made it too expensive to include.",[1840,6383,6384],{},"But fear not - here’s a sample of what could have been.",[6386,6387,6388,6389,6394],"audio",{"controls":1859},"\n  ",[6390,6391],"source",{"src":6392,"type":6393},"https://product-team.directus.app/assets/c856d836-7ef6-4ff6-8961-152b3156c49f.mp3","audio/mpeg","\n  Your browser does not support the audio element.\n",[1885,6396,6398],{"id":6397},"salty-santa-faqs","Salty Santa FAQs ❓",[1977,6400,6402],{"id":6401},"how-long-did-it-take-to-build",[1863,6403,6404],{},"How long did it take to build?",[1840,6406,6407,6408,6411],{},"From idea to launch has been about ",[1863,6409,6410],{},"3 weeks"," of time. That’s not really the total build time just the elapsed time since work started onit.",[1840,6413,6414],{},"I’d estimate I’ve spent a solid 30 hours of time “in-the-seat” actually building, testing and improving this thing. The majority of that in the frontend interaction, prompt engineering, and the scoring algorithm.",[1977,6416,6418],{"id":6417},"what-does-it-cost-to-run","What does it cost to run?",[1840,6420,6421],{},"Because we’re fetching a lot of data like repositories and their readmes, the input token count in quite high. The average input token count is around ~9,977 tokens. This varies a lot based on the users repos and readme content.",[1840,6423,6424],{},"Output is a totally different story – averaging around ~360 tokens since we’re just outputting the letter (mostly).",[1840,6426,6427,6428,6431],{},"That brings the ",[1863,6429,6430],{},"cost to ~$0.035 per profile roasted",". Or put a different way - every 1000 roasts would cost us about $35.",[1840,6433,6434],{},"We may tweak our data fetching and adjust our prompts to attempt to lower this if it becomes really popular.",[1885,6436,6438],{"id":6437},"santas-summary","Santa’s Summary",[1840,6440,6441,6442,2057],{},"This thing was a blast to build and I hope this a super-helpful write up for your own projects. Be sure to check out the live project at ",[1844,6443,1846],{"href":1846,"rel":6444},[1848],[1840,6446,6447],{},"Let us know your feedback. And shoot us your ideas for the next fun build.",[6449,6450,6451],"style",{},"html pre.shiki code .sxrX7, html code.shiki .sxrX7{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sP4rz, html code.shiki .sP4rz{--shiki-light:#E36209;--shiki-default:#E36209;--shiki-dark:#FFAB70}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 .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 pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sBjJW, html code.shiki .sBjJW{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .snPdu, html code.shiki .snPdu{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sovSZ, html code.shiki .sovSZ{--shiki-light:#22863A;--shiki-default:#22863A;--shiki-dark:#85E89D}",{"title":24,"searchDepth":1997,"depth":2004,"links":6453},[6454,6455,6462,6469,6473],{"id":1887,"depth":2004,"text":1888},{"id":1971,"depth":2004,"text":1972,"children":6456},[6457,6458,6459,6460,6461],{"id":1979,"depth":2014,"text":1980},{"id":2093,"depth":2014,"text":2094},{"id":2188,"depth":2014,"text":2189},{"id":2528,"depth":2014,"text":2529},{"id":2535,"depth":2014,"text":2536},{"id":2579,"depth":2004,"text":2580,"children":6463},[6464,6465,6466,6467,6468],{"id":2583,"depth":2014,"text":2584},{"id":5226,"depth":2014,"text":5227},{"id":6076,"depth":2014,"text":6077},{"id":6107,"depth":2014,"text":6108},{"id":6360,"depth":2014,"text":6361},{"id":6397,"depth":2004,"text":6398,"children":6470},[6471,6472],{"id":6401,"depth":2014,"text":6404},{"id":6417,"depth":2014,"text":6418},{"id":6437,"depth":2004,"text":6438},{"slug":6475},"ai-santa-roast-app-with-directus-nuxt","---\nid: 11a1c86f-36bf-4dd5-8bce-7eed75451514\nslug: ai-santa-roast-app-with-directus-nuxt\ntitle: How I Built an AI Open Source Santa Roast App with Directus and Nuxt\ntechnologies:\n  - nuxt\nauthors:\n  - name: Bryant Gillespie\n    title: Growth Engineer\ndescription: Bryant breaks down how he built an AI-powered app that roasts developers based on their GitHub contributions.\n---\n\nHey folks! Bryant here from Directus. In this post, I’ll walk you through our [Salty Open Source Santa](https://salty-santa.vercel.app) project - how we built it, why we built it, and all the fun little features we packed into this thing. Let's dive in!\n\n\u003Ciframe style=\"width:100%; aspect-ratio:16/9; margin-bottom: 1em;\" src=\"https://www.youtube.com/embed/aHHdh50hkG4\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen>\u003C/iframe>\n\n**What is Salty Open Source Santa?**\n\nSo what exactly is this thing? Well, it's basically the open source community's naughty or nice list. You write a letter to Santa, and he analyzes your public GitHub profile data to determine if your open source contributions were good enough to make the nice list. And then he writes you back a salty roast-style letter.\n\n![Screenshot of OS Santa app](/img/os-salty-santa-2.png)\n\n**You can check to see if you’re on Open Source Santa’s Naughty or Nice list at [https://salty-santa.vercel.app](https://salty-santa.vercel.app)**\n\n## The Idea 💡\n\nLike a lot of fun projects, this started with a simple conversation on Slack. My colleague John Daniels and I were brainstorming ideas for our Christmas promotion. Last year, we did a whole [\"12 Days of CMS\" thing](https://x.com/directus/status/1734671700296380579) where team members sang that dreadful song. And this year, I wanted to up the ante a bit.\n\n![Conversation about formation of the Salty Santa app](/img/os-salty-santa-1.png)\n\nJohn suggested scanning letters and having them transcribed. I’m way more of a smartass than John so I said \"Hey, what if we make it snarkier? Like, you write a letter to Santa and he roasts you back?”\n\nSo with that direction, I built the first version in an episode of our [\"100 Apps, 100 Hours\" show on Directus TV](https://directus.io/tv/100-apps-100-hours).  Let's just say it wasn't as pretty as what you see now. Here’s what it looked like.\n\n\u003Cdiv style=\"padding:56.25% 0 0 0;position:relative;\">\u003Ciframe src=\"https://player.vimeo.com/video/1047153908?badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=58479\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media\" style=\"position:absolute;top:0;left:0;width:100%;height:100%;\" title=\"ai-letters-to-santa-preview\">\u003C/iframe>\u003C/div>\u003Cscript src=\"https://player.vimeo.com/api/player.js\">\u003C/script>\n\nBut after recording the episode, I still couldn’t get the idea out of my head and I thought there was a lot more fun we could have with it. I scoped the features out a bit further with some brainstorming help from the fine folks on my team – Matt, Christina, and Lindsey.\n\n**Here’s the additional feature list we came up with:**\n\n- A scoring algorithm to be more fair who makes it onto the nice list\n- An actual Nice list page to see which devs are in Santa’s good graces\n- Roast a friend mode with suggestions from your GitHub organization\n- A “Spicyness” Meter to rank the spiciest letters and increase enagement\n- An animated naughty or nice “gauge” to build suspense while you wait on the letter\n- Dynamic OG images that mimic a personalized letter from Santa to increase sharing\n- And the cherry on top – Santa actually reads the letter aloud to you\n\n*We’ll cover some of these features in-depth, but first let’s run the through the tech stack.*\n\n## The Tech Stack 💾\n\nLet's dive into the fun stuff - the actual tech that powers Santa’s roasts.\n\n### Backend – Directus\n\nWe're using Directus for the backend (shocking, I know 😉). But it's actually a pretty lightweight data model and setup compared to other projects I’ve built. We've got just four collections:\n\n```md\n// Our main collections\n- profiles (stores all the letters and scores)\n- likes (for that spicy meter!)\n- metrics (for storing calculated metrics on a daily basis)\n- globals (help content, site title, etc.)\n```\n\n![Profiles saved in the Salty OS Santa Directus project](/img/os-salty-santa-4.png)\n\nUnder the hood, it's all sitting on a PostgreSQL database – hosted on [Directus Cloud](https://directus.cloud). Anytime I add a collection or field to my data model, Directus mirrors those changes to Postgres and updates the APIs automatically. Super handy when you're iterating quickly on a project like this.\n\nAll communication to the frontend is through a single Directus user name “Santa’s Helper” (gotta carry the theme 🤣🎅). Santa’s Helper authenticates using a static access token and has a single Access Policy called `Elves`.\n\n![Users saved in the Salty OS Santa Directus project](/img/os-salty-santa-5.png)\n\nThe `Elves` policy has create, read, and update permissions on `profiles` and `likes`. And also read permissions for the `directus_` system collections in order to generate types using a helper Node script.\n\n![Access policies in the Salty Santa Directus project](/img-salty-santa-6.png)\n\nIf you ever use this same pattern, just make sure you’re only using static access tokens for server-to-server comms. You don’t want to expose those to anyone on the frontend because of the elevated permissions that might be attached.\n\n### Frontend – Nuxt\n\nFor the frontend, we're running with [Nuxt](https://nuxt.com).\n\nWe're using the alpha version of [Nuxt UI](https://ui.nuxt.com) (living dangerously, I know!). It's built on [RadixVue](https://www.radix-vue.com/) and [Tailwind CSS v4-beta](https://tailwindcss.com/blog/tailwindcss-v4-beta). The component library is fantastic - it gave us all these nice little UI pieces that we could customize for our holiday theme.\n\n**Business Logic in Nuxt Server Routes**\n\nWe’re using Nuxt Server Routes pretty heavily in this project. They give us these nice, type-safe API endpoints that we proxy to the Directus API. And they add an extra layer of caching that we can leverage to reduce costs and improve performance since things like GitHub profile data don’t need to be realtime.\n\n**Authentication with Nuxt Auth Utils**\n\nAuthentication is really simple and handled via a GitHub OAuth app and the [nuxt-auth-utils](https://github.com/atinux/nuxt-auth-utils) package.\n\nWe're not storing any sensitive GitHub data - we just need to know who's logged in so we can fetch their public profile data. The package handles all the OAuth flow, session management, and token refresh stuff for us.\n\nWe use session data to personalize the experience. Like when you're writing a letter to Santa, we can pre-fill it with your GitHub info if you're logged in, or show the friend mode UI if you're not.\n\nThe whole auth flow is super smooth:\n\n1. Click \"Sign in with GitHub\"\n2. GitHub OAuth popup appears\n3. Authorize the app\n4. Get redirected back with your session\n5. Start roasting (or getting roasted by) Santa!\n\n**Why Not Use Directus Auth?**\n\nWhile Directus has a really robust authentication SSO providers (including GitHub), we deliberately went with `nuxt-auth-utils` for this project. Here's why… we didn't actually need \"real\" user accounts or any of the powerful permission features that Directus provides. We just needed a quick way to say \"hey, this person is logged in with GitHub\" so we could fetch their public profile data.\n\nPlus, keeping the auth lightweight meant one less thing to configure in our Directus instance, which we're primarily using it as the store for all the letters and likes. Sometimes simpler is better.\n\n### The AI Magic – Anthropic + Vercel AI SDK\n\nFor the AI part, we're using Anthropic's Claude 3.5 Sonnet. We actually tested this against a few different LLMs, and Claude just had this perfect balance of snark and humor that really nailed the Santa voice we were going for.\n\nWe're using the [Vercel AI SDK](https://sdk.vercel.ai/) to handle our Anthropic API calls, specifically their `generateObject` function which is super handy. Here's an example of how that might look below.\n\n```typescript\nimport { z } from 'zod';\nimport { generateObject } from 'ai';\nimport { createAnthropic } from '@ai-sdk/anthropic';\n\n// Schema for the AI Payload to return proper JSON\nexport const aiPayloadSchema = z.object({\n    letter: z.string().min(1), // The letter in Markdown format\n    list: z.enum(['naughty', 'nice']), // The list the user belongs to\n    flagged: z.boolean().optional(), // Was the letter flagged as inappropriate?\n    flagged_reason: z.string().optional(), // Reason for why it was flagged\n});\n\n// Create the Anthropic client\nconst anthropic = createAnthropic({\n    apiKey: config.anthropicApiKey as string,\n});\n\n// Generate the letter\nconst aiResponse = await generateObject({\n    model: anthropic('claude-3-5-sonnet-20240620'),\n    schema: aiPayloadSchema,\n    maxTokens: 8192,\n    messages: [{ role: 'user', content: prompt }],\n});\n```\n\nThe `generateObject` method from the Vercel AI forces Claude to return data in exactly the structure we want. We define our schema with Zod, and the SDK makes sure the AI response matches that structure. No more parsing weird JSON strings or weird edge cases dealing with malformed responses.\n\n### Frontend Hosting – Vercel\n\nThe frontend is hosted with the big triangle company - Vercel. In my own testing across various Nuxt projects over the last year or two, I’ve found that deploying Nuxt 3 on Vercel usually “just works” more often than other providers. Other providers usually take me a little more time to debug and troubleshoot builds. Cost is definitely a concern though - especially if this thing gets really popular.\n\n### The Fun Extras\n\nThere’s some other cool additional libraries that add those special touches.\n\n- [**@tsparticles**](https://particles.js.org/) – powers the falling snow effect animation.\n- [**@vueuse/sound**](https://github.com/vueuse/sound) – makes it super easy to add sound effects to any Vue.js app.\n- [**micromark**](https://github.com/micromark/micromark) – to render markdown coming back from the LLM.\n\n*Next up, let’s deep dive into the actual features.*\n\n## The Feature List 🎅\n\n### Naughty or Nice scoring algorithm ✅\n\nThe original version relied on the AI Santa to decide whether a developer made it onto the naughty or nice list. The roasts were hilarious but almost everyone was on the naughty list. Which didn’t feel “fair” to those who contribute a lot, so we had to figure out a way to fix it. \n\nAfter eliciting feedback from the team and our AI / LLM friends, we came back with this (way over-engineered 😅) algorithm.\n\n**Base Points**\n\n| **Data Point** | **Score** |\n| --- | --- |\n| Issues | 0.5 pts per issue |\n| Commits | 1 pts per commit |\n| Pull Requests | 2 pts per PR |\n| Code Reviews | 3 pts per review |\n| Followers | 2 pts per follower |\n| Stars | 2 pts per star on owned repos |\n| Sponsorships | 25 points per GitHub sponsorship (where you are the sponsor) |\n\n**Modifiers**\n\n- Abandoned Forks: -2 points for each forked repository not updated in 6+ months\n- Popular Projects: 20% bonus (1.2×) for having any project with >500 stars\n- Organization Membership: 10% bonus (1.1×) for being part of GitHub organizations\n\n**Final Score**\n\n- Users scoring 500+ points are classified as \"nice\"\n- Users scoring below 500 points are classified as \"naughty\"\n\n**Fetching user data with the GitHub GraphQL API**\n\nWe needed to grab a lot of different data points to calculate that naughty/nice score - commits, PRs, reviews, issues, followers, organizations, and more. With the GitHub REST API, we’d be making 6-10 separate API calls for each profile to get all the data we needed to properly score a profile.. \n\nWith GraphQL, we can get it all in one shot.\n\n```graphql\nquery getUserProfile($username: String!) {\n  user(login: $username) {\n    login\n    name\n    location\n    twitterUsername\n    url\n    avatarUrl\n    websiteUrl\n    company\n    bio\n    readme: repository(name: $username) {\n      object(expression: \"HEAD:README.md\") {\n        ... on Blob {\n          text\n        }\n      }\n    }\n    starredRepositories {\n      totalCount\n    }\n    followers {\n      totalCount\n    }\n    following {\n      totalCount\n    }\n    organizations(first: 3, orderBy: {field: CREATED_AT, direction: DESC}) {\n      nodes {\n        name\n        description\n        url\n        avatarUrl\n\t\t membersWithRole(first: 10){\n          nodes{\n            name\n            login\n            avatarUrl\n          }\n        }\n      }\n    }\n    repositories(visibility: PUBLIC, first: 10, ownerAffiliations: OWNER, orderBy: {field: PUSHED_AT, direction: DESC}) {\n      totalCount\n      nodes {\n        forkCount\n        isFork\n        name\n        description\n        descriptionHTML\n        url\n        createdAt\n        stargazerCount\n        issues(states: OPEN) {\n          totalCount\n        }\n        readme: object(expression: \"HEAD:README.md\") {\n          ... on Blob {\n            text\n          }\n        }\n        pushedAt\n        commitComments {\n          totalCount\n        }\n      }\n    }\n    contributionsCollection(\n      from: \"2024-01-01T00:00:00Z\"\n      to: \"2024-12-31T23:59:59Z\"\n    ) {\n      totalRepositoryContributions\n      totalRepositoriesWithContributedIssues\n      totalRepositoriesWithContributedCommits\n      totalCommitContributions\n      totalIssueContributions\n      totalPullRequestContributions\n      totalPullRequestReviewContributions\n    }\n    sponsorshipsAsSponsor(activeOnly: true, first: 100) {\n      totalCount\n    }\n  }\n}\n```\n\nThe data returned then gets fed into our custom scoring algorithm. Next, the resulting score and profile gets passed to the LLM. And finally the generated letter, score, and metadata is stored in Directus to be retrieved on the frontend.\n\nHere’s what our complete `roast` Nuxt server endpoint looks like.\n\n```tsx\n// server/api/roast.post.ts\n\nimport { z } from 'zod';\nimport { generateObject } from 'ai';\nimport { createAnthropic } from '@ai-sdk/anthropic';\n\nimport userQuery from '~~/server/graphql/getUserProfile';\nimport orgQuery from '~~/server/graphql/getOrgProfile';\n\nimport type { GitHubUserData } from '~~/server/graphql/getUserProfile';\nimport type { GitHubOrgData } from '~~/server/graphql/getOrgProfile';\nimport type { RoastResponse } from '#shared/types/endpoints.js';\nimport type { H3Error } from 'h3';\n\n// Schema for the AI Payload to return proper JSON\nexport const aiPayloadSchema = z.object({\n\tletter: z.string().min(1), // The letter in Markdown format\n\tlist: z.enum(['naughty', 'nice']), // The list the user belongs to\n\tflagged: z.boolean().optional(), // Was the letter flagged as inappropriate?\n\tflagged_reason: z.string().optional(), // Reason for why it was flagged\n});\n\n// Schema for the roast endpoint body\nexport const profileSchema = z.object({\n\tusername: z.string().min(1),\n\twishlist: z.string().optional(),\n\ttype: z.enum(['user', 'organization']).optional().default('user'),\n\tmode: z.enum(['self', 'friend']).optional().default('self'),\n\troasted_by: z.string().optional(),\n\tprofileType: z.enum(['User', 'Organization']),\n});\n\n// Create the Anthropic client\nconst config = useRuntimeConfig();\nconst anthropic = createAnthropic({\n\tapiKey: config.anthropicApiKey as string,\n});\n\nexport default defineEventHandler(async (event): Promise\u003CRoastResponse | H3Error> => {\n\tconst body = await readValidatedBody(event, (body) => profileSchema.parse(body));\n\tconst { username, wishlist, mode, roasted_by, profileType } = body;\n\n\t// Check to see if the profile already exists in Directus if so, redirect to the profile\n\tconst [directusResponse] = await directusServer.request(\n\t\treadItems('profiles', { filter: { username: { _eq: username } }, limit: 1 }),\n\t);\n\n\tif (directusResponse) {\n\t\treturn {\n\t\t\tredirect: `/${username}`,\n\t\t};\n\t}\n\n\t// Check to see if the user is logged in to GitHub if not, don't allow them to submit a letter to save on costs\n\tconst session = await requireUserSession(event);\n\n\tif (!session) {\n\t\tthrow createError({\n\t\t\tstatusCode: 401,\n\t\t\tmessage: 'Unauthorized. Please login to submit a letter to Santa.',\n\t\t});\n\t}\n\n\ttry {\n\t\tconst variables = { username };\n\n\t\tconst response = await $fetch('https://api.github.com/graphql', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${process.env.GITHUB_TOKEN}`,\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: {\n\t\t\t\tquery: profileType === 'User' ? userQuery : orgQuery,\n\t\t\t\tvariables,\n\t\t\t},\n\t\t});\n\n\t\tconst typedResponse = response as { data: { user?: GitHubUserData; organization?: GitHubOrgData } };\n\n\t\tconst profileData =\n\t\t\tprofileType === 'User'\n\t\t\t\t? (typedResponse.data.user as GitHubUserData)\n\t\t\t\t: (typedResponse.data.organization as GitHubOrgData);\n\n\t\t// Score the contributions based on the profile type\n\t\tconst score = calculateNiceScore(profileData, profileType);\n\n\t\tconst prompt = `\n\t\t\tYou are the open source Santa Claus. You determine who's open source contributions are naughty or nice.\n\t\t\tAnalyze the following Github ${profileType === 'User' ? 'user' : 'organization'}'s profile carefully and in detail.\n\t\t\tWe've determined the ${profileType}'s score based on their contributions. Whether they're on the nice list\n\t\t\tor the naughty list, roast them accordingly. Write a short, funny letter in a snarky sarcastic tone.\n\t\t\tInclude a couple lines from the wish list in the letter if it's provided.\n\t\t\tIf the mode provided is \"friend\", then make a short mention of the roasted_by user in one of the paragraphs.\n\n\t\t\tSTRUCTURE:\n\t\t\t- Intro\n\t\t\t- 3 short paragraphs\n\t\t\t- PS\n\n\t\t\tRULES:\n\t\t\t- Do NOT include a signature and like 'Yours, From Santa' in the letter.\n\t\t\t- The letter should be in Markdown format.\n\t\t\t- If someone uses profanity or asks for something inappropriate, do not roast them. Set the flagged field to true and provide a reason.\n\n\t\t\tWish List: ${wishlist} ${mode === 'friend' ? `Note: Wishlist provided by ${roasted_by}` : ''}\n\t\t\tProfile: ${JSON.stringify(profileData)}\n\t\t\tScore: ${score}\n\t\t\tMode: ${mode}\n\t\t\tRoasted By: ${roasted_by}\n\t\t`;\n\n\t\tconst aiResponse = await generateObject({\n\t\t\tmodel: anthropic('claude-3-5-sonnet-20240620'),\n\t\t\tschema: aiPayloadSchema,\n\t\t\tmaxTokens: 8192,\n\t\t\tmessages: [{ role: 'user', content: prompt }],\n\t\t});\n\n\t\t// If the user has organizations and membersWithRoles exist, loop through the organizations and add the members to the metadata as possible_roasts\n\t\tconst possibleRoasts: any[] = [];\n\t\tif (profileType === 'User' && (profileData as GitHubUserData).organizations?.nodes) {\n\t\t\tfor (const org of (profileData as GitHubUserData).organizations.nodes ?? []) {\n\t\t\t\tif (org?.membersWithRole?.nodes) {\n\t\t\t\t\tpossibleRoasts.push(...org.membersWithRole.nodes);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Generate metadata to store with the profile\n\t\tconst metadata = {\n\t\t\tai_usage: aiResponse.usage,\n\t\t\tai_response: aiResponse.object,\n\t\t\tscore: score,\n\t\t\tpossible_roasts: possibleRoasts,\n\t\t};\n\n\t\t// Store the profile in Directus\n\t\tconst directusResponse = await directusServer.request(\n\t\t\tcreateItem('profiles', {\n\t\t\t\tusername,\n\t\t\t\tletter: aiResponse.object.letter,\n\t\t\t\tlist: score.list,\n\t\t\t\twishlist,\n\t\t\t\tmode,\n\t\t\t\tscore: score.finalScore,\n\t\t\t\troasted_by,\n\t\t\t\tmetadata,\n\t\t\t\ttype: profileType,\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\tredirect: `/${username}`,\n\t\t\tletter: directusResponse.letter,\n\t\t\tlist: directusResponse.list,\n\t\t\tmetadata: directusResponse.metadata,\n\t\t\troasted_by: directusResponse.roasted_by,\n\t\t\tscore: directusResponse.score,\n\t\t\ttype: directusResponse.type,\n\t\t\tmode: directusResponse.mode,\n\t\t\tusername: directusResponse.username,\n\t\t\twishlist: directusResponse.wishlist,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(JSON.stringify(error));\n\t\tthrow createError({\n\t\t\tstatusCode: 500,\n\t\t\tmessage: 'Failed to roast profile',\n\t\t});\n\t}\n});\n\n```\n\n### Spicyness Meter ✅\n\nWe wanted a way for users to engage with letters other than their own and cast a vote on the spiciest letters, so we created the spicemeter. You can increase your opinion of the spiciness by left-clicking or decrease by right-clicking. [These go to eleven.](https://www.youtube.com/watch?v=4xgx4k83zzc)\n\n![Level of spicy-ness set to 7](/img/os-salty-santa-11.png)\n\nThe inspiration for this was taken from [Josh Comeau](https://www.joshwcomeau.com/) and his awesome blog. Instead of a simple like button, there’s an interactive heart button that you can mash up to 16 times.\n\n![Heart button on Josh Comeau's blog](/img/os-salty-santa-10.png)\n\nIt seems like such a simple interaction until you factor in that each person should only get X number of likes on any given post. Here’s how it works.\n\n- We get the IP from the request `x-forwarded-for` header\n- We keep that secure by creating a hash of the IP.\n- We store the hash and the count in our `likes` Directus collection to track individual user interactions\n\n```tsx\n// server/api/profiles/[username]/likes.post.ts\nimport type { LikesResponse } from '~~/shared/types/endpoints.js';\n\nexport default defineEventHandler(async (event): Promise\u003CLikesResponse> => {\n\tconst username = getRouterParam(event, 'username');\n\n\tif (!username) throw createError({ statusCode: 400, message: 'Missing username. username is required.' });\n\n\tconst ip =\n\t\t(event.node.req.headers['x-forwarded-for'] as string) ||\n\t\t(event.node.req.headers['x-vercel-forwarded-for'] as string);\n\n\tconst visitorHash = createVisitorHash(ip, process.env.SALT as string);\n\n\ttry {\n\t\t// Get existing profile with all likes\n\t\tconst existingProfile = await directusServer.request(\n\t\t\treadItem('profiles', username, {\n\t\t\t\tfields: [\n\t\t\t\t\t'username',\n\t\t\t\t\t{\n\t\t\t\t\t\tlikes: ['id', 'visitor_hash', 'profile', 'count'],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\n\t\tif (!existingProfile) {\n\t\t\tthrow createError({ statusCode: 404, message: 'Profile not found.' });\n\t\t}\n\n\t\t// Get user's specific like record\n\t\tconst userLike = existingProfile.likes?.find(like => like.visitor_hash === visitorHash);\n\n\t\tconst body = await readBody(event);\n\t\tconst newCount = Math.min(Math.max(body.count || 0, 0), 11);\n\n\t\tlet like;\n\n\t\tif (userLike) {\n\t\t\t// Update existing like record\n\t\t\tlike = await directusServer.request(\n\t\t\t\tupdateItem('likes', userLike.id, {\n\t\t\t\t\tprofile: existingProfile.username,\n\t\t\t\t\tcount: newCount,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\t// Create new like record\n\t\t\tlike = await directusServer.request(\n\t\t\t\t\tcreateItem('likes', {\n\t\t\t\t\t\tprofile: existingProfile.username,\n\t\t\t\t\t\tvisitor_hash: visitorHash,\n\t\t\t\t\t\tcount: newCount,\n\t\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\t// Calculate total likes by summing all likes\n\t\tconst totalLikes = existingProfile.likes?.reduce((sum, like) => {\n\t\t\t// If this is the user's like, use the new count\n\t\t\tif (like.visitor_hash === visitorHash) {\n\t\t\t\treturn sum + newCount;\n\t\t\t}\n\t\t\treturn sum + (like.count || 0);\n\t\t}, 0);\n\n\t\tconst response: LikesResponse = {\n\t\t\tusername: existingProfile.username,\n\t\t\ttotalLikes: totalLikes || 0,\n\t\t\tuserLikeCount: newCount,\n\t\t};\n\n\t\treturn response;\n\t} catch (error) {\n\t\tconsole.error('Error updating like count:', error);\n\t\tthrow createError({\n\t\t\tstatusCode: 500,\n\t\t\tmessage: 'Failed to update like count.',\n\t\t});\n\t}\n});\n\n```\n\n### The Nice List ✅\n\nAfter you figure out if you’re on the naughty or nice list, you might want to see if your friends made the list next. So we build a page to show each list side by side, sorted by the number of likes or “spice level”.\n\n![Open source Santa's List](/img/os-salty-santa-8.png)\n\nWe use [cached event handlers](https://nitro.build/guide/cache#cached-event-handlers) from Nuxt / Nitro here to cache the data for a short period of time to prevent hammering the Directus API if there’s a lot of users on the page.\n\nAfter hearing feedback from teammates about privacy concerns, we added a simple switch that lets users opt out of appearing on the public list.\n\n![Opt out button for users](/img/os-salty-santa-9.png)\n\n### Dynamic OG Images ✅\n\nFun social sharing / OG images seem to have become a thing in my projects. And if I’m building a Nuxt project - I always reach for the [`nuxt-og-image` module](https://github.com/nuxt-modules/og-image) by rockstar Harlan Wilton. \n\n![OS Salty Santa OG Image on social media](/img/os-salty-santa-7.png)\n\nIt’s as simple as creating a separate Vue component for image design and then calling `defineOgImageComponent` in your Nuxt page.\n\n```tsx\n// app/components/OgImage/Username.vue\n\u003Cscript setup lang=\"ts\">\nconst props = withDefaults(\n\tdefineProps\u003C{\n\t\tusername?: string;\n\t\tavatarUrl?: string;\n\t}>(),\n\t{\n\t\tusername: 'random_hacker_323',\n\t},\n);\n\u003C/script>\n\n\u003Ctemplate>\n\t\u003Cdiv class=\"w-full h-full flex flex-col bg-red-900 p-12\">\n\t\t\u003C!-- do template-y stuff here -->\n\t\t\u003C/div>\n\u003C/template>\n```\n\n```tsx\n// app/pages/[username].vue\n\u003Cscript setup lang=\"ts\">\nconst username = computed(() => route.params.username);\nconst avatarUrl = computed(() => `https://github.com/${username.value}.png`);\n\ndefineOgImageComponent('Username', {\n\tusername: username.value,\n\tavatarUrl: avatarUrl.value,\n});\n\u003C/script>\n```\n\nThere can still be a few gotchas depending on the rendering method and the host you’re using. I almost always end up add the `sharp` module as a dependency. This site is using SSR and hosted on Vercel and 🤞 we haven’t had any major issues yet.\n\n### Santa Reads Aloud ❌\n\nSome features just don’t make the final cut. This one got axed not because it didn’t work or wasn’t awesome - but for cost purposes.\n\nMr [Pedro Pizzaro](https://directus.io/team/pedro-pizarro) – one of our AEs is freaking awesome at voiceover. And he recorded a custom salty sample voice that we used to create a custom voice at [ElevenLabs](https://elevenlabs.io). \n\nOnce you sent your letter to Santa, we’d send the generated text to their API to generate speech and then play it back to you on your profile page. But the amount of credits we’d burn through made it too expensive to include.\n\nBut fear not - here’s a sample of what could have been.\n\n\u003Caudio controls>\n  \u003Csource src=\"https://product-team.directus.app/assets/c856d836-7ef6-4ff6-8961-152b3156c49f.mp3\" type=\"audio/mpeg\">\n  Your browser does not support the audio element.\n\u003C/audio>\n\n## Salty Santa FAQs ❓\n\n### **How long did it take to build?**\n\nFrom idea to launch has been about **3 weeks** of time. That’s not really the total build time just the elapsed time since work started onit.\n\nI’d estimate I’ve spent a solid 30 hours of time “in-the-seat” actually building, testing and improving this thing. The majority of that in the frontend interaction, prompt engineering, and the scoring algorithm.\n\n### What does it cost to run?\n\nBecause we’re fetching a lot of data like repositories and their readmes, the input token count in quite high. The average input token count is around ~9,977 tokens. This varies a lot based on the users repos and readme content. \n\nOutput is a totally different story – averaging around ~360 tokens since we’re just outputting the letter (mostly).\n\nThat brings the **cost to ~$0.035 per profile roasted**. Or put a different way - every 1000 roasts would cost us about $35. \n\nWe may tweak our data fetching and adjust our prompts to attempt to lower this if it becomes really popular.\n\n## Santa’s Summary\n\nThis thing was a blast to build and I hope this a super-helpful write up for your own projects. Be sure to check out the live project at https://salty-santa.vercel.app. \n\nLet us know your feedback. And shoot us your ideas for the next fun build.\n",{"title":1516,"description":1519},[6479],"nuxt","FuVNuBSuhDZnPkVKVQvDCNBNnWR0hwcyoN_8VrAO4OA",1775038782013]