This project is a simple Command-Line Interface (CLI) application for managing car details, user login, and basic operations. It is built using Java, JDBC, and PostgreSQL.
- User Registration
- User Login
- View Car Details
- OTP-based Password Reset
- Utility Functions for Console UI
- Clean DAO-Service-Controller Structure
- Java 17+
- PostgreSQL
- JDBC
- Maven / IDE Build Tools
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.2</version>
</dependency>dependencies {
implementation 'org.postgresql:postgresql:42.7.2'
}Download the JDBC driver manually:
🔗 https://jdbc.postgresql.org/download/
Add the .jar file to your project:
File → Project Structure → Modules → Dependencies → + Add JAR
graph TD;
A[User CLI] --> B[Controller Layer]
B --> C[Service Layer]
C --> D[DAO Layer]
D --> E[(PostgreSQL DB)]
C --> F[Util Functions]
src/main/java/
│
├── com.github.joel003
│ ├── dao/
│ │ └── UserDAO.java
│ ├── service/
│ │ └── UserService.java
│ ├── controller/
│ │ ├── CarController.java
│ │ └── UserController.java
│ ├── entity/
│ │ └── UserDetail.java
│ └── util/
│ ├── DBConnection.java
│ ├── ConsoleHelper.java
│ └── InputValidator.java
└── resources/
Full SQL seed data provided here:
Table: userscars
u_id INT PRIMARY KEY
u_name VARCHAR(100)
u_email VARCHAR(100)
u_mobile VARCHAR(15)
m_address VARCHAR(100)
u_password VARCHAR(100)
A sample dataset of cars is included inside the project.
- Make sure PostgreSQL is running.
- Update DB credentials in
DBConnection.java. - Compile and run the main class.
- User enters email and password
- Application validates using
UserService.verifyUser() - On success, user navigates to user menu
- User enters registered email
- OTP is generated
- User must enter OTP within 10 seconds
- New password is accepted and updated
Provides a single shared database connection.
Clears screen and formats CLI output.
Reusable validation functions for email, phone, numbers, etc.
- Add Admin module
- Add Car Booking functionality
- Add JUnit Tests
- Add Logging with SLF4J
- Encrypt user passwords
This project is licensed under the MIT License.
See the LICENSE file for full details.
Below is a short demo of the CLI in action:
Click below to view all screenshots:
Below is the complete class diagram representing the system architecture.
erDiagram
userscars {
INT u_id PK
VARCHAR u_name
VARCHAR u_email
VARCHAR u_mobile
VARCHAR m_address
VARCHAR u_password
}
carslist {
INT c_id PK
VARCHAR c_brand
VARCHAR c_model
VARCHAR c_color
VARCHAR c_type
INT c_price
}


