{"id":53342,"date":"2024-12-03T13:36:48","date_gmt":"2024-12-03T05:36:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53342\/"},"modified":"2024-12-03T13:36:48","modified_gmt":"2024-12-03T05:36:48","slug":"%e5%9c%a8-nuxt-%e4%b8%ad%e5%8f%91%e9%80%81%e7%94%b5%e5%ad%90%e9%82%ae%e4%bb%b6-%e6%88%91%e5%a6%82%e4%bd%95%e5%9c%a8-saas-%e6%a0%b7%e6%9d%bf%e4%b8%ad%e5%a4%84%e7%90%86%e7%94%b5%e5%ad%90%e9%82%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53342\/","title":{"rendered":"\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p>\u6700\u8fd1\u53d1\u73b0\u4e0d\u5c11\u5c0f\u4f19\u4f34\u90fd\u5bf9<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u5f88\u611f\u5174\u8da3\uff0c\u6240\u4ee5\u4eca\u5929\u7ee7\u7eed\u7ed9\u5927\u5bb6\u4ecb\u7ecd<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u77e5\u8bc6\uff0c\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6\u300b<\/span>\u4e3b\u8981\u5185\u5bb9\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01\u5f53\u7136\u5982\u679c\u9605\u8bfb\u672c\u6587\u65f6\u5b58\u5728\u4e0d\u540c\u60f3\u6cd5\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8868\u8fbe\uff0c\u4f46\u662f\u8bf7\u52ff\u4f7f\u7528\u8fc7\u6fc0\u7684\u63aa\u8f9e~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241129\/1732864188674968bc56e84.jpg\" class=\"aligncenter\" title=\"\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6\u63d2\u56fe\" alt=\"\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6\u63d2\u56fe\" \/><\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728 nuxt 3 \u4e2d\u6784\u5efa\u4efb\u4f55\u4e25\u8083\u7684\u4e1c\u897f\uff0c\u60a8\u5c06\u9700\u8981\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002<br \/> \u8fd9\u662f\u6211\u7684\u8bbe\u7f6e\uff0c\u53ef\u8ba9\u60a8\u5728 resend\u3001sendgrid \u6216\u4efb\u4f55\u5176\u4ed6\u63d0\u4f9b\u7a0b\u5e8f\u4e4b\u95f4\u5207\u6362\uff0c\u800c\u65e0\u9700\u91cd\u5199\u4ee3\u7801\u3002<\/p>\n<h2> \u8bbe\u7f6e <\/h2>\n<ul>\n<li> adonisjs mail\uff08\u6211\u8ba9\u5b83\u5728 adonisjs \u4e4b\u5916\u5de5\u4f5c\uff0c\u56e0\u6b64\u5b83\u53ef\u4ee5\u4e0e\u4efb\u4f55 js \u540e\u7aef\u4e00\u8d77\u5de5\u4f5c\uff09<\/li>\n<li> \u7528\u4e8e\u6a21\u677f\u7684 vue \u7535\u5b50\u90ae\u4ef6<\/li>\n<li>\u53ef\u4e0e\u4efb\u4f55\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u5408\u4f5c\uff08resend\u3001aws ses\u3001mailgun\u3001sparkpost\u3001brevo\u3001\u81ea\u5b9a\u4e49 smtp\uff09<\/li>\n<\/ul>\n<h2> \u57fa\u672c\u914d\u7f6e <\/h2>\n<pre>const generatemailer = async () =&gt; {\n  const mailer = await generatemailer({\n    default: \"resend\",\n    from: {\n      address: \"hi@saas-boilerplate.dev\",\n      name: \"saas boilerplate\",\n    },\n    mailers: {\n      resend: transports.resend({\n        key: process.env.resend_api_key || \"\",\n        baseurl: \"https:\/\/api.resend.com\",\n      }),\n      \/\/ easy to add more providers!\n      sendgrid: transports.sendgrid({\n        key: process.env.sendgrid_api_key || \"\",\n      })\n    },\n  });\n\n  return mailer;\n};\n<\/pre>\n<h2> \u4f7f\u7528 vue email \u7684\u7535\u5b50\u90ae\u4ef6\u6a21\u677f <\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u9b54\u672f\u94fe\u63a5\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\uff1a<\/p>\n<pre>&lt;template&gt;\n  &lt;html&gt;\n    &lt;body&gt;\n      &lt;container&gt;\n        &lt;heading&gt;sign in to your account&lt;\/heading&gt;\n        &lt;text&gt;hi {{ username }},&lt;\/text&gt;\n        &lt;text&gt;click the button below to sign in:&lt;\/text&gt;\n        &lt;section&gt;\n          &lt;button :href=\"signinlink\"&gt;sign in&lt;\/button&gt;\n        &lt;\/section&gt;\n        &lt;text&gt;\n          or copy this link: \n          &lt;link :href=\"signinlink\"&gt;{{ signinlink }}&lt;\/link&gt;\n        &lt;\/text&gt;\n        &lt;hr \/&gt;\n        &lt;text&gt;this link expires in 1 hour.&lt;\/text&gt;\n      &lt;\/container&gt;\n    &lt;\/body&gt;\n  &lt;\/html&gt;\n&lt;\/template&gt;\n&lt;script setup lang=\"ts\"&gt;\nimport {\n  body, button, container, heading,\n  html, link, section, text, hr\n} from \"@vue-email\/components\";\n\ninterface props {\n  username?: string;\n  signinlink?: string;\n}\n\nwithdefaults(defineprops&lt;props&gt;(), {\n  username: \"user\",\n  signinlink: \"https:\/\/app.example.com\/sign-in\",\n});\n&lt;\/script&gt;\n<\/pre>\n<h2> \u53d1\u9001\u7535\u5b50\u90ae\u4ef6 <\/h2>\n<pre>import magiclinksignin from \"~\/emails\/magiclinksignin.vue\";\nconst mailer = await getmailer();\nawait mailer.send(async (message) =&gt; {\n  message\n    .to(email)\n    .subject(\"magic link sign in\")\n    .html(\n      await render(magiclinksignin, {\n        username: user?.name,\n        signinlink: url,\n      })\n    );\n});\n<\/pre>\n<h2> adonisjs mail \u7684\u70ab\u9177\u529f\u80fd <\/h2>\n<p>adonisjs mail \u9644\u5e26\u4e86\u5927\u91cf\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u7684\u5f3a\u5927\u529f\u80fd\uff1a<\/p>\n<ol>\n<li> <strong>\u591a\u79cd\u4f20\u8f93\u652f\u6301<\/strong>\uff1a\u53ea\u9700\u4e00\u884c\u4ee3\u7801\u5373\u53ef\u5728\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u4e4b\u95f4\u5207\u6362<\/li>\n<li> <strong>\u65e5\u5386\u6d3b\u52a8<\/strong>\uff1a\u5c06\u65e5\u5386\u9080\u8bf7\u9644\u52a0\u5230\u60a8\u7684\u7535\u5b50\u90ae\u4ef6<\/li>\n<li> <strong>\u6587\u4ef6\u9644\u4ef6<\/strong>\uff1a\u8f7b\u677e\u9644\u52a0\u6587\u4ef6\u3001\u6d41\u6216\u7f13\u51b2\u533a<\/li>\n<li> <strong>html\/\u6587\u672c\u6a21\u677f<\/strong>\uff1a\u652f\u6301 html \u548c\u7eaf\u6587\u672c\u7535\u5b50\u90ae\u4ef6<\/li>\n<\/ol>\n<p>\u4f8b\u5982\uff0c\u9644\u52a0\u65e5\u5386\u9080\u8bf7\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<pre>message.icalEvent((calendar) =&gt; {\n  calendar.createEvent({\n    summary: 'Team Meeting',\n    start: DateTime.local().plus({ minutes: 30 }),\n    end: DateTime.local().plus({ minutes: 60 }),\n  })\n});\n<\/pre>\n<h2> \u4e3a\u4ec0\u4e48\u8fd9\u4e2a\u6548\u679c\u5f88\u597d <\/h2>\n<ul>\n<li>\u968f\u65f6\u5207\u6362\u63d0\u4f9b\u5546<\/li>\n<li>\u5728 vue \u4e2d\u7f16\u5199\u6a21\u677f<\/li>\n<li>\u6613\u4e8e\u6d4b\u8bd5<\/li>\n<li>\u4efb\u4f55 js \u540e\u7aef\u4e2d adonisjs mail \u7684\u6240\u6709\u529f\u80fd<\/li>\n<\/ul>\n<h2> \u81ea\u5df1\u5c1d\u8bd5\u4e00\u4e0b <\/h2>\n<p>\u60f3\u4e86\u89e3\u66f4\u591a\u6709\u5173 adonisjs mail \u7684\u529f\u80fd\u5417\uff1f\u67e5\u770b\u4ed6\u4eec\u7684\u8be6\u7ec6\u6587\u6863\u3002<\/p>\n<p>\u6b64\u7535\u5b50\u90ae\u4ef6\u8bbe\u7f6e\u662f\u6211\u7684 nuxt saas \u6837\u677f\u7684\u4e00\u90e8\u5206\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u6784\u5efa saas\uff0c\u8bf7\u68c0\u67e5\u4e00\u4e0b &#8211; \u5b83\u9644\u5e26\u4f7f\u7528 trpc \u7684\u7c7b\u578b\u5b89\u5168 api\u3001\u4f01\u4e1a\u7ea7 rbac\uff08\u57fa\u4e8e\u89d2\u8272\u7684\u8bbf\u95ee\u63a7\u5236\uff09\u4ee5\u53ca\u8eab\u4efd\u9a8c\u8bc1\u3001\u56e2\u961f\u7ba1\u7406\u548c\u8ba1\u8d39\u7b49\u751f\u4ea7\u5c31\u7eea\u529f\u80fd.<\/p>\n<p>\u6bcf\u4e2a\u529f\u80fd\u7684\u6784\u5efa\u90fd\u4e0e\u6b64\u7535\u5b50\u90ae\u4ef6\u7cfb\u7edf\u4e00\u6837\u6ce8\u91cd\u5f00\u53d1\u4eba\u5458\u4f53\u9a8c\u3002<\/p>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300a\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u7c73\u4e91\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03\u6587\u7ae0\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u5982\u4f55\u4f7f\u7528 Canvas \u5b9e\u73b0\u52a8\u6001\u56fe\u50cf\u6a21\u7cca\u6548\u679c\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6 \u6536\u85cf \u6700\u8fd1\u53d1\u73b0\u4e0d\u5c11\u5c0f\u4f19\u4f34\u90fd\u5bf9\u6587\u7ae0\u5f88\u611f\u5174\u8da3\uff0c\u6240\u4ee5\u4eca\u5929\u7ee7\u7eed\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u6587\u7ae0\u76f8\u5173\u7684\u77e5\u8bc6\uff0c\u672c\u6587\u300a\u5728 Nuxt \u4e2d\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 \u6211\u5982\u4f55\u5728 SaaS \u6837\u677f\u4e2d\u5904\u7406\u7535\u5b50\u90ae\u4ef6\u300b\u4e3b\u8981\u5185\u5bb9\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01\u5f53\u7136\u5982\u679c\u9605\u8bfb\u672c\u6587\u65f6\u5b58\u5728\u4e0d\u540c\u60f3\u6cd5\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8868\u8fbe\uff0c\u4f46\u662f\u8bf7\u52ff\u4f7f\u7528\u8fc7\u6fc0\u7684\u63aa\u8f9e~ \u5982\u679c\u60a8\u6b63\u5728 nuxt 3 \u4e2d\u6784\u5efa\u4efb\u4f55\u4e25\u8083\u7684\u4e1c\u897f\uff0c\u60a8\u5c06\u9700\u8981\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002 \u8fd9\u662f\u6211\u7684\u8bbe\u7f6e\uff0c\u53ef\u8ba9\u60a8\u5728 resend\u3001sendgrid \u6216\u4efb\u4f55\u5176\u4ed6\u63d0\u4f9b\u7a0b\u5e8f\u4e4b\u95f4\u5207\u6362\uff0c\u800c\u65e0\u9700\u91cd\u5199\u4ee3\u7801\u3002 \u8bbe\u7f6e adonisjs mail\uff08\u6211\u8ba9\u5b83\u5728 adonisjs \u4e4b\u5916\u5de5\u4f5c\uff0c\u56e0\u6b64\u5b83\u53ef\u4ee5\u4e0e\u4efb\u4f55 js \u540e\u7aef\u4e00\u8d77\u5de5\u4f5c\uff09 \u7528\u4e8e\u6a21\u677f\u7684 vue \u7535\u5b50\u90ae\u4ef6 \u53ef\u4e0e\u4efb\u4f55\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u5408\u4f5c\uff08resend\u3001aws ses\u3001mailgun\u3001sparkpost\u3001brevo\u3001\u81ea\u5b9a\u4e49 smtp\uff09 \u57fa\u672c\u914d\u7f6e const generatemailer = async () =&gt; { const mailer = await generatemailer({ default: &#8220;resend&#8221;, from: { address: &#8220;hi@saas-boilerplate.dev&#8221;, name: &#8220;saas boilerplate&#8221;, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53342","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53342"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53342\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}