Amazon HackOn Season 5 Submission
A middleware solution integrated with Amazon Pay with SmartCoins rewards and Offline Payment Storing (SnapPay).
Live Demo: VaultX - Secure Payment Platform Default PIN: 123456
Presentation: Team What-If - VaultX Project Presentation
Demo Video in YT: Demo Video of showcasing the entire prototype and its functionalities
- π Overview
- β¨ Features
- ποΈ Architecture
- π οΈ Tech Stack
- π¦ Installation
- π§ Configuration
- π Usage
- π API Endpoints
- π― Key Components
- π Security Features
- π± Screenshots
- π€ Acknowledgments
VaultX is a middleware prototype solution integrated with Amazon Pay, to help users experience a more smoother payment experience. Equipped with SnapPay, Our Offline Payment system with Smartcoins that refund whenever there is a price drop post-purchase, VaultX is a solution that not only benefits Tier 2/3 Rural Users who have low connectivity of internet, but also those people who have a hard time buying products with digital money.
- Secure Payments: Biometric authentication and PIN-based security
- Smart Rewards: SmartCoins system for customer loyalty
- Trust Scoring: Advanced seller trust and safety metrics
- Offline-First: Robust offline payment processing
- Price Intelligence: Real-time price tracking and history
- Automated Refunds: AWS Lambda-powered automatic refund processing
- Biometric Authentication: Face-ID and PIN-based security
- Offline Processing: Payments work without internet connection
- Transaction Sync: Automatic synchronization when online
- Multi-factor Security: PIN lockout protection and retry limits
- Refund Rewards: Earn SmartCoins from product refunds
- Balance Tracking: Real-time SmartCoins balance
- Transaction History: Complete refund and reward history
- Price History Access: Direct access to product price charts
- Seller Trust Scoring: Multi-dimensional trust analysis
- Safe Shopping Score: Comprehensive safety metrics
- Price Drop Tracking: Monitor product price changes
- Refund Rate Analysis: Seller reliability indicators
- Price History Dashboard: Interactive price charts
- Seller Performance: Detailed seller analytics
- Transaction Monitoring: Real-time payment tracking
- Network Status: Connectivity monitoring
- Price Change Detection: AWS Lambda monitors product price changes
- Automatic Refund Calculation: Intelligent refund amount computation
- Backend Integration: Seamless refund processing through API
- Frontend Updates: Real-time SmartCoins balance updates
- Transaction History: Complete audit trail of automatic refunds
VaultX/
βββ app/ # Next.js App Router
β βββ api/ # API Routes
β β βββ products/ # Product management
β β βββ smartcoins/ # SmartCoins system
β β βββ seller-trust/ # Trust scoring
β β βββ transactions/ # Payment processing
β βββ components/ # React components
β βββ dashboard/ # Analytics dashboard
β βββ vaultx/ # Main VaultX interface
β βββ auth/ # Authentication pages
βββ components/ # Shared UI components
βββ lib/ # Utility functions
βββ public/ # Static assets
βββ styles/ # Global styles
AWS Infrastructure/
βββ DynamoDB/ # NoSQL database
β βββ products/ # Product data
β βββ price_history/ # Price change tracking
β βββ refunds/ # Refund records
β βββ transactions/ # Payment transactions
βββ Lambda Functions/ # Serverless processing
β βββ price-change-monitor/ # Price change detection
β βββ refund-calculator/ # Refund amount computation
β βββ smartcoins-updater/ # Balance updates
- Next.js 15.2.4 - React framework with App Router
- TypeScript 5.0 - Type-safe JavaScript
- Tailwind CSS 3.4.17 - Utility-first CSS framework
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icons
- Chart.js - Interactive charts and graphs
- AWS DynamoDB - NoSQL database for scalability
- AWS Lambda - Serverless functions for automated processing
- Next.js API Routes - Serverless API endpoints
- IndexedDB - Client-side data storage
- LocalStorage - Fallback storage
- Biometric Auth - Face-ID and PIN security
- PIN Management - Secure PIN storage and validation
- Offline Security - Local data encryption
- ESLint - Code linting
- PostCSS - CSS processing
- Autoprefixer - CSS vendor prefixing
- Node.js 18+
- npm or pnpm
- AWS Account (for DynamoDB)
-
Clone the repository
git clone https://github.com/yourusername/Amazon-HackOn-Season-5.git cd Amazon-HackOn-Season-5 -
Install dependencies
npm install (if this fails then use npm install -legacy -peer -deps) # or pnpm install
-
Environment Configuration Create a
.env.localfile:AWS_REGION=eu-north-1 AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key
-
Run the development server
npm run dev # or pnpm dev -
Open your browser Navigate to http://localhost:3000
-
Create DynamoDB Tables
# Products table aws dynamodb create-table \ --table-name products \ --attribute-definitions AttributeName=id,AttributeType=N \ --key-schema AttributeName=id,KeyType=HASH \ --billing-mode PAY_PER_REQUEST # Price history table aws dynamodb create-table \ --table-name price_history \ --attribute-definitions AttributeName=id,AttributeType=S \ --key-schema AttributeName=id,KeyType=HASH \ --billing-mode PAY_PER_REQUEST # Refunds table aws dynamodb create-table \ --table-name refunds \ --attribute-definitions AttributeName=id,AttributeType=S \ --key-schema AttributeName=id,KeyType=HASH \ --billing-mode PAY_PER_REQUEST # Transactions table aws dynamodb create-table \ --table-name transactions \ --attribute-definitions AttributeName=id,AttributeType=S \ --key-schema AttributeName=id,KeyType=HASH \ --billing-mode PAY_PER_REQUEST
-
Configure IAM Permissions Ensure your AWS credentials have DynamoDB read/write permissions.
// Comprehensive seller trust analysis
<SellerDetailModal
sellerId="seller_001"
isOpen={true}
onClose={handleClose}
/>- Browse Products: Visit the homepage to see featured products
- Make Payment: Click "Pay Now" and authenticate with PIN
- Earn SmartCoins: Get rewarded for refunds and price drops
- Track History: View transaction and price history
- API Integration: Use the RESTful API endpoints
- Custom Components: Extend the UI component library
- Database Operations: Work with DynamoDB tables
- Authentication: Implement custom auth flows
GET /api/products/[id]- Get product detailsPATCH /api/products/[id]/price- Update product pricePOST /api/products/[id]/price-drop- Process price dropGET /api/products/[id]/price-history- Get price history
GET /api/smartcoins?userId={id}- Get user's SmartCoins balance
GET /api/seller-trust- Get all sellers with trust scoresGET /api/seller-trust?sellerId={id}- Get specific seller details
POST /api/transactions- Process payment transactions
// Secure PIN-based authentication with offline support
<BiometricAuth
onSuccess={handleTransactionSuccess}
onError={handleError}
amount={100}
productId="123"
/>// Interactive price charts with real-time data
<PriceHistoryChart
productId="123"
data={priceHistoryData}
/>- 6-digit PIN: Secure numeric authentication
- Lockout Protection: 5 failed attempts trigger 20-second lockout
- Biometric Support: Face-ID authentication ready
- Offline Security: Local data protection
- Encrypted Storage: Sensitive data encryption
- Secure APIs: Parameterized queries prevent injection
- Network Security: HTTPS enforcement
- Session Management: Secure session handling
- User Anonymization: User ID generation
- Data Minimization: Only necessary data collection
- Local Processing: Offline-first approach
-
Create Lambda Functions
# Price Change Monitor Lambda aws lambda create-function \ --function-name vaultx-price-change-monitor \ --runtime nodejs18.x \ --handler index.handler \ --role arn:aws:iam::YOUR_ACCOUNT:role/lambda-execution-role \ --zip-file fileb://price-change-monitor.zip # Refund Calculator Lambda aws lambda create-function \ --function-name vaultx-refund-calculator \ --runtime nodejs18.x \ --handler index.handler \ --role arn:aws:iam::YOUR_ACCOUNT:role/lambda-execution-role \ --zip-file fileb://refund-calculator.zip # SmartCoins Updater Lambda aws lambda create-function \ --function-name vaultx-smartcoins-updater \ --runtime nodejs18.x \ --handler index.handler \ --role arn:aws:iam::YOUR_ACCOUNT:role/lambda-execution-role \ --zip-file fileb://smartcoins-updater.zip
-
Lambda Function Workflow
// Price Change Monitor Lambda export const handler = async (event: any) => { const { productId, oldPrice, newPrice } = event.detail; // Check if refund is applicable if (newPrice < oldPrice) { const refundAmount = oldPrice - newPrice; // Trigger refund calculation await lambda.invoke({ FunctionName: 'vaultx-refund-calculator', Payload: JSON.stringify({ productId, refundAmount }) }); } };
-
Environment Variables
# Lambda Environment Variables DYNAMODB_TABLE_NAME=vaultx_refunds API_ENDPOINT=https://your-api.vercel.app/api SMARTCOINS_RATE=1.0
- Amazon Web Services for DynamoDB and Lambda infrastructure
- Next.js Team for the amazing framework
- Tailwind CSS for the utility-first CSS framework
- Radix UI for accessible components
- HackOn Season 5 organizers for the opportunity
- Nikhil for building the APIs and Backend
- Shreelekha for building the Face-ID Biometric and PPT
- Mansi for building the Seller Trust and UI and PPT
Built with β€οΈ for Amazon HackOn Season 5



