Skip to content

Code-Crew-Nexus/PawsConnectHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

PawsConnect Hub

Community Platform for Pet Lovers, Marketplace, and Session-Based Authentication

Project Status License Java Maven Tomcat

GitHub stars GitHub forks GitHub watchers

Languages and Tools πŸ› οΈ

Java Jakarta Servlet Maven MySQL Tomcat HTML5 CSS3 JavaScript

Project Analysis πŸ”

PawsConnect Hub is a Java Servlet web application packaged as a WAR file and deployed on Apache Tomcat. The current implementation provides user registration/login/session management and static pages for marketplace and community experiences.

High-level architecture flow:

  1. Browser UI pages submit authentication requests.
  2. Servlet controllers validate input and process requests.
  3. DAO layer executes SQL operations through JDBC.
  4. JSON responses are returned to the frontend.
  5. User session state is managed using HttpSession.

What It Does ✨

  • Registers users through a servlet endpoint.
  • Authenticates users and creates sessions.
  • Exposes current session details as JSON.
  • Invalidates sessions on logout.
  • Serves static pages for index, blog, community, marketplace, and login.

Features πŸš€

  • Java Servlet authentication module.
  • Session-aware frontend navbar behavior.
  • MySQL-backed persistence layer.
  • SQL schema for users, posts, and marketplace items.
  • Maven WAR build pipeline.
  • Vercel rewrites for static route mapping in vercel.json.

Project Structure πŸ—‚οΈ

PawsConnectHub/
|-- pom.xml
|-- vercel.json
|-- .gitignore
|-- .gitattributes
|-- README.md
|-- docs/
|   |-- DATABASE_SETUP.MD
|   `-- requirement.txt
|-- src/
|   `-- main/
|       |-- java/com/pawsconnect/
|       |   |-- controller/
|       |   |   |-- LoginServlet.java
|       |   |   |-- LogoutServlet.java
|       |   |   |-- RegisterServlet.java
|       |   |   `-- SessionServlet.java
|       |   |-- dao/
|       |   |   `-- UserDAO.java
|       |   |-- model/
|       |   |   `-- User.java
|       |   `-- util/
|       |       `-- DBConnection.java
|       |-- resources/
|       |   `-- schema.sql
|       `-- webapp/
|           |-- index.html
|           |-- login.html
|           |-- marketplace.html
|           |-- community.html
|           |-- blog.html
|           `-- js/
|               `-- auth.js
`-- target/

Requirements πŸ“‹

Full requirements are listed in:

Quick view:

Database Setup Guide πŸ—„οΈ

Database initialization, schema import, credential configuration, and troubleshooting are documented in a dedicated guide.

  • Purpose: keep database instructions centralized, detailed, and easy to maintain.
  • Open guide: docs/DATABASE_SETUP.MD

Clone the Repository πŸ“₯

Use these commands to copy the project locally and move into the project root:

git clone https://github.com/Code-Crew-Nexus/PawsConnectHub.git
cd PawsConnectHub

After cloning, confirm you are in the correct directory:

pwd

Expected output ends with PawsConnectHub.

Environment Setup βš™οΈ

Configure the full development environment first. This section only prepares tools and dependencies.

1. Verify Java installation

Install JDK 26, then run:

java -version
javac -version

Confirm both commands return Java 26.

2. Verify Maven installation

Install Maven 3.9+, then run:

mvn -version

Confirm Maven is detected and uses the same Java installation.

3. Complete database setup using the dedicated guide

Follow docs/DATABASE_SETUP.MD for:

  • MySQL verification
  • Database creation
  • Schema import
  • DBConnection credential update
  • Connection validation and DB troubleshooting

4. Prepare Apache Tomcat

Install Apache Tomcat 10+, then identify your Tomcat home folder.

Common locations:

  • Windows: C:\apache-tomcat-10.x.x
  • Linux/Arch: /opt/tomcat or /usr/share/tomcat

5. Build the project artifact

From the project root, run:

mvn clean package

On success, WAR file is generated at target/PawsConnect.war.

Step-by-Step: Running the Program ▢️

Use this section after environment setup is complete.

Option A: Run via Tomcat deployment (recommended)

  1. Copy target/PawsConnect.war to Tomcat's webapps folder.
  2. Start Tomcat server.
  3. Wait until deployment logs show app deployment completed.
  4. Open http://localhost:8080/PawsConnect/.
  5. Open http://localhost:8080/PawsConnect/login.html to test auth flow.

Option B: Run via IntelliJ IDEA

  1. Open project in IntelliJ IDEA.
  2. Configure project SDK as Java 26.
  3. Add a Tomcat Local run configuration.
  4. Add deployment artifact PawsConnect:war exploded.
  5. Start the configuration.
  6. Open http://localhost:8080/PawsConnect/.

Step-by-Step smoke test checklist

  1. Open login page and register a test user.
  2. Login with the same credentials.
  3. Confirm session endpoint returns logged-in response: http://localhost:8080/PawsConnect/api/session.
  4. Logout and verify session endpoint returns loggedIn false.

If startup fails

  1. Recheck DB credentials in src/main/java/com/pawsconnect/util/DBConnection.java.
  2. Confirm MySQL is running and database pawsconnect exists.
  3. Rebuild with mvn clean package.
  4. Verify deployment context path is PawsConnect.

API Endpoints πŸ”Œ

Method Endpoint Purpose
POST /PawsConnect/login Login user and create session
POST /PawsConnect/register Register a new user
GET /PawsConnect/logout Invalidate active session
GET /PawsConnect/api/session Return current session state

Source File Responsibilities 🧩

Security Notes πŸ”

  • Password constant in src/main/java/com/pawsconnect/util/DBConnection.java is intentionally blank now.
  • You must set your local DB password before running the app.
  • Current auth flow stores plain text passwords in DB columns (password_hash field name is misleading).
  • For production, migrate to strong hashing (bcrypt or Argon2).

Troubleshooting 🧯

  • 404 for app routes:
    • Confirm deployment context is PawsConnect.
  • DB connection failures:
  • Build issues:
    • Ensure local JDK version matches compiler settings in pom.xml.
  • Session endpoint not returning loggedIn true:
    • Verify login call succeeded and browser preserves session cookies.

Future Improvements 🌱

  • Add password hashing and salting.
  • Move credentials to environment variables or external config.
  • Add unit and integration tests.
  • Introduce role-based authorization.
  • Build REST APIs for frontend decoupling.

Contributors πŸ‘₯

  • Zaheer Abbas
  • Metri Naveen

Contributions are welcome through issues and pull requests.

Additional Links πŸ”—

About

Java Servlet + JSP web application with MySQL backend. Features user login, marketplace, community posts, and admin oversight.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors