A comprehensive Vue 3 starter application with AWS Cognito integration for user authentication and management. This project provides a running-ready foundation for building secure web applications with user registration, authentication, and protected routes.
Author: Marco Chirico
Version: 1.0.0
License: MIT
This starter kit combines a modern Vue 3 application built with Vite and AWS Cognito for robust user authentication. The included CloudFormation template automates the creation of necessary AWS resources, making it easy to deploy and manage user pools and application clients.
- Complete Authentication Flow: Sign up, email confirmation, login, and logout functionality
- Protected Routes: Route guards for authenticated users
- AWS Cognito Integration: Seamless integration with AWS Cognito User Pools
- CloudFormation Infrastructure: Automated AWS resource provisioning
- Environment Configuration: Flexible configuration through environment variables
- Modern Vue 3 Setup: Built with Composition API and Vue Router
Welcome page with navigation to authentication flows
User registration form with email verification
User login form with authentication
Authenticated user dashboard with user information
βββ src/
β βββ aws-config.js # AWS Amplify configuration
β βββ components/ # Vue components
β βββ views/ # Page components
β βββ router/ # Vue Router configuration
βββ cloudformation/
β βββ cognito.yml # AWS CloudFormation template
βββ .env.example # Environment variables template
βββ README.md # This file
- Node.js 16+ and npm
- AWS CLI configured with appropriate permissions
- Basic knowledge of Vue 3 and AWS Cognito
Copy the environment template and configure your variables:
cp .env.example .envEdit .env with your AWS region and other configuration values.
npm installDeploy the CloudFormation stack to create your Cognito User Pool and App Client:
aws cloudformation deploy \
--template-file cloudformation/cognito.yml \
--stack-name cognito-auth-kit \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
UserPoolName=my-user-pool \
AppClientName=my-app-clientAfter successful deployment, update your .env file with the CloudFormation outputs:
VITE_USER_POOL_IDVITE_USER_POOL_CLIENT_IDVITE_REGION
npm run devThe application will be available at http://localhost:5173.
The CloudFormation template creates a User Pool with the following default settings:
- Email verification required
- Standard password policy
- No application client secret (public client)
You can customize these settings by modifying the cloudformation/cognito.yml template before deployment.
| Variable | Description | Required |
|---|---|---|
VITE_USER_POOL_ID |
Cognito User Pool ID | Yes |
VITE_USER_POOL_CLIENT_ID |
Cognito App Client ID | Yes |
VITE_REGION |
AWS Region | Yes |
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production build
The application is structured for easy customization:
- Modify authentication flows in
src/views/ - Update styling in component files
- Extend AWS configuration in
src/aws-config.js
npm run buildThis project is compatible with AWS Amplify hosting. Connect your repository to Amplify Console for automatic deployments.
The built application can be deployed to any static hosting service:
- Netlify
- Vercel
- GitHub Pages
- S3 + CloudFront
- Never commit
.envfiles to version control - Use appropriate IAM roles and policies
- Consider implementing additional security measures for production
- Review and customize the password policy as needed
- CORS Errors: Ensure your Cognito App Client is configured for your domain
- Authentication Failures: Verify environment variables are correctly set
- CloudFormation Deployment Failures: Check AWS CLI permissions and region settings
- Review AWS Cognito documentation
- Check Vue 3 and Vite documentation
- Examine CloudFormation template for resource configuration
This is a starter template designed for immediate use. For customizations and improvements, consider:
- Adding additional authentication methods
- Implementing user profile management
- Extending the CloudFormation template for additional AWS services
MIT License - see LICENSE file for details.
Note: This starter kit is designed for educational and development purposes. For production use, ensure proper security review and testing of all authentication flows.