Skip to content

humanifest/lovable-base

Repository files navigation

AWS Amplify Next.js (App Router) Starter Template

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.

Overview

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.

Features

  • 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.

Deploying to AWS

For detailed instructions on deploying your application, refer to the deployment section of our documentation.

Security

See CONTRIBUTING for more information.

License

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.

Deploying:

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

Add your dworking domain to your externalProviders in amplify/auth/external-providers.ts

  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',
  ],

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published