Echo is a simple console-based social media application built using Core Java, JDBC, and PostgreSQL.
It allows users to register, log in, create posts, comment, like, follow others, and manage their profiles securely.
It also includes an Admin Role with moderation features to manage users, posts, and comments.
- Register – Create a new account with username, email, and password
- Regex validation for inputs
- Password hashing using SHA-256
- Duplicate check for username and email
- Login – Secure login with hashed password verification
- Exit – Exit the application
- View Profile – Display user details
- Create a Post – Add a new text post
- View My Posts – Show only your posts
- View All Posts – Display posts from all users
- View Followee Posts – Show posts from users you follow
- Search Posts – Search posts by keyword
- View My Comments – List all your comments
- Follow / Unfollow Users – Manage following list
- Delete Account – Remove your account and related data
- Logout – Return to start menu
- Edit Post – Modify your own posts
- Delete Post – Remove your own posts
- Like / Unlike Post – Toggle like for any post
- View / Add Comments – See and add comments to a post
- Go Back – Return to previous menu
- Edit Comment – Modify your own comment
- Delete Comment – Remove your own comment
- Go Back – Return to previous menu
The Admin account provides system-wide moderation and management features:
- View All Posts – Access every post in the system
- Delete Any Post – Remove inappropriate or duplicate posts
- Delete Any Comment – Remove unwanted comments
- Delete Any User – Permanently delete user accounts
Admin features are only available to users with the admin role.
- Language: Java (JDK 11 or above)
- Database: PostgreSQL (v17 or above)
- Driver: PostgreSQL JDBC Driver (
postgresql-42.7.8.jar)
Make sure you have:
- JDK 11 or later
- PostgreSQL 17 or later
- PostgreSQL JDBC Driver (
postgresql-42.7.8.jar)
- Open psql or pgAdmin
- Create the database and user manually:
CREATE DATABASE echo_db;
CREATE ROLE echo_user LOGIN PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE echo_db TO echo_user;- Run "Database initialization.sql" to create necessary tables according to users, posts, comments, follows, likes.
Edit the resources/application.properties file:
db.url = jdbc:postgresql://localhost:5432/echo_db
db.username = echo_user
db.password = 12345678Download the PostgreSQL JDBC driver from 🔗 https://jdbc.postgresql.org/download/
Then add it to your project:
Right click project → Open Module Settings → Libraries → Add → Select the driver jar
- Passwords are hashed using SHA-256 before saving to the database
- Input validation using regular expressions for username, email, and password
- Duplicate checks for existing usernames and emails
- Only post/comment authors or admins can delete content
- JDBC PreparedStatements used to prevent SQL Injection
- Graceful exception handling for invalid inputs