This document describes the high-level architecture and design decisions for the eBay Auction Platform.
The application follows a monolithic, layered architecture with server-side rendering:
- Monolithic web application - Single deployable WAR file
- Layered architecture - Clear separation between presentation, business logic, and data access
- Server-side rendering - JSP for dynamic HTML generation
┌─────────────────────────────────────────────┐
│ Browser (Client) │
└─────────────────┬───────────────────────────┘
│ HTTP
↓
┌─────────────────────────────────────────────┐
│ Servlet Container (Tomcat) │
│ ┌────────────────────────────────────────┐ │
│ │ Filters (Auth, CORS, etc.) │ │
│ └──────────────┬─────────────────────────┘ │
│ ↓ │
│ ┌────────────────────────────────────────┐ │
│ │ Servlets (Controllers) │ │
│ │ - LoginServlet │ │
│ │ - CreateProductServlet │ │
│ │ - BidServlet │ │
│ │ - AdminDashboardServlet │ │
│ └──────────────┬─────────────────────────┘ │
│ ↓ │
│ ┌────────────────────────────────────────┐ │
│ │ JSP Views (Presentation) │ │
│ └────────────────────────────────────────┘ │
└─────────────────┬───────────────────────────┘
│ JDBC
↓
┌─────────────────────────────────────────────┐
│ DAO Layer (Data Access Objects) │
│ - UserDao │
│ - ProductDao │
│ - BidDao │
│ - StatsDao │
└─────────────────┬───────────────────────────┘
│ SQL
↓
┌─────────────────────────────────────────────┐
│ MySQL Database │
│ Tables: users, products, departments, bids │
└─────────────────────────────────────────────┘
Located in src/main/webapp/WEB-INF/jsp/
Responsibilities:
- Render HTML based on model data
- Display forms and user interfaces
- No business logic or direct database access
Key Views:
auth/login.jsp,auth/register.jspproduct/create.jsp,product/list.jspadmin/dashboard.jsp,admin/users.jsp
Located in src/main/java/com/nettenz/ebay/servlet/
Responsibilities:
- Handle HTTP requests and responses
- Perform validation and authorization checks
- Orchestrate business logic
- Delegate persistence to DAO classes
- Forward to appropriate JSP views
Examples:
LoginServlet- Handles authenticationCreateProductServlet- Product creation logicBidServlet- Bidding operationsAdminDashboardServlet- Admin statistics
Located in src/main/java/com/nettenz/ebay/filter/
Responsibilities:
- Cross-cutting concerns (authentication, logging, CORS)
- Intercept requests before they reach servlets
- Enforce security policies
Key Component:
AuthFilter- Session validation and role-based authorization
Located in src/main/java/com/nettenz/ebay/dao/
Responsibilities:
- Encapsulate all SQL logic
- Use JDBC with PreparedStatements
- Prevent SQL injection
- Provide clean API for data operations
Examples:
UserDao- User CRUD operationsProductDao- Product managementBidDao- Bidding operationsStatsDao- Dashboard statistics
Technology: MySQL 8.x
Core Tables:
users- User accounts with rolesproducts- Auction listingsdepartments- Product categoriesbids- Bid history and tracking
See db/schema.sql for details.
sequenceDiagram
User->>+LoginServlet: POST credentials
LoginServlet->>+UserDao: findByUsername()
UserDao->>+MySQL: SELECT user
MySQL-->>-UserDao: User record
UserDao-->>-LoginServlet: User object
LoginServlet->>LoginServlet: BCrypt.verify(password)
LoginServlet->>Session: Store user object
LoginServlet-->>-User: Redirect to dashboard
User->>+ProductServlet: GET /products
ProductServlet->>AuthFilter: Check session
AuthFilter->>Session: Get user
AuthFilter-->>ProductServlet: Authorized
ProductServlet-->>-User: Display products
- User submits credentials
LoginServletqueries database viaUserDao- Password verified via BCrypt
- User object stored in HTTP session
- Subsequent requests checked by
AuthFilter - Role-based access enforced (USER vs ADMIN)
Upload Flow:
- Multipart form data received by
CreateProductServlet - Files stored on disk in
uploads/directory - Image path saved to database
- Images served through
ImageServlet
External URLs:
- Supports external image URLs as fallback
- Validated before storage
Current Implementation:
BidDaofor bid persistence and queriesBidServletfor bid placement- Highest bid tracking per product
- Bid history display
Planned Enhancements:
- Transaction-safe bid validation
- Concurrent bid handling
- Bid increment rules
- Reserve pricing
- Auto-close on auction end
✅ Password Security
- BCrypt hashing with 12 rounds
- Salted and stored securely
✅ SQL Injection Prevention
- PreparedStatements for all queries
- No string concatenation in SQL
✅ Session Management
- HTTP sessions for authentication state
- Role-based access control
- 🔄 CSRF tokens for state-changing operations
- 🔄 HTTPS enforcement
- 🔄 Input sanitization (XSS prevention)
- 🔄 Rate limiting on auth endpoints
- 🔄 Audit logging for admin actions
See Security Guide for details.
Build Process:
Maven → JAR dependencies + WAR packaging → Tomcat deploymentRuntime:
- Apache Tomcat 10.1+ (Servlet Container)
- MySQL 8.x (Database Server)
- File system (Image uploads)
Configuration:
- Database credentials (currently hardcoded)
- Upload paths (configurable)
- Session timeout settings
See Deployment Guide for production setup.
- Auction closing scheduler (cron/timer)
- Enhanced bid validation
- Environment-based configuration
- REST API layer
- SPA frontend (React/Vue)
- Microservices architecture
- Cloud deployment (AWS/Azure)
- Real-time bidding with WebSockets
- MVC (Model-View-Controller) - Servlet/JSP separation
- DAO (Data Access Object) - Database abstraction
- Factory - Database connection management
- Filter Chain - Request interception
- Session Facade - User state management