A modern phone verification login system with Taobao-inspired UI design, built with React TypeScript frontend and Node.js backend.
This project demonstrates a complete authentication system using phone number verification, similar to popular Chinese e-commerce platforms. It features a clean, responsive interface and secure backend implementation.
- 📱 Phone Verification: Chinese mobile number validation and SMS-style verification
- 🎨 Taobao UI: Orange-themed design matching Taobao's visual style
- 🔐 Secure Authentication: JWT tokens and rate limiting
- 💾 Persistent Sessions: Login state saved across browser sessions
- 📱 Responsive Design: Works on desktop and mobile devices
- ⚡ Modern Stack: React TypeScript + Node.js + SQLite
- Node.js (version 14 or higher)
- npm (comes with Node.js)
# Clone the repository
git clone <repository-url>
cd taobei-login
# Install backend dependencies
cd backend
npm install
npm run init-db
# Install frontend dependencies
cd ../frontend
npm install# Terminal 1: Start backend server
cd backend
npm start
# Backend runs on http://localhost:3001
# Terminal 2: Start frontend server
cd frontend
npm run dev
# Frontend runs on http://localhost:3000- Open http://localhost:3000 in your browser
- Click "立即登录" (Login Now)
- Enter a Chinese mobile number (e.g., 13800138000)
- Click "获取验证码" (Get Verification Code)
- Enter any 6-digit code (e.g., 123456)
- Click "登录" (Login)
taobei-login/
├── backend/ # Node.js backend server
│ ├── src/ # Source code
│ │ ├── controllers/ # API controllers
│ │ ├── database/ # Database setup and models
│ │ ├── middleware/ # Express middleware
│ │ ├── routes/ # API routes
│ │ └── utils/ # Utility functions
│ ├── data/ # SQLite database files
│ ├── test/ # Backend tests
│ └── README.md # Backend documentation
├── frontend/ # React TypeScript frontend
│ ├── src/ # Source code
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ └── utils/ # API utilities
│ ├── test/ # Frontend tests
│ └── README.md # Frontend documentation
└── README.md # This file
- React 18 with TypeScript
- Vite for build tooling
- Vitest for testing
- Inline CSS styling (Taobao theme)
- Node.js with Express.js
- SQLite database
- JWT authentication
- Jest for testing
POST /api/auth/request-code- Request verification codePOST /api/auth/login- Login with phone and codeGET /api/health- Health check
- PhoneNumberInput - Chinese mobile number validation
- VerificationCodeInput - 6-digit code input
- CountdownButton - Timer for code requests
- LoginForm - Complete login interface
- User management with SQLite
- Verification code generation and validation
- JWT token authentication
- Rate limiting and security
cd backend
npm run dev # Start with nodemon
npm test # Run tests
npm run init-db # Initialize databasecd frontend
npm run dev # Start development server
npm test # Run tests
npm run build # Build for productionBoth frontend and backend include comprehensive test suites:
# Test backend
cd backend && npm test
# Test frontend
cd frontend && npm test- Input validation and sanitization
- Rate limiting (5 requests per minute)
- JWT token authentication
- SQL injection prevention
- CORS configuration
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
This project is for demonstration purposes.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if needed
- Submit a pull request
For questions or issues, please check the individual README files in the backend/ and frontend/ directories for detailed documentation.