# smayanja3/restroomdemoday architecture

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

- Interactive diagram: https://gitdiagram.com/smayanja3/restroomdemoday
- Repository: https://github.com/smayanja3/restroomdemoday

## Overview

Got2Go helps people find nearby public restrooms: users browse a map or list, open restroom details, and can edit amenity information; account signup and login provide a separate authentication flow. An import process brings Refuge Restrooms locations into the MongoDB-backed application. The map, list, detail, and edit routes are represented as distinct stages, with controllers and models as the internal layer. README documents directions and Google Maps integration; sampled evidence does not expose the client-side request wiring, so those links are omitted or marked unverified.

Main entry points: [`server.js`](https://github.com/smayanja3/restroomdemoday/blob/main/server.js) (Express server), [`controllers/restrooms.js`](https://github.com/smayanja3/restroomdemoday/blob/main/controllers/restrooms.js) (Restroom handlers), [`routes/auth.js`](https://github.com/smayanja3/restroomdemoday/blob/main/routes/auth.js) (Account routes), [`controllers/auth.js`](https://github.com/smayanja3/restroomdemoday/blob/main/controllers/auth.js) (Login page handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browsing and Maps"]
  node_landing_routes["Landing routes<br/>[landing.js]"]
  node_landing_controller["Landing page handler<br/>[landing.js]"]
  node_landing_view["Landing page<br/>[landing.ejs]"]
  node_restroom_routes["Restroom routes<br/>[restrooms.js]"]
  node_list_view["Restroom list<br/>[restrooms.ejs]"]
  node_map_view["Restroom map<br/>[map.ejs]"]
  node_detail_view["Restroom details<br/>[showOne.ejs]"]
  node_edit_view["Edit restroom<br/>[edit.ejs]"]
  node_map_client["Map client<br/>[map.js]"]
  node_restroom_api_routes["Map data routes<br/>[api.js]"]
end

subgraph group_restroom["Restroom Data"]
  node_restroom_controller["Restroom handlers<br/>[restrooms.js]"]
  node_restroom_api_controller["Map data handler<br/>[api.js]"]
  node_restroom_model[("Restroom records<br/>[restroom.js]")]
  node_importer["Location importer<br/>[import.js]"]
end

subgraph group_identity["Accounts"]
  node_auth_routes["Account routes<br/>[auth.js]"]
  node_auth_controller["Login page handlers<br/>[auth.js]"]
  node_passport_config["Passport strategies<br/>[passport.js]"]
  node_user_model[("User records<br/>[user.js]")]
  node_signup_view["Signup page<br/>[signup.ejs]"]
  node_login_view["Login page<br/>[login.ejs]"]
end

subgraph group_runtime["Application Runtime"]
  node_server["Express server<br/>[server.js]"]
  node_mongo_config["Database connector<br/>[database.js]"]
end

node_visitor(("Restroom seeker"))
node_refuge["Refuge Restrooms API"]
node_mongodb[("MongoDB")]
node_google_maps["Google Maps"]

node_visitor -->|"requests pages"| node_server
node_server -->|"mounts routes"| node_landing_routes
node_server -->|"mounts routes"| node_auth_routes
node_server -->|"mounts routes"| node_restroom_routes
node_server -->|"mounts routes"| node_restroom_api_routes
node_landing_routes -->|"dispatches to"| node_landing_controller
node_landing_controller -.->|"renders"| node_landing_view
node_restroom_routes -->|"dispatches to"| node_restroom_controller
node_restroom_controller -->|"queries and updates"| node_restroom_model
node_restroom_controller -->|"renders"| node_list_view
node_restroom_controller -->|"renders"| node_map_view
node_restroom_controller -->|"renders"| node_detail_view
node_restroom_controller -->|"renders"| node_edit_view
node_restroom_api_routes -->|"dispatches to"| node_restroom_api_controller
node_restroom_api_controller -->|"reads locations"| node_restroom_model
node_importer -->|"imports locations"| node_refuge
node_importer -->|"stores locations"| node_restroom_model
node_server -->|"connects database"| node_mongo_config
node_mongo_config -->|"connects to"| node_mongodb
node_auth_routes -->|"dispatches page requests"| node_auth_controller
node_auth_routes -->|"authenticates with"| node_passport_config
node_auth_controller -->|"renders"| node_signup_view
node_auth_controller -->|"renders"| node_login_view
node_server -->|"configures"| node_passport_config
node_passport_config -->|"looks up users"| node_user_model
node_user_model -.->|"persists records"| node_mongodb
node_map_client -.->|"loads map data"| node_restroom_api_routes
node_map_client -.->|"uses map API"| node_google_maps

click node_server "https://github.com/smayanja3/restroomdemoday/blob/main/server.js"
click node_landing_routes "https://github.com/smayanja3/restroomdemoday/blob/main/routes/landing.js"
click node_landing_controller "https://github.com/smayanja3/restroomdemoday/blob/main/controllers/landing.js"
click node_landing_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/landing.ejs"
click node_restroom_routes "https://github.com/smayanja3/restroomdemoday/blob/main/routes/restrooms.js"
click node_restroom_controller "https://github.com/smayanja3/restroomdemoday/blob/main/controllers/restrooms.js"
click node_list_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/restrooms.ejs"
click node_map_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/map.ejs"
click node_detail_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/showOne.ejs"
click node_edit_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/edit.ejs"
click node_map_client "https://github.com/smayanja3/restroomdemoday/blob/main/public/js/map.js"
click node_restroom_api_routes "https://github.com/smayanja3/restroomdemoday/blob/main/routes/api.js"
click node_restroom_api_controller "https://github.com/smayanja3/restroomdemoday/blob/main/controllers/api.js"
click node_restroom_model "https://github.com/smayanja3/restroomdemoday/blob/main/models/restroom.js"
click node_importer "https://github.com/smayanja3/restroomdemoday/blob/main/scripts/import.js"
click node_mongo_config "https://github.com/smayanja3/restroomdemoday/blob/main/config/database.js"
click node_auth_routes "https://github.com/smayanja3/restroomdemoday/blob/main/routes/auth.js"
click node_auth_controller "https://github.com/smayanja3/restroomdemoday/blob/main/controllers/auth.js"
click node_passport_config "https://github.com/smayanja3/restroomdemoday/blob/main/config/passport.js"
click node_user_model "https://github.com/smayanja3/restroomdemoday/blob/main/models/user.js"
click node_signup_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/signup.ejs"
click node_login_view "https://github.com/smayanja3/restroomdemoday/blob/main/views/login.ejs"

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_landing_routes,node_landing_controller,node_landing_view,node_restroom_routes,node_list_view,node_map_view,node_detail_view,node_edit_view,node_map_client,node_restroom_api_routes toneBlue
class node_restroom_controller,node_restroom_api_controller,node_restroom_model,node_importer,node_mongodb toneAmber
class node_auth_routes,node_auth_controller,node_passport_config,node_user_model,node_signup_view,node_login_view,node_refuge toneMint
class node_server,node_mongo_config toneRose
class node_visitor,node_google_maps toneIndigo
```

## Components

### Browsing and Maps

- [Landing routes](https://github.com/smayanja3/restroomdemoday/blob/main/routes/landing.js): `routes/landing.js`
- [Landing page handler](https://github.com/smayanja3/restroomdemoday/blob/main/controllers/landing.js): `controllers/landing.js`
- [Landing page](https://github.com/smayanja3/restroomdemoday/blob/main/views/landing.ejs): `views/landing.ejs`
- [Restroom routes](https://github.com/smayanja3/restroomdemoday/blob/main/routes/restrooms.js): `routes/restrooms.js`
- [Restroom list](https://github.com/smayanja3/restroomdemoday/blob/main/views/restrooms.ejs): `views/restrooms.ejs`
- [Restroom map](https://github.com/smayanja3/restroomdemoday/blob/main/views/map.ejs): `views/map.ejs`
- [Restroom details](https://github.com/smayanja3/restroomdemoday/blob/main/views/showOne.ejs): `views/showOne.ejs`
- [Edit restroom](https://github.com/smayanja3/restroomdemoday/blob/main/views/edit.ejs): `views/edit.ejs`
- [Map client](https://github.com/smayanja3/restroomdemoday/blob/main/public/js/map.js): `public/js/map.js`
- [Map data routes](https://github.com/smayanja3/restroomdemoday/blob/main/routes/api.js): `routes/api.js`

### Restroom Data

- [Restroom handlers](https://github.com/smayanja3/restroomdemoday/blob/main/controllers/restrooms.js): `controllers/restrooms.js`
- [Map data handler](https://github.com/smayanja3/restroomdemoday/blob/main/controllers/api.js): `controllers/api.js`
- [Restroom records](https://github.com/smayanja3/restroomdemoday/blob/main/models/restroom.js): `models/restroom.js`
- [Location importer](https://github.com/smayanja3/restroomdemoday/blob/main/scripts/import.js): `scripts/import.js`

### Accounts

- [Account routes](https://github.com/smayanja3/restroomdemoday/blob/main/routes/auth.js): `routes/auth.js`
- [Login page handlers](https://github.com/smayanja3/restroomdemoday/blob/main/controllers/auth.js): `controllers/auth.js`
- [Passport strategies](https://github.com/smayanja3/restroomdemoday/blob/main/config/passport.js): `config/passport.js`
- [User records](https://github.com/smayanja3/restroomdemoday/blob/main/models/user.js): `models/user.js`
- [Signup page](https://github.com/smayanja3/restroomdemoday/blob/main/views/signup.ejs): `views/signup.ejs`
- [Login page](https://github.com/smayanja3/restroomdemoday/blob/main/views/login.ejs): `views/login.ejs`

### Application Runtime

- [Express server](https://github.com/smayanja3/restroomdemoday/blob/main/server.js): `server.js`
- [Database connector](https://github.com/smayanja3/restroomdemoday/blob/main/config/database.js): `config/database.js`

### Other components

- **Restroom seeker**
- **Refuge Restrooms API**
- **MongoDB**
- **Google Maps**

## Connections

- Restroom seeker → Express server: requests pages (evidence: `README.md`)
- Express server → Landing routes: mounts routes (evidence: `server.js`)
- Express server → Account routes: mounts routes (evidence: `server.js`)
- Express server → Restroom routes: mounts routes (evidence: `server.js`)
- Express server → Map data routes: mounts routes (evidence: `server.js`)
- Landing routes → Landing page handler: dispatches to (evidence: `routes/landing.js`)
- Landing page handler → Landing page: renders
- Restroom routes → Restroom handlers: dispatches to (evidence: `routes/restrooms.js`)
- Restroom handlers → Restroom records: queries and updates (evidence: `controllers/restrooms.js`)
- Restroom handlers → Restroom list: renders (evidence: `controllers/restrooms.js`)
- Restroom handlers → Restroom map: renders (evidence: `controllers/restrooms.js`)
- Restroom handlers → Restroom details: renders (evidence: `controllers/restrooms.js`)
- Restroom handlers → Edit restroom: renders (evidence: `controllers/restrooms.js`)
- Map data routes → Map data handler: dispatches to (evidence: `routes/api.js`)
- Map data handler → Restroom records: reads locations (evidence: `controllers/api.js`)
- Location importer → Refuge Restrooms API: imports locations (evidence: `README.md`)
- Location importer → Restroom records: stores locations (evidence: `scripts/import.js`)
- Express server → Database connector: connects database (evidence: `server.js`)
- Database connector → MongoDB: connects to (evidence: `config/database.js`)
- Account routes → Login page handlers: dispatches page requests (evidence: `routes/auth.js`)
- Account routes → Passport strategies: authenticates with (evidence: `routes/auth.js`)
- Login page handlers → Signup page: renders (evidence: `controllers/auth.js`)
- Login page handlers → Login page: renders (evidence: `controllers/auth.js`)
- Express server → Passport strategies: configures (evidence: `server.js`)
- Passport strategies → User records: looks up users (evidence: `config/passport.js`)
- User records → MongoDB: persists records
- Map client → Map data routes: loads map data
- Map client → Google Maps: uses map API
