This repository provides a starter template for creating applications using Next.js (App Router) and AWS Amplify, emphasizing easy setup for authentication, API, and database capabilities.
This template equips you with a foundational Next.js application integrated with AWS Amplify, streamlined for scalability and performance. It is ideal for developers looking to jumpstart their project with pre-configured AWS services like Cognito, AppSync, and DynamoDB.
- Authentication: Setup with Amazon Cognito for secure user authentication.
- API: Ready-to-use GraphQL endpoint with AWS AppSync.
- Database: Real-time database powered by Amazon DynamoDB.
For detailed instructions on deploying your application, refer to the deployment section of our documentation.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
- In order to allow the automatic creation of a test user, a poilcy must exist.
The user pool will not exist until a branch is initially deployed.
If the deployment fails because of [WARNING]: ❌ Error creating or confirming user: AccessDeniedException: User: arn:aws:sts::<aws-account-id>:assumed-role/AmplifySSRLoggingRole-<iam-role-id>/BuildSession is not authorized to perform: cognito-idp:AdminGetUser on resource: arn:aws:cognito-idp:<region>:<aws-account-id>:userpool/<arn_unique-id> because no identity-based policy allows the cognito-idp:AdminGetUser action
Create a policy e.g. CognitoTestUserManagementPolicy that adheres to the following permissions.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cognito-idp:AdminDeleteUser",
"cognito-idp:AdminCreateUser",
"cognito-idp:AdminUpdateUserAttributes",
"cognito-idp:AdminConfirmSignUp",
"cognito-idp:AdminGetUser"
],
"Resource": [
"arn:aws:cognito-idp:<region>:<aws-account-id>:userpool/<arn_unique-id>",
"arn:aws:cognito-idp:<region>:<aws-account-id>:userpool/<arn_unique-id>"
]
}
]
}
and add it to the role: arn:aws:sts::<aws-account-id>:assumed-role/AmplifySSRLoggingRole-<iam-role-id>/BuildSession
callbackUrls: [
`${process.env.AMPLIFY_APP_ORIGIN || 'localhost:3000'}/login`,
'https://<branch>.<app-id>.amplifyapp.com/login',
],
logoutUrls: [
`${process.env.AMPLIFY_APP_ORIGIN || 'localhost:3000'}/logout`,
'https://<branch>.<app-id>.amplifyapp.com/logout',
],