This file contains the exact commands and environment mapping required to deploy the fullstack application.
From the repository root:
cd cloudformation
aws cloudformation deploy \
--template-file gemarse-estate-resources.yaml \
--stack-name gemarse-estate-resources \
--parameter-overrides EnvironmentName=prod \
--capabilities CAPABILITY_NAMED_IAMS3BucketNameCognitoUserPoolIdCognitoUserPoolClientIdS3UploaderUserNameS3UploaderAccessKeyId
Also capture the IAM user access key secret shown by AWS after stack creation.
Provision a PostgreSQL database manually, for example using AWS RDS.
Use a connection string like:
postgresql://DB_USER:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME
Create server/.env with the following values:
PORT=8000
DATABASE_URL=postgresql://user:password@host:5432/database
JWT_SECRET=replace_with_a_secure_secret
AWS_REGION=your_aws_region
AWS_ACCESS_KEY_ID=ACCESS_KEY_ID_FROM_CLOUDFORMATION
AWS_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY_FROM_AWS
S3_BUCKET_NAME=THE_BUCKET_NAME_OUTPUT
NODE_ENV=productionCreate client/.env.local with:
NEXT_PUBLIC_API_BASE_URL=https://your-backend-domain
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=your_mapbox_access_token
NEXT_PUBLIC_AWS_COGNITO_USER_POOL_ID=COGNITO_USER_POOL_ID
NEXT_PUBLIC_AWS_COGNITO_USER_POOL_CLIENT_ID=COGNITO_USER_POOL_CLIENT_ID
NEXT_PUBLIC_APP_URL=https://your-frontend-domainFrom the server/ folder:
cd server
npm install
npx prisma generate
npm run seedFrom the server/ folder:
npm install
eb init
eb create gemarse-estate-apiThen configure environment variables in the Elastic Beanstalk console or with:
eb setenv \
PORT=8000 \
DATABASE_URL=postgresql://user:password@host:5432/database \
JWT_SECRET=replace_with_a_secure_secret \
AWS_REGION=your_aws_region \
AWS_ACCESS_KEY_ID=ACCESS_KEY_ID_FROM_CLOUDFORMATION \
AWS_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY_FROM_AWS \
S3_BUCKET_NAME=THE_BUCKET_NAME_OUTPUTDeploy:
eb deployDeploy the backend to your chosen hosting service and ensure NEXT_PUBLIC_API_BASE_URL points to its public URL.
- Connect the
clientfolder to Vercel. - Set the frontend environment variables from step 4.
- Deploy.
- Connect the repository to Amplify.
- Set environment variables.
- Deploy.
| CloudFormation output | .env variable |
|---|---|
S3BucketName |
S3_BUCKET_NAME |
CognitoUserPoolId |
NEXT_PUBLIC_AWS_COGNITO_USER_POOL_ID |
CognitoUserPoolClientId |
NEXT_PUBLIC_AWS_COGNITO_USER_POOL_CLIENT_ID |
S3UploaderAccessKeyId |
AWS_ACCESS_KEY_ID |
| IAM Secret Access Key | AWS_SECRET_ACCESS_KEY |
- Visit the frontend URL.
- Sign in or sign up.
- Ensure API calls succeed.
- Upload a property image to confirm S3 works.
- Confirm property data is loaded from the database.
- If you deploy the backend behind HTTPS, use that URL in
NEXT_PUBLIC_API_BASE_URL. - If you use Vercel or Amplify, set the env vars in the hosting dashboard.
- Keep
JWT_SECRETsecret and do not commit it to source control.