A full-stack ATM simulation built with React, Express, and TypeScript that provides a realistic banking interface experience.
- Card Authentication: Simulate card insertion and PIN verification
- Balance Inquiry: Check account balance and available credit
- Cash Withdrawal: Withdraw money with validation and limits
- Cash Deposit: Deposit money to your account
- Transaction History: View recent transactions
- Session Management: Automatic timeout and security features
- Responsive Design: Works on desktop and mobile devices
- React 18 with TypeScript
- Tailwind CSS for styling
- shadcn/ui component library
- React Query for state management and API calls
- Vite for build tooling
- Express.js with TypeScript
- Drizzle ORM for database operations
- PostgreSQL database support
- Express Session for authentication
- Zod for validation
- Node.js (v18 or higher)
- npm or yarn
-
Clone the repository
git clone <your-repo-url> cd atm-simulation
-
Install dependencies
npm install
-
Set up environment variables Create a
.envfile in the root directory:DATABASE_URL=your_postgresql_connection_string SESSION_SECRET=your_session_secret_key NODE_ENV=development
-
Initialize the database
npm run db:push
-
Start the development server
npm run dev
The application will be available at http://localhost:5000
- Card Number: 4111111111111234
- PIN: 4567
- Click "Insert Card" on the welcome screen
- Enter your PIN using the numeric keypad
- Navigate through the main menu to:
- Check your balance
- Withdraw cash (multiples of $20, max $1000)
- Deposit cash (max $10,000)
- View transaction history
- Change PIN (demo only)
POST /api/auth/verify-card- Verify card numberPOST /api/auth/verify-pin- Verify PINPOST /api/auth/logout- End session
GET /api/accounts/balance- Get account balanceGET /api/accounts/details- Get account details
POST /api/transactions/withdraw- Withdraw moneyPOST /api/transactions/deposit- Deposit moneyGET /api/transactions/history- Get transaction history
GET /api/session/status- Check session statusPOST /api/session/refresh- Refresh session
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── contexts/ # React context providers
│ │ ├── pages/ # Application screens
│ │ ├── hooks/ # Custom React hooks
│ │ └── lib/ # Utility functions
├── server/ # Express backend
│ ├── database.ts # Database storage implementation
│ ├── storage.ts # Storage interface & in-memory implementation
│ ├── routes.ts # API route definitions
│ └── index.ts # Server entry point
├── shared/ # Shared types and schemas
│ └── schema.ts # Database schema & validation
└── README.md
npm run dev- Start development servernpm run build- Build for productionnpm run db:push- Push database schema changesnpm run db:studio- Open Drizzle Studio
- ATMContext: Global state management for the application
- ATMLayout: Consistent layout wrapper for all screens
- Pages: Individual ATM screens (welcome, PIN entry, main menu, etc.)
- Storage Interface: Abstraction layer for data persistence
- Routes: RESTful API endpoints with session management
- Database: PostgreSQL integration with Drizzle ORM
- Session-based authentication
- PIN validation with error handling
- Transaction limits and validation
- Automatic session timeout (2 minutes)
- Input sanitization and validation
- Realistic ATM interface design
- Smooth animations and transitions
- Mobile-responsive layout
- Accessibility-friendly components
- Loading states and error handling
This application is designed to run on Replit. The server binds to 0.0.0.0:5000 to ensure proper port forwarding.
DATABASE_URL=your_production_postgresql_url
SESSION_SECRET=your_secure_session_secret
NODE_ENV=production- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Demo uses hardcoded card number and PIN
- In-memory storage resets on server restart
- Session timeout is set to 2 minutes for demo purposes
For questions or issues, please open an issue on the repository or contact the development team.
Note: This is a simulation for educational purposes. Do not use in production environments without proper security audits and enhancements.