How adityapannu669-collab/page-pulse works
Purpose and Runtime
Page Pulse is a single Spring Boot application that audits a user-supplied public URL and reports HTTP and basic HTML-health metrics. Java/Spring Boot hosts both the REST API and static browser UI; Maven builds and tests it. The application entry point is src/main/java/com/aditya/pagepulse/PagepulseApplication.java, with runtime settings in src/main/resources/application.properties. Dockerfile supports container deployment.
Browser Entry and UI Boundary
The browser is served directly from Spring Boot static resources rather than a separate frontend runtime. src/main/resources/static/index.html provides the page, while src/main/resources/static/script.js submits an audit request and renders either the JSON report or an error. src/main/resources/static/style.css defines presentation only.
The frontend boundary is the GET API contract: /api/audit?url=<public-url>.
API Controller
src/main/java/com/aditya/pagepulse/controller/AuditController.java is the HTTP entry point for audit requests. It accepts the URL query parameter, delegates work to the service layer, and returns the report DTO as JSON. This layer separates browser/API transport concerns from external fetching and HTML analysis.
The response contract is represented by src/main/java/com/aditya/pagepulse/dto/AuditResponse.java, including status, response time, title, meta description, H1 count, missing image-alt count, and approximate word count.
Audit Service: External Fetch and Analysis
src/main/java/com/aditya/pagepulse/service/AuditService.java is the core orchestration and domain component. It owns the two major stages:
1. Validate and fetch the target public URL through Jsoup/HTTP.
2. Confirm an HTML response, parse its document, and derive structural/content metrics.
This is the principal trust and failure boundary: the application accepts user-controlled URLs and makes outbound network requests to third-party websites. Connection failures, invalid URLs, non-HTML responses, and timeouts are converted into application-level failures rather than parsing results.
Error Translation
src/main/java/com/aditya/pagepulse/exception/GlobalExceptionHandler.java centralizes mapping of validation and external-request failures to HTTP responses. Expected client errors include invalid URLs and non-HTML resources (400); unreachable upstream sites map to 502, and slow targets to 504. This keeps controller and service behavior focused on normal auditing flow.
Primary Flow
1. A user enters a target URL in src/main/resources/static/index.html.
2. src/main/resources/static/script.js calls GET /api/audit.
3. AuditController delegates to AuditService.
4. The service uses Jsoup to contact the external target, measure request time, parse HTML, and calculate report fields.
5. An AuditResponse is serialized as JSON to the browser.
6. The UI renders metrics; failures traverse GlobalExceptionHandler and are displayed as errors.
Dependencies and Deployment Shape
The material external dependency is Jsoup for HTTP retrieval and HTML parsing, with Spring Boot providing embedded server, static-file serving, dependency injection, REST serialization, and exception handling. There is no database, message broker, authentication provider, or separate frontend service indicated by the repository. The service depends operationally on outbound network/DNS access to audited public websites.
Main entry points: script.js Request and rendering · AuditService.java Audit orchestration · index.html Audit page · AuditController.java Audit API
Components 13
Browser UI
- User
- Audit page
src/main/resources/static/index.html - Request and rendering
src/main/resources/static/script.js
Spring Boot application
- Page Pulse runtime · Serves static UI and REST API.
src/main/java/com/aditya/pagepulse/PagepulseApplication.java - Static assets
src/main/resources/static/style.css - Audit API · GET /api/audit?url=<public-url>.
src/main/java/com/aditya/pagepulse/controller/AuditController.java - Audit orchestration · Validates, fetches, and analyzes user-supplied URLs.
src/main/java/com/aditya/pagepulse/service/AuditService.java - Audit report · HTTP, timing, and HTML-health metrics.
src/main/java/com/aditya/pagepulse/dto/AuditResponse.java - Error translation · Maps invalid, upstream, and timeout failures to HTTP errors.
src/main/java/com/aditya/pagepulse/exception/GlobalExceptionHandler.java - Runtime settings
src/main/resources/application.properties
Outbound dependency
- Jsoup
- Audited public site · Requires outbound network and DNS access.
Other components
- Container deployment
Dockerfile
Connections 16
- User → Audit page: opens
- Audit page → Request and rendering: loads
- Static assets → Audit page: styles
- Page Pulse runtime → Audit page: serves
- Request and rendering → Audit API: GET /api/audit
- Audit API → Audit orchestration: delegates audit
- Audit orchestration → Jsoup: fetches and parses
- Jsoup → Audited public site: outbound HTTP
- Audit orchestration → Audit report: builds metrics
- Audit API → Audit report: serializes JSON
- Audit report → Request and rendering: report JSON
- Request and rendering → User: renders result
- Audit orchestration → Error translation: validation or fetch failure
- Error translation → Request and rendering: 400 / 502 / 504 error
- Runtime settings → Page Pulse runtime: configures
- Container deployment → Page Pulse runtime: packages and runs