feat: add SST Ion v3 deployment configuration#3
Open
alexespejo wants to merge 1 commit into
Open
Conversation
Sets up the full SST Ion v3 infrastructure so the project can be deployed to AWS when ready, without requiring any code changes at deploy time. - sst.config.ts: declares all secrets (Firebase client SDK x7, FirebaseAdminSdk, DB creds, ProdClientHostname), provisions an Express-on-Lambda API with a Function URL, and a Vite StaticSite with VITE_BACKEND_HOSTNAME auto-wired to the Lambda URL - server/src/lambda.ts: serverless-http entry point wrapping the existing Express app; local dev via server.ts is unchanged - server/config/firebase.ts: load service account from FIREBASE_ADMIN_SDK env var in production, fall back to local JSON file for dev (avoids bundling a missing file in Lambda) - server/db/db-pgp.ts: fix PROB_DB_PORT typo → PROD_DB_PORT - server/package.json: add serverless-http ^3 - package.json: add sst ^3 dev dependency - .gitignore: exclude .sst/ platform artifacts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sst.config.ts— SST Ion v3 config that declares all required secrets, provisions an Express-on-Lambda API (sst.aws.Functionwith Function URL), and a Vite/React static site (sst.aws.StaticSite).VITE_BACKEND_HOSTNAMEis auto-wired to the Lambda URL at deploy time.server/src/lambda.ts— new Lambda entry point wrapping the existing Express app viaserverless-http. Local dev is unaffected (still runs viaserver.ts).server/config/firebase.ts— rewritten to load the Firebase Admin SDK from aFIREBASE_ADMIN_SDKenv var (JSON string) in production, falling back to the localfirebase-adminsdk.jsonfile for dev. The old static JSON import would crash Lambda bundling since the file is gitignored.server/db/db-pgp.ts— fixedPROB_DB_PORTtypo →PROD_DB_PORT.server/package.json— addedserverless-http ^3.package.json— addedsst ^3dev dependency..gitignore— added.sst/(SST platform artifacts).Secrets required before deploying
Set each via
npx sst secret set <Name> <value> [--stage <stage>]:FirebaseApiKey…FirebaseMeasurementId(7 vars)FirebaseAdminSdk$(cat server/config/firebase-adminsdk.json)DbHostname,DbUsername,DbPassword,DbName,DbPortProdClientHostnameFirst-time deploy sequence
Notes for reviewers
new sst.Secret(...)+.valueinenvironmentpattern documented in the config comments.ProdClientHostnamemust be set in a second deploy pass to avoid a circular dependency between the Lambda CORS config and the CloudFront URL.removal: "remove"so ephemeral resources are cleaned up automatically.Test plan
yarn installsucceeds withserverless-httpaddedyarn dev) still works — server still starts viaserver.tsnpx sst@3 installruns without errorsnpx sst deploy --stage <dev-stage>completes and returnsClientUrl/ApiUrloutputs🤖 Generated with Claude Code