This project demonstrates how to integrate AWS Cognito with a Vue 3 application for user authentication. The app includes custom registration and login components, and it is containerized using Docker for easy deployment and scalability.
The Vue Cognito App allows users to register and log in using AWS Cognito. It showcases how to manage authentication in a Vue 3 app using the AWS Cognito service, without relying on the default UI components provided by AWS. This project is set up with Docker to ensure that the environment is consistent across development and production setups.
Before you start, ensure you have the following installed:
- Clone the Repository
git clone https://your-repository-url-here.git
cd vue-cognito-app
- Install Dependencies and Configure AWS Cognito
- Install Amplify CLI:
npm install -g @aws-amplify/cli
- Configure Amplify CLI:
amplify configure
- Initialize Amplify in Your Project:
amplify init
- Add Authentication:
amplify add auth
- Deploy the Backend:
amplify push
- Install Amplify Libraries
npm install aws-amplify @aws-amplify/ui-vue
- Local Development
- To run the application locally:
npm run serve
- This command will start a local development server. Open http://localhost:8080 to view it in the browser. The app will automatically reload if you make changes to any of the source files.
- Build the Docker Image
docker build -t vue-cognito-app .
- Run the Docker Container
docker run -it -p 8080:
YOUR_DOCKER_PORT_NUMBER
vue-cognito-app
- Now, your application is running inside a Docker container. Access it via http://localhost:8080 in any web browser.
- Testing: Run
npm run test
to execute the unit tests via Jest. - Building for Production: To build the app for production, run:
npm run build
- This builds the app for production to the
dist/
folder. It correctly bundles Vue in production mode and optimizes the build for the best performance.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.