-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
128 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SST secrets are for runtime values. | ||
# For secrets needed at build and deploy time, SST automatically picks up the .env file. | ||
|
||
# https://docs.stripe.com/keys | ||
# NOTE: this is the Stripe secret, not the public key | ||
STRIPE_API_KEY="" | ||
# https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ | ||
CLOUDFLARE_API_TOKEN="" | ||
# https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/ | ||
CLOUDFLARE_DEFAULT_ACCOUNT_ID="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Hono } from 'hono' | ||
import { logger } from 'hono/logger' | ||
import { handle } from 'hono/aws-lambda' | ||
import * as stripe from './stripe' | ||
|
||
const app = new Hono().use(logger()) | ||
|
||
app.get('/', (ctx) => ctx.text('This works')) | ||
app.route('/hook/stripe', stripe.route) | ||
|
||
export const handler = handle(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { domain } from './dns' | ||
import { secret } from './secret' | ||
import { webhook } from './stripe' | ||
|
||
export const api = new sst.aws.Function('Api', { | ||
url: true, | ||
handler: 'functions/api/index.handler', | ||
link: [secret.DATABASE_URL, secret.RESEND_API_KEY, secret.STRIPE_SECRET_KEY, webhook], | ||
}) | ||
|
||
new sst.aws.Router('ApiRouter', { | ||
domain: { | ||
name: `api.${domain}`, | ||
dns: sst.cloudflare.dns(), | ||
}, | ||
routes: { '/*': api.url }, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const domain = | ||
{ | ||
production: 'sivir.tech', | ||
dev: 'dev.sivir.tech', | ||
}[$app.stage] || `${$app.stage}.sivir.tech` | ||
|
||
// export const zone = cloudflare.getZoneOutput({ | ||
// name: 'sivir.tech', | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { domain } from './dns' | ||
|
||
sst.Linkable.wrap(stripe.WebhookEndpoint, (endpoint) => { | ||
return { | ||
properties: { | ||
id: endpoint.id, | ||
secret: endpoint.secret, | ||
}, | ||
} | ||
}) | ||
|
||
export const webhook = new stripe.WebhookEndpoint('StripeWebhook', { | ||
url: $interpolate`https://api.${domain}/hook/stripe`, | ||
metadata: { | ||
stage: $app.stage, | ||
}, | ||
enabledEvents: [ | ||
'checkout.session.completed', | ||
'customer.subscription.updated', | ||
'customer.subscription.deleted', | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
import { domain } from './dns.ts' | ||
import { secret } from './secret.ts' | ||
|
||
export const www = new sst.aws.Remix('Remix', { | ||
domain: { | ||
name: domain, | ||
dns: sst.cloudflare.dns(), | ||
}, | ||
environment: { | ||
NODE_ENV: $dev === true ? 'development' : 'production', | ||
HOST_URL: $dev === true ? 'http://localhost:5173' : `https://${domain}`, | ||
}, | ||
link: [ | ||
secret.SESSION_SECRET, | ||
secret.ENCRYPTION_SECRET, | ||
secret.DATABASE_URL, | ||
secret.RESEND_API_KEY, | ||
secret.STRIPE_PUBLIC_KEY, | ||
secret.STRIPE_SECRET_KEY, | ||
secret.StripeWebhookEndpoint, | ||
secret.HONEYPOT_ENCRYPTION_SEED, | ||
], | ||
}) | ||
|
||
export const outputs = { | ||
www: www.url, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters