React app with Cognito auth, built with Vite. The backend is defined in
amplify/ using Amplify Gen 2.
- Node.js 20.19+ or 22.12+ (Vite 8 requirement)
- AWS credentials on your machine, for a profile with permission to deploy CloudFormation stacks
npm install
npm run sandboxnpm run sandbox provisions a personal cloud backend and writes
amplify_outputs.json at the repo root. That file is gitignored, and
src/main.jsx imports it directly — so the app does not build until the
sandbox has run at least once. Leave the sandbox running while you develop;
it redeploys on every change under amplify/.
To tear the sandbox down and delete its AWS resources:
npm run sandbox:deleteThe sandbox provisions real AWS resources in your account. A Cognito user pool has no fixed monthly charge, but delete the sandbox when you are done with it.
Runs the app in development mode on http://localhost:3000.
Requires amplify_outputs.json from a sandbox run.
Runs the Vitest suite once and exits. Use npx vitest for watch mode. The tests
render the unwrapped App export, so they need neither a backend nor
amplify_outputs.json.
Builds the app for production into dist — minified, with hashed filenames.
Serves dist locally so the production build can be checked before deploying.
amplify/auth/resource.ts defines Cognito: email as the login attribute,
email required and auto-verified, MFA off, account recovery by email.
amplify/backend.ts then reaches through to the underlying CloudFormation
constructs for three settings defineAuth does not expose:
| Setting | Default | Set to |
|---|---|---|
| Password policy | min 8, requires lower, upper, digit and symbol | min 8, no character-class requirements |
| Refresh token validity | omitted from the template | 30 days |
| Unauthenticated identities | enabled | disabled |
amplify.yml drives Amplify Hosting: the backend phase runs
ampx pipeline-deploy, and the frontend phase publishes dist.
Connect the repository to a new Amplify app in the AWS console and Hosting
supplies $AWS_BRANCH and $AWS_APP_ID to the build automatically.