Thomas Basham
A social collaboration app for musicians, refactored to AWS.
- Frontend: Next.js (deployable to AWS Amplify Hosting)
- Auth: Amazon Cognito User Pool (email/password + Google Hosted UI)
- API: API Gateway HTTP API + Lambda (
infra/lambda/http-handler.js) - Realtime: API Gateway WebSocket API + Lambda (
infra/lambda/ws-*.js) - Database: DynamoDB single-table design
- Media: S3 public bucket with presigned upload URLs
- Infrastructure: AWS CDK (
infra/)
infra/bin/collab-done.js: CDK app entryinfra/lib/collab-done-stack.js: AWS stack resourcesinfra/lambda/: backend Lambda handlerscontexts/auth.tsx: Cognito auth providercontexts/RealTime.tsx: chat + websocket client integrationhooks/useResource.tsx: API/S3-backed resource data layerschema: DynamoDB single-table schema reference
- Node.js 20+
- AWS CLI configured
- CDK bootstrap completed in target account/region
npm installCreate .env.local with:
NEXT_PUBLIC_API_BASE_URL=https://your-http-api-id.execute-api.us-west-2.amazonaws.com
NEXT_PUBLIC_WS_URL=wss://your-ws-api-id.execute-api.us-west-2.amazonaws.com/prod
NEXT_PUBLIC_COGNITO_USER_POOL_ID=us-west-2_xxxxx
NEXT_PUBLIC_COGNITO_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_COGNITO_DOMAIN=your-domain.auth.us-west-2.amazoncognito.com
NEXT_PUBLIC_COGNITO_REDIRECT_SIGN_IN=http://localhost:3000
NEXT_PUBLIC_COGNITO_REDIRECT_SIGN_OUT=http://localhost:3000
NEXT_PUBLIC_MEDIA_BASE_URL=https://your-media-bucket.s3.us-west-2.amazonaws.com
NEXT_PUBLIC_TEST_EMAIL=test@example.comUse your IAM profile and region:
npm run cdk:bootstrap -- --profile iamadmin --context region=us-west-2
npm run cdk:deploy -- --profile iamadmin --context region=us-west-2After deployment, copy stack outputs into .env.local.
npm run devnpm run build- Google social login is supported when
googleClientIdandgoogleClientSecretare provided to CDK. - GitHub is not a native Cognito social provider in this stack. It requires a custom OIDC/SAML broker setup and additional Cognito IdP wiring.
- This refactor starts from a clean DynamoDB dataset (no SQL migration path included).