# surendra-bhujel/nepalhikehub architecture

> Architecture diagram of the GitHub repository surendra-bhujel/nepalhikehub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/surendra-bhujel/nepalhikehub
- Repository: https://github.com/surendra-bhujel/nepalhikehub

## Overview

NepalHikeHub is a Java servlet/JSP platform for discovering treks, managing accounts and bookings, taking payments, and collecting reviews, with administrative tools for users, treks, and bookings. The user journey runs from public trek browsing and search through booking and payment, then post-trek reviews; registration and sign-in gate protected actions. The graph includes the sampled search, account, trek-management, and review calls. Booking/payment and several admin flows are README/tree-supported capabilities, but their detailed wiring was not sampled, so those links are left out.

Main entry points: [`src/main/java/com/nepalhikehub/util/DBConnection.java`](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/DBConnection.java) (DB connection), [`src/main/java/com/nepalhikehub/service/UserService.java`](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/UserService.java) (User service), [`src/main/webapp/views`](https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/webapp/views) (JSP pages), [`src/main/java/com/nepalhikehub/controller/auth/SignUpServlet.java`](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/auth/SignUpServlet.java) (Registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webpages["JSP pages"]
end

subgraph group_identity["Accounts"]
  node_signup["Registration<br/>[SignUpServlet.java]"]
  node_usersvc["User service<br/>[UserService.java]"]
  node_userdao["User access<br/>[UserDAO.java]"]
  node_validation["Input validation"]
  node_password["Password hashing"]
  node_authservlets["Sign-in / out"]
  node_authfilter["Access control"]
end

subgraph group_trek["Trek operations"]
  node_search["Trek search<br/>[SearchServlet.java]"]
  node_treksvc["Trek service<br/>[TrekService.java]"]
  node_trekdao["Trek access<br/>[TrekDAO.java]"]
  node_trekadmin["Trek administration"]
end

subgraph group_commerce["Booking and feedback"]
  node_booking["Booking workflow"]
  node_bookingdao["Booking access<br/>[BookingDAO.java]"]
  node_payment["Payment workflow"]
  node_paymentsvc["Payment service"]
  node_paymentdao["Payment access<br/>[PaymentDAO.java]"]
  node_review["Review workflow<br/>[ReviewServlet.java]"]
  node_reviewsvc["Review service<br/>[ReviewService.java]"]
  node_reviewdao["Review access<br/>[ReviewDAO.java]"]
  node_admin["Admin operations"]
end

node_visitor(("Visitor / trekker"))
node_database[("MySQL database")]
node_dbconnection["DB connection<br/>[DBConnection.java]"]

node_visitor -->|"browses"| node_webpages
node_visitor -->|"registers"| node_signup
node_signup -->|"forwards"| node_webpages
node_signup -->|"registers user"| node_usersvc
node_usersvc -->|"validates"| node_validation
node_usersvc -->|"hashes password"| node_password
node_usersvc -->|"checks / stores"| node_userdao
node_visitor -->|"signs in"| node_authservlets
node_authfilter -->|"protects views"| node_webpages
node_visitor -->|"searches treks"| node_search
node_search -->|"searches / filters"| node_treksvc
node_search -->|"forwards results"| node_webpages
node_treksvc -->|"queries / updates"| node_trekdao
node_visitor -->|"requests booking"| node_booking
node_visitor -->|"submits payment"| node_payment
node_visitor -->|"submits review"| node_review
node_review -->|"adds / deletes"| node_reviewsvc
node_reviewsvc -->|"validates / queries"| node_reviewdao
node_visitor -->|"administers treks"| node_trekadmin
node_trekadmin -->|"manages treks"| node_treksvc
node_dbconnection -->|"connects"| node_database
node_userdao -->|"uses connection"| node_dbconnection
node_trekdao -->|"uses connection"| node_dbconnection
node_reviewdao -->|"uses connection"| node_dbconnection
node_bookingdao -->|"uses connection"| node_dbconnection
node_paymentdao -->|"uses connection"| node_dbconnection

click node_webpages "https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/webapp/views"
click node_signup "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/auth/SignUpServlet.java"
click node_usersvc "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/UserService.java"
click node_userdao "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/UserDAO.java"
click node_validation "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/ValidationUtil.java"
click node_password "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/PasswordEncryption.java"
click node_authservlets "https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/java/com/nepalhikehub/controller/auth"
click node_authfilter "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/filter/AuthenticationFilter.java"
click node_search "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/SearchServlet.java"
click node_treksvc "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/TrekService.java"
click node_trekdao "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/TrekDAO.java"
click node_trekadmin "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/admin/ManageTreksServlet.java"
click node_booking "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/BookingServlet.java"
click node_bookingdao "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/BookingDAO.java"
click node_payment "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/PaymentServlet.java"
click node_paymentsvc "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/PaymentService.java"
click node_paymentdao "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/PaymentDAO.java"
click node_review "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/ReviewServlet.java"
click node_reviewsvc "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/ReviewService.java"
click node_reviewdao "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/ReviewDAO.java"
click node_admin "https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/java/com/nepalhikehub/controller/admin"
click node_database "https://github.com/surendra-bhujel/nepalhikehub/blob/main/sql/Entities_and_Attributes.sql"
click node_dbconnection "https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/DBConnection.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webpages toneBlue
class node_signup,node_usersvc,node_userdao,node_validation,node_password,node_authservlets,node_authfilter,node_database toneAmber
class node_search,node_treksvc,node_trekdao,node_trekadmin toneMint
class node_booking,node_bookingdao,node_payment,node_paymentsvc,node_paymentdao,node_review,node_reviewsvc,node_reviewdao,node_admin toneRose
class node_visitor toneIndigo
class node_dbconnection toneTeal
```

## Components

### Web experience

- [JSP pages](https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/webapp/views): `src/main/webapp/views`

### Accounts

- [Registration](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/auth/SignUpServlet.java): `src/main/java/com/nepalhikehub/controller/auth/SignUpServlet.java`
- [User service](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/UserService.java): `src/main/java/com/nepalhikehub/service/UserService.java`
- [User access](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/UserDAO.java): `src/main/java/com/nepalhikehub/dao/UserDAO.java`
- [Input validation](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/ValidationUtil.java): `src/main/java/com/nepalhikehub/util/ValidationUtil.java`
- [Password hashing](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/PasswordEncryption.java): `src/main/java/com/nepalhikehub/util/PasswordEncryption.java`
- [Sign-in / out](https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/java/com/nepalhikehub/controller/auth): `src/main/java/com/nepalhikehub/controller/auth`
- [Access control](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/filter/AuthenticationFilter.java): `src/main/java/com/nepalhikehub/controller/filter/AuthenticationFilter.java`

### Trek operations

- [Trek search](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/SearchServlet.java): `src/main/java/com/nepalhikehub/controller/user/SearchServlet.java`
- [Trek service](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/TrekService.java): `src/main/java/com/nepalhikehub/service/TrekService.java`
- [Trek access](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/TrekDAO.java): `src/main/java/com/nepalhikehub/dao/TrekDAO.java`
- [Trek administration](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/admin/ManageTreksServlet.java): `src/main/java/com/nepalhikehub/controller/admin/ManageTreksServlet.java`

### Booking and feedback

- [Booking workflow](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/BookingServlet.java): `src/main/java/com/nepalhikehub/controller/user/BookingServlet.java`
- [Booking access](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/BookingDAO.java): `src/main/java/com/nepalhikehub/dao/BookingDAO.java`
- [Payment workflow](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/PaymentServlet.java): `src/main/java/com/nepalhikehub/controller/user/PaymentServlet.java`
- [Payment service](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/PaymentService.java): `src/main/java/com/nepalhikehub/service/PaymentService.java`
- [Payment access](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/PaymentDAO.java): `src/main/java/com/nepalhikehub/dao/PaymentDAO.java`
- [Review workflow](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/controller/user/ReviewServlet.java): `src/main/java/com/nepalhikehub/controller/user/ReviewServlet.java`
- [Review service](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/service/ReviewService.java): `src/main/java/com/nepalhikehub/service/ReviewService.java`
- [Review access](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/dao/ReviewDAO.java): `src/main/java/com/nepalhikehub/dao/ReviewDAO.java`
- [Admin operations](https://github.com/surendra-bhujel/nepalhikehub/tree/main/src/main/java/com/nepalhikehub/controller/admin): `src/main/java/com/nepalhikehub/controller/admin`

### Other components

- **Visitor / trekker**
- [MySQL database](https://github.com/surendra-bhujel/nepalhikehub/blob/main/sql/Entities_and_Attributes.sql): `sql/Entities_and_Attributes.sql`
- [DB connection](https://github.com/surendra-bhujel/nepalhikehub/blob/main/src/main/java/com/nepalhikehub/util/DBConnection.java): `src/main/java/com/nepalhikehub/util/DBConnection.java`

## Connections

- Visitor / trekker → JSP pages: browses
- Visitor / trekker → Registration: registers
- Registration → JSP pages: forwards
- Registration → User service: registers user
- User service → Input validation: validates
- User service → Password hashing: hashes password
- User service → User access: checks / stores
- Visitor / trekker → Sign-in / out: signs in
- Access control → JSP pages: protects views
- Visitor / trekker → Trek search: searches treks
- Trek search → Trek service: searches / filters
- Trek search → JSP pages: forwards results
- Trek service → Trek access: queries / updates
- Visitor / trekker → Booking workflow: requests booking
- Visitor / trekker → Payment workflow: submits payment
- Visitor / trekker → Review workflow: submits review
- Review workflow → Review service: adds / deletes
- Review service → Review access: validates / queries
- Visitor / trekker → Trek administration: administers treks
- Trek administration → Trek service: manages treks
- DB connection → MySQL database: connects
- User access → DB connection: uses connection
- Trek access → DB connection: uses connection
- Review access → DB connection: uses connection
- Booking access → DB connection: uses connection
- Payment access → DB connection: uses connection
