CARVIEW |
Select Language
HTTP/2 200
date: Wed, 30 Jul 2025 15:51:26 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"818f52a0f3409a9b60ec5d9cb4ab179e"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=7NFZYmOINtRSkKsMkgB%2BRijc6b6%2Fz%2F3Spyr7IDsTGINRrKqyJvd3i3HCRmhfRjnC9L74LfRc7uKW2sRRo95O0z6FCBn2gC6hl9RqWOXE6DOJEP1b2O0qEgtJlEGlSiNfotTEfkL5H1h9ZnAVOdnwdTRGvv8qT%2Bs%2BMfN6mivjIiilzNGG2snZCx4tHwJuokpb1HOiegfDr8rWvm1xbh35lRrWrHpIKTaTCOg2xTCHfBd0WqFVFISQTL0mSPFAEDwbyIbw%2FxdoRLDJCunAjz5wAQ%3D%3D--0ve4U%2B80CScXkYO6--doyUir7IDeeiTlj2vkUrKQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.630993540.1753890686; Path=/; Domain=github.com; Expires=Thu, 30 Jul 2026 15:51:26 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 30 Jul 2026 15:51:26 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 88E2:2DD0BF:723CB:86351:688A3F7E
GitHub - Lissy93/dl-sb-iac: ⚙️ The IaC for Domain Locker's Supabase setup
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 0
⚙️ The IaC for Domain Locker's Supabase setup
License
Lissy93/dl-sb-iac
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
____ _ _ _ | _ \ ___ _ __ ___ __ _(_)_ __ | | ___ ___| | _____ _ __ | | | |/ _ \| '_ ` _ \ / _` | | '_ \ | | / _ \ / __| |/ / _ \ '__| | |_| | (_) | | | | | | (_| | | | | | | |__| (_) | (__| < __/ | |____/ \___/|_| |_| |_|\__,_|_|_| |_| |_____\___/ \___|_|\_\___|_| >> This repo contains the config, schema and edge functions for Domain Locker << >> For the main project and app, see https://github.com/lissy93/domain-locker << ================================================================================ DIRECTORY STRUCTURE ================================================================================ domain-locker-edge/ ├─ supabase/ │ ├─ functions/ # Deno Edge functions │ │ ├─ [function]/ # Directory for each function │ │ │ ╰─ index.ts # Entry point for the function │ │ ╰─ shared/ # Utilities for edge functions │ ├─ migrations/ # Database schema │ ├─ templates/ # Mailer templates │ ╰─ config.toml # Supabase configuration ├─ .github/ # Repo admin, and GH Actions │ ├─ workflows/ # CI/CD files for deployment │ ╰─ README.txt # You're looking at it ;) ├─ Makefile # Project commands ├─ deno.json # Deno project config ╰─ .gitignore # Stuff to not commit ================================================================================ DEVELOPING ================================================================================ Pre-requisites: - Install Git, Deno, Supabase CLI, Postgres and Docker on your local machine - Deploy a Supabase instance. See https://supabase.io/docs/guides/self-hosting - Configure all the required environmental variables for services (see below) Project setup: git clone git@github.com:Lissy93/domain-locker-edge.git supabase link --project-ref PROJECT_REF Development: supabase start supabase status supabase functions serve ================================================================================ DEPLOYING ================================================================================ supabase secrets set-from-env # Set environments supabase config push # Apply configuration supabase db push # Deploy schema supabase functions deploy # Deploy functions See the `Makefile` for all deployment commands. The easiest way to deploy is via GitHub Actions, which we use for CI/CD. Just push to main or trigger the supabase.yml workflow, and it will deploy You'll need to configure the following GitHub secrets to authenticate: SUPABASE_PROJECT_ID - The Supabase project ID SUPABASE_ACCESS_TOKEN - The Supabase access token SUPABASE_DB_PASSWORD - The Postgres password for your Supabase DB SUPABASE_ENV_FILE - Raw text env vars for all else you need (see below) ================================================================================ FUNCTIONS ================================================================================ Stripe and Billing: - cancel-subscription Cancels a user's subscription - checkout-session Creates a new checkout session for a subscription - stripe-webhook Handles incoming events triggered from Stripe - new-user-billing Create/updates Stripe customer, and applies user plan - stripe-details Fetches Stripe billing and customer details for a user User Management: - delete-account Deletes a user account and all associated data - export-data Exports all (selected) data for a user in a given format Domain Management: - trigger-updates Selects domains for users, and triggers domain-updater - domain-updater Updates domains with latest info, triggers notifications - send-notification Sends a notification to user id with message - website-monitor Gets response info for each (pro) domain, updates db - expiration-invites Creates a calendar invite 90 days before domain expiry - expiration-reminders Triggers reminders for upcoming domain expirations Maintenance: - cleanup-monitor-data Averages historic data from website monitoring - cleanup-notifications Ensures notifications have been sent, removes old ones - health Checks system health, returns service statuses Info Routes: - domain-info Fetches all info for any given domain name - domain-subs Fetches all subdomains for any given domain ================================================================================ UTILITIES ================================================================================ There's some shared utils that all/most the functions use, these are: - logger - For consistent logging, with different levels (info, warn, error) - Can integrate with external logging services for better monitoring - Can report error logs to GlitchTip/Sentry or other error tracking - monitor - Monitors function duration and status - If `X-Cron-Run` header is set, will send to Healthcheck for cron monitoring - Can integrate with external monitoring services for better insights - serveWithCors - Wraps Deno HTTP server, but with shared headers and config set - Handles CORS preflight requests, using `APP_ORIGIN` for allowed domains - Throws suitable error for unauthorized, unsupported or bad requests - supabaseClient - Provides a shared Supabase client for functions - Handles authentication and authorization for user requests - Uses the JWT from bearer token to apply correct permissions and RLS ================================================================================ ENVIRONMENT VARIABLES ================================================================================ Supabase: DB_URL - The URL to your Supabase instance and project DB_KEY - The anon key to your new Supabase project Config: APP_ORIGIN - The origin URL for client-app (for CORS) Monitoring: HC_URL - The URL to the Healthcheck service GLITCHTIP_URL - URL to your GlitchTip/Sentry instance GLITCHTIP_TOKEN - DSN token for GlitchTip/Sentry LOGFLARE_ENDPOINT_URL - The Logflare endpoint URL DL_LOGGING_ENABLED - Enable or disable logging Authentication SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID - Google OAuth Client ID SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET - Google OAuth Secret SUPABASE_AUTH_EXTERNAL_FACEBOOK_CLIENT_ID - Facebook OAuth Client ID SUPABASE_AUTH_EXTERNAL_FACEBOOK_SECRET - Facebook OAuth Secret SUPABASE_AUTH_EXTERNAL_GITHUB_CLIENT_ID - GitHub OAuth Client ID SUPABASE_AUTH_EXTERNAL_GITHUB_SECRET - GitHub OAuth Secret API Endpoints: AS93_DOMAIN_INFO_URL - The URL to our external domain info API AS93_DOMAIN_INFO_KEY - And the key for the domain info API AS93_SPONSORS_API - The URL to our GitHub sponsors API Worker Endpoints: WORKER_DOMAIN_UPDATER_URL - The URL to domain-updater function WORKER_SEND_NOTIFICATION_URL - The URL to send-notification function Stripe: STRIPE_SECRET_KEY - Stripe secret key (starting with sk_live_ or sk_test_) STRIPE_WEBHOOK_SECRET - Stripe webhook secret (starting with whsec_) Stripe Prices: STRIPE_PRICE_HM - Stripe price ID for the hobby monthly plan (starting price_) STRIPE_PRICE_HA - Price ID for the hobby annual plan STRIPE_PRICE_PM - Price ID for the pro monthly plan STRIPE_PRICE_PA - Price ID for the pro annual plan Resend: RESEND_API_KEY - The API key for the Resend service (send access) RESEND_SENDER - The sender email for Resend Twilio: TWILIO_SID - Twilio account SID TWILIO_AUTH_TOKEN - Twilio auth token TWILIO_PHONE_NUMBER - Twilio phone number TWILIO_WHATSAPP_NUMBER - Twilio WhatsApp number Telegram TELEGRAM_BOT_TOKEN - The token for the telegram notification bot It's advisable to use a secret store for this. We use Supabase Vault. Or, you can pass secrets to Supabase, by running: - supabase secrets set --env-file supabase/functions/.env Or, to edit a single variable: - supabase secrets set VAR_NAME=some_value ================================================================================ CRON JOBS ================================================================================ Some functions are triggered at specific times or intervals as scheduled crons We do this directly from Postgres's pg_cron using the `cron.schedule` function This is mainly used for keeping data up-to-date, triggering alerts and cleaning We have the following crons setup with `cron.schedule` function. - cleanup-monitor-data (runs daily, e.g. 0 2 * * *) - new-user-billing (runs daily, e.g. 0 3 * * *) - run_domain_update_job (runs daily, e.g. 0 4 * * *) - cleanup-notifications (runs daily, e.g. 0 5 * * *) - expiration-invites (runs daily, e.g. 0 6 * * *) - expiration-reminders (runs daily, e.g. 0 7 * * *) - monitor-uptimes (runs hourly, e.g. 0 * * * *) Example SQL to create a cron: select cron.schedule( 'cleanup-notifications', '0 5 * * *', $$ SELECT net.http_post( url := ( SELECT decrypted_secret FROM vault.decrypted_secrets WHERE name = 'project_url' ) || '/functions/v1/cleanup-notifications', headers := jsonb_build_object( 'Content-Type', 'application/json', 'Authorization', 'Bearer ' || ( SELECT decrypted_secret FROM vault.decrypted_secrets WHERE name = 'service_key' ), 'X-Cron-Run', 'true' ), body := jsonb_build_object('invoked_at', now()) ); $$ ); ================================================================================ SUPPORT ================================================================================ We do not provide support for this codebase. It is provided as-is. If you need help, please refer to the official docs for the services used. We are not accepting feature requests or bug reports (except security issues). The difficulty of deploying this project is graded at moderate to hard You'll need a solid understanding of Deno, Supabase, Postgres and Docker It is also possible to run Domain Locker without Supabase, using Postgres only. ================================================================================ NOTES ================================================================================ For troubleshooting, ensure protocol, method, port, headers and body are correct You must set and upload ALL environmental variables properly for things to work Avoid configuring in the Supabase UI, instead update the TOML file and re-deploy Example CURL request: curl -i --location \ --request POST 'https://[project].supabase.co/functions/v1/hello-world' \ --header 'Authorization: Bearer xxxxx' \ --header 'Content-Type: application/json' \ --data '{"name":"Dino"}' Or, for local dev, the URL would be: 127.0.0.1:54321/functions/v1/hello-world It is your responsibility to maintain, secure and backup your Supabase instance ================================================================================ LICENSE ================================================================================ Copyright (c) 2025 Alicia Sykes Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================================ ABOUT ================================================================================ Coded with ❤ and ♨ by Alicia Sykes https://aliciasykes.com Built for Domain Locker https://domain-locker.com Thanks for being here! (●'◡'●) ================================================================================ __ /°_) _.----._/ / / / __/ ( | ( | /__.-'|_|--|_|
About
⚙️ The IaC for Domain Locker's Supabase setup
Resources
License
Stars
Watchers
Forks
Sponsor this project
You can’t perform that action at this time.