-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supabase SSR #135
Supabase SSR #135
Changes from 9 commits
fc4ead6
ef37a69
1cb39a6
e099baf
48d1f3e
873ec1b
a0fb518
eacd3af
c8eb9ed
a16584d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
**/.svelte-kit/ | ||
**/node_modules/ | ||
**/package-lock.json | ||
|
||
# Don't format plaintext email templates, the new lines are important | ||
src/lib/emails/*_text.svelte |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "svelte.svelte-vscode", | ||
"eslint.validate": ["javascript", "javascriptreact", "svelte"] | ||
"[svelte]": { | ||
"editor.defaultFormatter": "svelte.svelte-vscode" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "svelte"] | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
#!/bin/sh | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
# error on first error | ||||||||||||||||||||||||||||||||||||||||||||||
set -e | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
if ! command -v misspellx &> /dev/null | ||||||||||||||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||||||||||||||
echo "=== Skipping Spell Check ===" | ||||||||||||||||||||||||||||||||||||||||||||||
echo "Skip running spell check using 'misspell' as the tool is not installed." | ||||||||||||||||||||||||||||||||||||||||||||||
echo "Install it using the instructions here: https://github.com/client9/misspell" | ||||||||||||||||||||||||||||||||||||||||||||||
echo "Skipping this check now, but it may fail in CI.\n" | ||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||
echo "=== Running Spell Check ===" | ||||||||||||||||||||||||||||||||||||||||||||||
misspell -error ./src README.md | ||||||||||||||||||||||||||||||||||||||||||||||
echo "no spelling mistakes found\n" | ||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use To ensure compatibility with POSIX sh, use -if ! command -v misspellx &> /dev/null
+if ! command -v misspellx >/dev/null 2>&1 Committable suggestion
Suggested change
ToolsShellcheck
|
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
echo "=== Running Format Check With Prettier ===" | ||||||||||||||||||||||||||||||||||||||||||||||
npm run format_check | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
echo "=== Running Linter ===" | ||||||||||||||||||||||||||||||||||||||||||||||
npm run lint | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
echo "=== Running Svelte Check ===" | ||||||||||||||||||||||||||||||||||||||||||||||
npm run check | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
echo "=== Running Tests ===" | ||||||||||||||||||||||||||||||||||||||||||||||
npm run test_run | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
echo "\n=== All Checks Pass ===\n" | ||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Email Setup | ||
|
||
SaaS Starter includes email capabilities for sending emails to users, and admins. | ||
|
||
There are three types of emails: | ||
|
||
- Admin emails: sent to a static admin email address, useful for monitoring app activity like new signups and contact-us form submissions. | ||
- User emails: sent to the user's email address. For example: a welcome email. | ||
- Auth emails: verifing the user's email address and magic links. Auth emails are covered in the main README setup docs, and not covered here. | ||
|
||
## Set Up Email | ||
|
||
To enable email capabilities, set the following environment variables: | ||
|
||
**Important**: The template includes a welcome email, which will be enabled once you set your Resend API key. You should customize the email to fit your brand and content or remove it **BEFORE** you enable the email with environment variables. See below. | ||
|
||
- `PRIVATE_RESEND_API_KEY`: a https://resend.com API key. Note, you'll need to verify your 'from' domain with them before you can use their service. | ||
- `PRIVATE_ADMIN_EMAIL`: the email address to which admin emails will be sent. If unset, admin emails will not be sent. | ||
- `PRIVATE_FROM_ADMIN_EMAIL`: the email address to use as the from address for admin emails (defaults to `PRIVATE_ADMIN_EMAIL` if not set). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix loose punctuation marks and bare URL. The documentation has loose punctuation marks and a bare URL. Apply this diff to fix the issues: - **Important**: The template includes a welcome email, which will be enabled once you set your Resend API key. You should customize the email to fit your brand and content or remove it **BEFORE** you enable the email with environment variables. See below.
- - `PRIVATE_RESEND_API_KEY`: a https://resend.com API key. Note, you'll need to verify your 'from' domain with them before you can use their service.
- - `PRIVATE_ADMIN_EMAIL`: the email address to which admin emails will be sent. If unset, admin emails will not be sent.
- - `PRIVATE_FROM_ADMIN_EMAIL`: the email address to use as the from address for admin emails (defaults to `PRIVATE_ADMIN_EMAIL` if not set).
+ **Important**: The template includes a welcome email, which will be enabled once you set your Resend API key. You should customize the email to fit your brand and content or remove it **BEFORE** you enable the email with environment variables. See below.
+ - `PRIVATE_RESEND_API_KEY`: a [Resend API key](https://resend.com). Note, you'll need to verify your 'from' domain with them before you can use their service.
+ - `PRIVATE_ADMIN_EMAIL`: the email address to which admin emails will be sent. If unset, admin emails will not be sent.
+ - `PRIVATE_FROM_ADMIN_EMAIL`: the email address to use as the from address for admin emails (defaults to `PRIVATE_ADMIN_EMAIL` if not set).
ToolsLanguageTool
Markdownlint
|
||
|
||
## Customize Welcome Email | ||
|
||
SaaS Starter includes a welcome email template that you can customize to fit your brand and content. The email is sent to the user's email address when create their profile. | ||
|
||
To customize the email: | ||
|
||
- edit the properties like company name, from email, and subject in the call to sendTemplatedEmail in src/routes/(admin)/account/api/+page.server.ts | ||
- edit the plaintext email content in src/lib/emails/welcome_email_text.svelte | ||
- edit the html email content in src/lib/emails/welcome_email_html.svelte - don't forget address and preheader text which won't render in a preview, but will in the client's email client. | ||
|
||
You can also delete the welcome email by removing the call to sendTemplatedEmail in src/routes/(admin)/account/api/+page.server.ts | ||
|
||
## Adding Admin Emails | ||
|
||
Anywhere you'd like to be notified of important events, you can sendan admin email. | ||
|
||
Simply add a call to sendAdminEmail() in the appropriate place, passing a subject and body. | ||
|
||
## Adding Additional User Emails | ||
|
||
You can add more user emails. Create a template in src/lib/emails, using the welcome email as a guide. You should have both a plaintext and html version of the email (see welcome_email_text.svelte and welcome_email_html.svelte), although it will work with just one. | ||
|
||
When you want to send the email, call sendUserEmail() with the appropriate parameters, including the name of the email template. | ||
|
||
You can also use sendTemplatedEmail() to send emails to any email address. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
# Supabase settings | ||
PUBLIC_SUPABASE_URL='https://REPLACE_ME.supabase.co' | ||
PUBLIC_SUPABASE_ANON_KEY='REPLACE_ME' | ||
PRIVATE_SUPABASE_SERVICE_ROLE='REPLACE_ME' | ||
|
||
# Stripe settings | ||
PRIVATE_STRIPE_API_KEY='REPLACE_ME' | ||
|
||
# settings for email - optional | ||
# PRIVATE_ADMIN_EMAIL='[email protected]' | ||
# PRIVATE_FROM_ADMIN_EMAIL='REPLACE_ME' | ||
# PRIVATE_RESEND_API_KEY='REPLACE_ME' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
/bin/bash
in the shebang.To ensure compatibility with the rest of the script, use
/bin/bash
instead of/bin/sh
in the shebang.Committable suggestion