@@ -7,8 +7,9 @@ The Iris Wikipedia Pathfinder API finds the shortest path between two Wikipedia
77## Base URL
88
99```
10- API: http://localhost:9020
11- Web UI: http://localhost:9020/ui
10+ Application: http://localhost:9020
11+ Interactive UI: http://localhost:9020 (default landing page)
12+ API Documentation: http://localhost:9020/api
1213```
1314
1415## Quick Start
@@ -96,10 +97,20 @@ honcho start
9697
9798## API Endpoints
9899
99- ### 1. Root Endpoint - API Information
100+ ### 1. Interactive UI (Landing Page)
100101
101102** GET /**
102103
104+ Serves the interactive web interface for pathfinding visualization (default landing page).
105+
106+ ** GET /any-path**
107+
108+ All non-API paths automatically redirect to the main UI for a seamless user experience.
109+
110+ ### 2. API Information
111+
112+ ** GET /api**
113+
103114Returns basic API information and available endpoints.
104115
105116** Response:**
@@ -113,14 +124,15 @@ Returns basic API information and available endpoints.
113124 "GET /tasks/status/<task_id>" : " Check task status" ,
114125 "POST /explore" : " Explore page connections" ,
115126 "GET /health" : " Health check" ,
116- "GET /ui " : " Interactive web interface" ,
117- "GET /" : " API information"
127+ "GET /" : " Interactive web interface" ,
128+ "GET /api " : " API information"
118129 },
119- "documentation" : " ./API_DOCUMENTATION.md"
130+ "documentation" : " ./API_DOCUMENTATION.md" ,
131+ "ui_url" : " /"
120132}
121133```
122134
123- ### 2 . Find Path Between Pages
135+ ### 3 . Find Path Between Pages
124136
125137** POST /getPath**
126138
@@ -164,7 +176,7 @@ curl -X POST http://localhost:9020/getPath \
164176 }'
165177```
166178
167- ### 3 . Check Task Status
179+ ### 4 . Check Task Status
168180
169181** GET /tasks/status/{task_id}**
170182
@@ -173,29 +185,39 @@ Polls the status of a pathfinding task.
173185** Path Parameters:**
174186- ` task_id ` (string, required): Task ID returned from /getPath
175187
176- ** Response - Task Pending :**
188+ ** Response — PENDING :**
177189``` json
178190{
179- "status" : " PENDING" ,
191+ "status" : " PENDING" ,
180192 "task_id" : " abc123-def456-ghi789" ,
181193 "message" : " Task is waiting to be processed"
182194}
183195```
184196
185- ** Response - Task In Progress :**
197+ ** Response — IN_PROGRESS :**
186198``` json
187199{
188200 "status" : " IN_PROGRESS" ,
189- "task_id" : " abc123-def456-ghi789" ,
201+ "task_id" : " abc123-def456-ghi789" ,
190202 "progress" : {
191- "current_depth" : 3 ,
192- "nodes_explored" : 150 ,
193- "message" : " Searching at depth 3..."
203+ "status" : " Starting pathfinding search..." ,
204+ "search_stats" : {
205+ "nodes_explored" : 0 ,
206+ "current_depth" : 0 ,
207+ "last_node" : " Albert Einstein" ,
208+ "queue_size" : 1 ,
209+ "start_page" : " Albert Einstein" ,
210+ "end_page" : " Physics" ,
211+ "max_depth" : 6
212+ },
213+ "search_time_elapsed" : 0
194214 }
195215}
196216```
197217
198- ** Response - Task Success:**
218+ Note: The ` progress ` object mirrors the task's meta and may include additional fields depending on runtime.
219+
220+ ** Response — SUCCESS:**
199221``` json
200222{
201223 "status" : " SUCCESS" ,
@@ -204,12 +226,22 @@ Polls the status of a pathfinding task.
204226 "path" : [" Albert Einstein" , " Science" , " Physics" ],
205227 "length" : 3 ,
206228 "search_time" : 2.45 ,
207- "nodes_explored" : 287
229+ "nodes_explored" : 287 ,
230+ "search_stats" : {
231+ "nodes_explored" : 287 ,
232+ "final_depth" : 2 ,
233+ "start_page" : " Albert Einstein" ,
234+ "end_page" : " Physics" ,
235+ "max_depth" : 6 ,
236+ "search_completed" : true
237+ }
208238 }
209239}
210240```
211241
212- ** Response - Task Failed:**
242+ Note: If the underlying task returns a different structure, it may be passed through as-is in ` result ` .
243+
244+ ** Response — FAILURE:**
213245``` json
214246{
215247 "status" : " FAILURE" ,
@@ -218,12 +250,23 @@ Polls the status of a pathfinding task.
218250}
219251```
220252
253+ ** Response — Other States (e.g., RETRY):**
254+ ``` json
255+ {
256+ "status" : " RETRY" ,
257+ "task_id" : " abc123-def456-ghi789" ,
258+ "info" : " Retrying due to: Connection timeout to Wikipedia API"
259+ }
260+ ```
261+
262+ Note: For states other than the above, ` info ` contains a string description derived from the task's state/meta.
263+
221264** Example cURL:**
222265``` bash
223266curl http://localhost:9020/tasks/status/abc123-def456-ghi789
224267```
225268
226- ### 4 . Explore Page Connections
269+ ### 5 . Explore Page Connections
227270
228271** POST /explore**
229272
@@ -272,7 +315,7 @@ curl -X POST http://localhost:9020/explore \
272315 }'
273316```
274317
275- ### 5 . Health Check
318+ ### 6 . Health Check
276319
277320** GET /health**
278321
@@ -283,7 +326,7 @@ Checks the health status of all system components.
283326{
284327 "status" : " healthy" ,
285328 "redis_status" : " healthy" ,
286- "cache_status" : " healthy" ,
329+ "cache_status" : " healthy" ,
287330 "wikipedia_api_status" : " healthy" ,
288331 "timestamp" : " 2025-01-31T00:00:00Z"
289332}
@@ -295,7 +338,7 @@ Checks the health status of all system components.
295338 "status" : " degraded" ,
296339 "redis_status" : " unhealthy: Connection refused" ,
297340 "cache_status" : " healthy" ,
298- "wikipedia_api_status" : " healthy" ,
341+ "wikipedia_api_status" : " healthy" ,
299342 "timestamp" : " 2025-01-31T00:00:00Z"
300343}
301344```
@@ -305,7 +348,7 @@ Checks the health status of all system components.
305348curl http://localhost:9020/health
306349```
307350
308- ### 6 . Clear Cache (Admin)
351+ ### 7 . Clear Cache (Admin)
309352
310353** POST /cache/clear**
311354
@@ -337,24 +380,27 @@ curl -X POST http://localhost:9020/cache/clear \
337380 -d ' {"pattern": "wiki_links:*"}'
338381```
339382
340- ### 7 . Interactive Web Interface
383+ ### 8 . Interactive Web Interface Features
341384
342- ** GET /ui **
385+ The main landing page ( ` / ` ) serves the interactive web interface with enhanced features:
343386
344- Serves the interactive web interface for visualizing Wikipedia pathfinding results.
345-
346- ** Features:**
387+ ** Enhanced Features:**
388+ - ** UI-First Experience** : Landing page serves interactive UI directly, all paths redirect to main interface
389+ - ** State Persistence** : Automatically saves and restores search state using localStorage
390+ - ** Mobile-Optimized** : Fixed touch/scroll conflicts for seamless mobile graph interaction
391+ - ** Session Recovery** : Automatically resumes interrupted searches after page refresh
347392- ** Modern Dark Theme** : Professional dark tech aesthetic with GitHub-inspired colors
348393- ** Interactive Graph Visualization** : D3.js-powered force-directed graph with physics simulation
349- - ** Real-Time Pathfinding** : Live progress tracking and result visualization
350394- ** Dynamic Node Interaction** : Drag-and-drop nodes with intelligent physics
351395- ** Smart Text Rendering** : Dynamic text truncation based on graph density
352396- ** Professional Typography** : JetBrains Mono font throughout
353- - ** Responsive Design** : Works on desktop and mobile devices
397+ - ** Responsive Design** : Works perfectly on desktop and mobile devices
354398
355399** Navigation:**
356400```
357- http://localhost:9020/ui
401+ http://localhost:9020/ (default landing page)
402+ http://localhost:9020/ui (redirects to main UI)
403+ http://localhost:9020/<any> (redirects to main UI)
358404```
359405
360406** Interface Components:**
@@ -369,12 +415,13 @@ http://localhost:9020/ui
369415- ** Error Handling** : User-friendly error messages and loading states
370416
371417** Usage:**
372- 1 . Navigate to ` /ui ` in your browser
373- 2 . Enter Wikipedia page titles in start and end fields
418+ 1 . Navigate to ` / ` in your browser (or any non-API path)
419+ 2 . Enter Wikipedia page titles in start and end fields
3744203 . Click "Find Path" to initiate pathfinding
375- 4 . Watch real-time graph visualization
376- 5 . Interact with nodes by dragging them
421+ 4 . View graph visualization as path is discovered
422+ 5 . Interact with nodes by dragging them (mobile-optimized)
3774236 . Click on path steps to visit Wikipedia pages
424+ 7 . State is automatically saved - refresh to resume interrupted searches
378425
379426** Technical Details:**
380427- Uses D3.js v7 for graph visualization
@@ -405,6 +452,9 @@ All endpoints return structured error responses when something goes wrong:
405452}
406453```
407454
455+ Note: JSON 404 responses are returned for API-like paths (for example, ` /api/... ` ).
456+ Requests to non-API paths instead redirect to the main UI (` / ` ).
457+
408458** 405 Method Not Allowed:**
409459``` json
410460{
@@ -461,9 +511,11 @@ curl http://localhost:9020/tasks/status/xyz789-abc123-def456
461511 "status" : " IN_PROGRESS" ,
462512 "task_id" : " xyz789-abc123-def456" ,
463513 "progress" : {
464- "current_depth" : 2 ,
465- "nodes_explored" : 95 ,
466- "message" : " Searching at depth 2..."
514+ "current" : 10 ,
515+ "total" : 100 ,
516+ "status" : " Validating pages..." ,
517+ "start_page" : " Barack Obama" ,
518+ "end_page" : " Computer Science"
467519 }
468520}
469521```
@@ -489,10 +541,10 @@ curl http://localhost:9020/tasks/status/xyz789-abc123-def456
489541
490542## Rate Limiting
491543
492- The API includes basic rate limiting middleware :
493- - Default: 100 requests per minute per IP
494- - Rate limit headers are included in responses
495- - Exceeding limits returns HTTP 429 Too Many Requests
544+ Basic logging-only rate limiting is present for visibility, but limits are not enforced in this build :
545+ - Logs each request with a per-IP note; no counters are persisted
546+ - No ` 429 Too Many Requests ` responses are emitted by default
547+ - For production-grade limits, plug in a Redis-backed limiter
496548
497549## Environment Configuration
498550
@@ -569,4 +621,4 @@ For issues and questions:
569621- Check the logs: Application logs provide detailed error information
570622- Health endpoint: Use ` /health ` to diagnose system issues
571623- Redis connectivity: Ensure Redis is running and accessible
572- - Wikipedia API: Check if Wikipedia API is accessible from your network
624+ - Wikipedia API: Check if Wikipedia API is accessible from your network
0 commit comments