"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[5511],{2241:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>o,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"integration-supabase-edge-function","title":"Supabase Edge functions Integration","description":"Explore how to import Supabase Edge functions with your  application.","source":"@site/Integration/015.integration-supabase-edge-function.md","sourceDirName":".","slug":"/integration-supabase-edge-function","permalink":"/guides/integration/integration-supabase-edge-function","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":6,"frontMatter":{"sidebar_position":6},"sidebar":"sidebar","previous":{"title":"Stripe Integration","permalink":"/guides/integration/integration-stripe"},"next":{"title":"Resend Integration Guide","permalink":"/guides/integration/integration-resend"}}');var i=t(4848),a=t(8453),r=t(8175);const o={sidebar_position:6},c="Supabase Edge functions Integration",d={},u=[{value:"What is supabase edge functions ?",id:"what-is-supabase-edge-functions-",level:2},{value:"Example of using Edge function in Easysite",id:"example-of-using-edge-function-in-easysite",level:2},{value:"Step 1 - Create a Project",id:"step-1---create-a-project",level:3},{value:"Step 2 - Get secret keys safely",id:"step-2---get-secret-keys-safely",level:3}];function l(e){const n={a:"a",br:"br",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"supabase-edge-functions-integration",children:"Supabase Edge functions Integration"})}),"\n",(0,i.jsxs)(n.p,{children:["Explore how to import Supabase Edge functions with your ",(0,i.jsx)(r.A,{})," application."]}),"\n",(0,i.jsx)(n.h2,{id:"what-is-supabase-edge-functions-",children:"What is supabase edge functions ?"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://supabase.com/docs/guides/functions",children:"Edge Functions"})," are server-side TypeScript functions, distributed globally at the edge\u2014close to your users."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://supabase.com/docs/guides/functions/quickstart-dashboard",children:"How to create edge function?"})}),"\n",(0,i.jsx)(n.h2,{id:"example-of-using-edge-function-in-easysite",children:"Example of using Edge function in Easysite"}),"\n",(0,i.jsx)(n.p,{children:"In the example, I store a string of secret keys in supabase and get the secret keys by calling getkey function. In actual situations, you can store any data that needs to be kept confidential in supabase and then get it through function."}),"\n",(0,i.jsx)(n.h3,{id:"step-1---create-a-project",children:"Step 1 - Create a Project"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Open ",(0,i.jsx)(n.a,{href:"https://ezsite.ai",children:(0,i.jsx)(r.A,{})}),"."]}),"\n",(0,i.jsx)(n.li,{children:"Enter your dream idea in the text box"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"For example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"Create a hello world website\n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.img,{src:t(9333).A+"",width:"1164",height:"945"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsx)(n.li,{children:'Click "Generate my website".'}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"step-2---get-secret-keys-safely",children:"Step 2 - Get secret keys safely"}),"\n",(0,i.jsx)(n.p,{children:"You can either:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:'Add a get key button to homepage, click the button to call getkey interface, and display the response result.\ngetkey interface definition:\nurl: https://bmvqdtjwfnhdaadunesa.supabase.co/functions/v1/getkey\nheader: {"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJtdnFkdGp3Zm5oZGFhZHVuZXNhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDI5NTM5NTEsImV4cCI6MjA1ODUyOTk1MX0.vzgKmfG1c3tclep95Pz_CtC5xQQTPDF_SQdgotzVKGw"}\nResponse content: { "key": "xxxx" }\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Results display:",(0,i.jsx)(n.br,{}),"\n",(0,i.jsx)(n.img,{src:t(8726).A+"",width:"830",height:"847"})]})]})}function p(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8175:(e,n,t)=>{t.d(n,{A:()=>i});t(6540);var s=t(4848);function i(){return(0,s.jsx)("code",{children:"EZsite"})}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>o});var s=t(6540);const i={},a=s.createContext(i);function r(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(a.Provider,{value:n},e.children)}},8726:(e,n,t)=>{t.d(n,{A:()=>s});const s=t.p+"assets/images/15-2-1-7d3a1d877ce534882ec31cab789b7161.png"},9333:(e,n,t)=>{t.d(n,{A:()=>s});const s=t.p+"assets/images/15-1-1-70a2d13a36a7133b80cfb7cdced9d8a6.png"}}]);