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:
- Browser UI pages submit authentication requests.
- Servlet controllers validate input and process requests.
- DAO layer executes SQL operations through JDBC.
- JSON responses are returned to the frontend.
- User session state is managed using HttpSession.
- 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.
- 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.
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/
Full requirements are listed in:
Quick view:
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
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 PawsConnectHubAfter cloning, confirm you are in the correct directory:
pwdExpected output ends with PawsConnectHub.
Configure the full development environment first. This section only prepares tools and dependencies.
Install JDK 26, then run:
java -version
javac -versionConfirm both commands return Java 26.
Install Maven 3.9+, then run:
mvn -versionConfirm Maven is detected and uses the same Java installation.
Follow docs/DATABASE_SETUP.MD for:
- MySQL verification
- Database creation
- Schema import
- DBConnection credential update
- Connection validation and DB troubleshooting
Install Apache Tomcat 10+, then identify your Tomcat home folder.
Common locations:
- Windows:
C:\apache-tomcat-10.x.x - Linux/Arch:
/opt/tomcator/usr/share/tomcat
From the project root, run:
mvn clean packageOn success, WAR file is generated at target/PawsConnect.war.
Use this section after environment setup is complete.
- Copy target/PawsConnect.war to Tomcat's webapps folder.
- Start Tomcat server.
- Wait until deployment logs show app deployment completed.
- Open http://localhost:8080/PawsConnect/.
- Open http://localhost:8080/PawsConnect/login.html to test auth flow.
- Open project in IntelliJ IDEA.
- Configure project SDK as Java 26.
- Add a Tomcat Local run configuration.
- Add deployment artifact
PawsConnect:war exploded. - Start the configuration.
- Open http://localhost:8080/PawsConnect/.
- Open login page and register a test user.
- Login with the same credentials.
- Confirm session endpoint returns logged-in response: http://localhost:8080/PawsConnect/api/session.
- Logout and verify session endpoint returns loggedIn false.
- Recheck DB credentials in src/main/java/com/pawsconnect/util/DBConnection.java.
- Confirm MySQL is running and database
pawsconnectexists. - Rebuild with
mvn clean package. - Verify deployment context path is
PawsConnect.
| 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 |
- src/main/java/com/pawsconnect/controller/LoginServlet.java: Validates login input and creates a session.
- src/main/java/com/pawsconnect/controller/RegisterServlet.java: Validates registration input and inserts user.
- src/main/java/com/pawsconnect/controller/SessionServlet.java: Returns login state and user info.
- src/main/java/com/pawsconnect/controller/LogoutServlet.java: Invalidates session.
- src/main/java/com/pawsconnect/dao/UserDAO.java: Executes auth-related DB queries.
- src/main/java/com/pawsconnect/util/DBConnection.java: Creates JDBC connections.
- src/main/webapp/js/auth.js: Handles frontend auth requests and navbar updates.
- 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_hashfield name is misleading). - For production, migrate to strong hashing (bcrypt or Argon2).
- 404 for app routes:
- Confirm deployment context is
PawsConnect.
- Confirm deployment context is
- DB connection failures:
- Check MySQL status and DB credentials in src/main/java/com/pawsconnect/util/DBConnection.java.
- 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.
- 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.
- Zaheer Abbas
- Metri Naveen
Contributions are welcome through issues and pull requests.