File size: 8,045 Bytes
61d29fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
---
sidebar_position: 2
displayed_sidebar: developersSidebar
---

# πŸ—οΈ Architecture Overview

## Three Separate Services

Open Navigator consists of **three distinct services** that work together:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 Open Navigator Platform                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                           β”‚
β”‚  πŸ“š Documentation Site (Docusaurus)                      β”‚
β”‚  └─> http://localhost:3000                              β”‚
β”‚      β€’ Project overview and marketing                    β”‚
β”‚      β€’ API documentation and guides                      β”‚
β”‚      β€’ Installation instructions                         β”‚
β”‚      β€’ Links to dashboard                                β”‚
β”‚                                                           β”‚
β”‚  βš›οΈ  Interactive Dashboard (React + Vite)               β”‚
β”‚  └─> http://localhost:5173                              β”‚
β”‚      β€’ Real-time data visualization                      β”‚
β”‚      β€’ Search and filter capabilities                    β”‚
β”‚      β€’ Interactive heatmap                               β”‚
β”‚      β€’ Document explorer                                 β”‚
β”‚      β€’ Nonprofit search                                  β”‚
β”‚      β€’ Opportunity tracker                               β”‚
β”‚                                                           β”‚
β”‚  πŸ”₯ API Backend (FastAPI + Python)                       β”‚
β”‚  └─> http://localhost:8000                              β”‚
β”‚      β€’ Data ingestion and processing                     β”‚
β”‚      β€’ Multi-agent AI system                             β”‚
β”‚      β€’ Database connections                              β”‚
β”‚      β€’ API endpoints for dashboard                       β”‚
β”‚                                                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Why Three Services?

### πŸ“š Documentation Site (`website/`)
- **Purpose**: Documentation, guides, and project information
- **Technology**: Docusaurus (static site generator)
- **Port**: 3000
- **Use Case**: First-time visitors, documentation, API reference

### βš›οΈ Dashboard (`frontend/`)
- **Purpose**: Interactive data exploration and analysis
- **Technology**: React 18 + TypeScript + Vite
- **Port**: 5173
- **Use Case**: Daily users exploring data, creating reports, searching

### πŸ”₯ API Backend (`api/`)
- **Purpose**: Data processing and AI agents
- **Technology**: FastAPI + Python
- **Port**: 8000
- **Use Case**: Powers the dashboard, runs background jobs

## Integration Points

### Documentation β†’ Dashboard
- Navbar has "πŸš€ Dashboard" link pointing to `http://localhost:5173`
- Homepage has "Launch Dashboard" button
- `/dashboard` page auto-redirects to React app

### Dashboard β†’ API
- All data requests go to `http://localhost:8000/api/*`
- Real-time updates via API polling
- Authentication handled via API

### API β†’ Dashboard
- Serves static built dashboard in production
- Provides REST endpoints for all data

## Development Workflow

### Option 1: Start All Services (Recommended)
```bash
./start-all.sh
```

This launches all three services in tmux:
- Window 0: API Backend
- Window 1: React Dashboard  
- Window 2: Documentation Site
- Window 3: Shell

### Option 2: Start Individually
```bash
# Terminal 1: API
source .venv/bin/activate
python main.py serve

# Terminal 2: Dashboard
cd frontend
npm run dev

# Terminal 3: Documentation
cd website
npm start
```

## Access Points

| Service       | Development URL          | Purpose                          |
|---------------|-------------------------|----------------------------------|
| Documentation | http://localhost:3000   | Read guides and API docs         |
| Dashboard     | http://localhost:5173   | **Main application interface**   |
| API           | http://localhost:8000   | Backend services                 |
| API Docs      | http://localhost:8000/docs | Interactive API reference     |

## User Journey

1. **Discovery**: User visits documentation site (port 3000)
2. **Getting Started**: Reads installation guides
3. **Launch**: Clicks "Dashboard" β†’ Opens React app (port 5173)
4. **Usage**: Interacts with dashboard, which calls API (port 8000)

## Production Deployment

In production, the architecture changes:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Production Deployment                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                           β”‚
β”‚  🌐 Reverse Proxy (nginx/Databricks Apps)               β”‚
β”‚  └─> https://opennavigator.org                          β”‚
β”‚                                                           β”‚
β”‚      β”œβ”€ /              β†’ Docusaurus static build         β”‚
β”‚      β”œβ”€ /docs          β†’ Docusaurus static build         β”‚
β”‚      β”œβ”€ /dashboard     β†’ React static build              β”‚
β”‚      └─ /api/*         β†’ FastAPI backend                 β”‚
β”‚                                                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Build Commands
```bash
# Build documentation
cd website && npm run build
# Output: website/build/

# Build dashboard
cd frontend && npm run build
# Output: frontend/dist/

# Deploy backend
# FastAPI serves both static builds
```

## Key Files

### Documentation Site
- `website/docusaurus.config.ts` - Configuration
- `website/src/pages/index.tsx` - Homepage
- `website/docs/` - Documentation markdown files

### Dashboard
- `frontend/src/App.tsx` - Main routes
- `frontend/src/pages/Dashboard.tsx` - **Homepage with stats**
- `frontend/src/pages/Heatmap.tsx` - Interactive map
- `frontend/src/pages/Documents.tsx` - Search interface
- `frontend/src/pages/Nonprofits.tsx` - Nonprofit search
- `frontend/src/pages/Opportunities.tsx` - Opportunity tracker

### API
- `api/app.py` - Databricks Apps entry point
- `api/main.py` - Standalone mode
- `agents/` - Multi-agent system
- `discovery/` - Data ingestion

## Common Confusion

❌ **Wrong**: "The documentation site IS the application"
βœ… **Correct**: "The documentation site LINKS TO the application"

❌ **Wrong**: "Port 3000 has search and filters"
βœ… **Correct**: "Port 5173 (React dashboard) has search and filters"

❌ **Wrong**: "Docusaurus replaced the dashboard"
βœ… **Correct**: "Docusaurus was added FOR documentation, dashboard is unchanged"

## Troubleshooting

### "I can't find the search feature"
β†’ You're on the documentation site. Click "πŸš€ Dashboard" in the navbar to access the React app.

### "Dashboard link goes to wrong place"
β†’ Make sure React dev server is running (`cd frontend && npm run dev`)

### "No data showing in dashboard"
β†’ Make sure API backend is running (`python main.py serve`)

### "Everything looks different"
β†’ Documentation site (port 3000) is new. Dashboard (port 5173) is unchanged.

## Next Steps

- [Start all services](../README.md#quick-start)
- [Dashboard documentation](../website/docs/dashboard.md)
- [API documentation](../website/docs/api.md)