A Java web application that enables users to manage digital currency transactions, user following, and account management.
The application follows a layered architecture:
├── model/ # Data models
├── dao/ # Data Access Objects for database operations
├── service/ # Business logic layer
├── util/ # Utility classes
└── web/ # Web layer (servlets and JSPs)
- User Management: Registration, authentication, and profile management
- Transaction System: PPS transfers, deposits, and withdrawals
- Following System: User following and social features
- Security: Password hashing, input validation, and SQL injection prevention
- Java JDK 8 or higher
- MySQL 5.7 or higher
- Maven 3.6 or higher
- Tomcat 9.0 or higher
- Database Setup
CREATE DATABASE testdb;
USE testdb;
-- Create required user
CREATE USER 'john'@'localhost' IDENTIFIED BY 'pass1234';
GRANT ALL PRIVILEGES ON testdb.* TO 'john'@'localhost';
FLUSH PRIVILEGES;- Clone the Repository
git clone <repository-url>
cd pps-project- Configure Database Connection
- Update database credentials in
util/DatabaseConnection.javaif needed - Default configuration:
- URL: jdbc:mysql://127.0.0.1:3306/testdb
- Username: john
- Password: pass1234
- Build the Project
mvn clean install- Deploy to Tomcat
- Copy the generated WAR file to Tomcat's webapps directory
- Start Tomcat server
- Access
/registerto create a new account - Required fields: email, password, name, address, birthday
- System automatically initializes account with 0 PPS and dollar balance
- Login at
/loginwith email and password - System uses secure password hashing with PBKDF2
-
Deposit
- Add dollars to your account
- Minimum deposit: $1
-
Buy PPS
- Convert dollars to PPS
- Current rate: 1 PPS = $1
-
Transfer PPS
- Send PPS to other users
- Requires sufficient PPS balance
- Instant transfer with transaction logging
-
Withdraw
- Convert dollars back to your bank account
- Requires sufficient dollar balance
- Follow other users
- View follower/following lists
- See transaction history
-
Password Security
- PBKDF2 hashing with random salt
- 10,000 iterations for key derivation
- Secure storage of hashed passwords
-
Database Security
- Prepared statements to prevent SQL injection
- Connection pooling with HikariCP
- Transaction management with rollback support
-
Input Validation
- Server-side validation of all inputs
- Custom exception handling
- Proper error messages
CREATE TABLE users (
emailid VARCHAR(50) PRIMARY KEY,
password VARCHAR(50) NOT NULL,
fName VARCHAR(20),
lname VARCHAR(20),
Address VARCHAR(50),
birthday DATE,
PPSbalance BIGINT,
Dollarbal BIGINT
);
CREATE TABLE Follow (
emailid VARCHAR(50),
followerid VARCHAR(20),
followdate datetime,
FOREIGN KEY (emailid) REFERENCES Users(emailid)
);
CREATE TABLE Transaction (
transid INTEGER AUTO_INCREMENT PRIMARY KEY,
transname VARCHAR(50),
dollaramt INTEGER,
PPSamt INTEGER,
PPSbal INTEGER,
fromuser VARCHAR(50),
touser VARCHAR(50),
FOREIGN KEY (fromuser) REFERENCES Users(emailid),
FOREIGN KEY (touser) REFERENCES Users(emailid)
);The system implements a comprehensive error handling strategy:
- Custom ServiceException for business logic errors
- Proper transaction rollback on failures
- Detailed error logging
- User-friendly error messages
-
Connection Pooling
- HikariCP for efficient connection management
- Configurable pool size (default: 10)
- Connection timeout handling
-
Query Optimization
- Prepared statement caching
- Proper indexing on frequently queried columns
- Efficient transaction management
-
Code Style
- Follow Java naming conventions
- Use proper JavaDoc documentation
- Implement proper exception handling
- Write unit tests for new features
-
Version Control
- Create feature branches for new development
- Write meaningful commit messages
- Review code before merging
-
Testing
- Write unit tests for new features
- Test all error scenarios
- Validate security measures
Common issues and solutions:
-
Database Connection Failed
- Verify MySQL is running
- Check credentials in DatabaseConnection.java
- Ensure database and tables exist
-
Deployment Issues
- Check Tomcat logs
- Verify WAR file structure
- Confirm Java version compatibility
-
Transaction Failures
- Check user balances
- Verify database constraints
- Review transaction logs
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.