# priscilla-ruilova/common-ground architecture

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

- Interactive diagram: https://gitdiagram.com/priscilla-ruilova/common-ground
- Repository: https://github.com/priscilla-ruilova/common-ground

## Overview

Common Ground is an in-progress community platform for urban growers, combining authenticated accounts and a post-based citizen-science forum with planned resource and land-security mapping. The implemented workflow routes browser requests through Express, applies authentication where configured, and renders login, profile, feed, or post views; post actions read and write MongoDB records and can upload images to Cloudinary. The README also describes GIS, resource maps, and foreclosure monitoring, but the tree and sampled code do not establish their implementation or runtime connections.

Main entry points: [`controllers/posts.js`](https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/posts.js) (Post handlers), [`server.js`](https://github.com/priscilla-ruilova/common-ground/blob/main/server.js) (Express server), [`routes/main.js`](https://github.com/priscilla-ruilova/common-ground/blob/main/routes/main.js) (Main routes), [`routes/posts.js`](https://github.com/priscilla-ruilova/common-ground/blob/main/routes/posts.js) (Post routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and routing"]
  node_express["Express server<br/>[server.js]"]
  node_main_routes["Main routes<br/>[main.js]"]
  node_post_routes["Post routes<br/>[posts.js]"]
  node_comment_routes["Comment routes<br/>[comments.js]"]
  node_database_connection["MongoDB connection<br/>[database.js]"]
  node_login_view["Login view<br/>[login.ejs]"]
  node_signup_view["Signup view<br/>[signup.ejs]"]
end

subgraph group_identity["Accounts and access"]
  node_auth_guard["Auth guard<br/>[auth.js]"]
  node_auth_controller["Account handlers<br/>[auth.js]"]
  node_passport_config["Local sign-in<br/>[passport.js]"]
  node_users[("User records<br/>[User.js]")]
end

subgraph group_community["Community posts"]
  node_posts_controller["Post handlers<br/>[posts.js]"]
  node_comments_controller["Comment handlers<br/>[comments.js]"]
  node_post_records[("Post records<br/>[Post.js]")]
  node_comment_records[("Comment records<br/>[comment.js]")]
  node_upload_middleware["Image upload middleware<br/>[multer.js]"]
  node_cloudinary_helper["Cloudinary client<br/>[cloudinary.js]"]
  node_profile_view["Profile view<br/>[profile.ejs]"]
  node_feed_view["Feed view<br/>[feed.ejs]"]
  node_post_view["Post view<br/>[post.ejs]"]
end

subgraph group_land["Land resources"]
  node_parcel_model[("Parcel model<br/>[Parcel.js]")]
  node_resource_map["Resource map"]
  node_foreclosure_map["Foreclosure monitor"]
  node_gis["GIS experience"]
end

node_growers(("Community members"))

node_growers -->|"send requests"| node_express
node_express -->|"connects to"| node_database_connection
node_express -->|"configures"| node_passport_config
node_express -->|"mounts"| node_main_routes
node_express -->|"mounts"| node_post_routes
node_express -->|"mounts"| node_comment_routes
node_main_routes -->|"routes to"| node_auth_controller
node_main_routes -->|"routes to"| node_posts_controller
node_main_routes -->|"guards routes"| node_auth_guard
node_post_routes -->|"routes to"| node_posts_controller
node_post_routes -->|"uploads through"| node_upload_middleware
node_post_routes -->|"guards routes"| node_auth_guard
node_comment_routes -->|"routes to"| node_comments_controller
node_auth_controller -->|"creates and checks"| node_users
node_passport_config -->|"authenticates"| node_users
node_posts_controller -->|"reads and writes"| node_post_records
node_posts_controller -->|"reads"| node_comment_records
node_posts_controller -->|"uploads and deletes"| node_cloudinary_helper
node_comments_controller -->|"writes"| node_comment_records
node_posts_controller -->|"renders"| node_profile_view
node_posts_controller -->|"renders"| node_feed_view
node_posts_controller -->|"renders"| node_post_view
node_auth_controller -->|"renders"| node_login_view
node_auth_controller -->|"renders"| node_signup_view
node_growers -.->|"view resources"| node_resource_map
node_growers -.->|"check land risk"| node_foreclosure_map
node_growers -.->|"use mapping"| node_gis
node_growers -.->|"track parcels"| node_parcel_model

click node_express "https://github.com/priscilla-ruilova/common-ground/blob/main/server.js"
click node_main_routes "https://github.com/priscilla-ruilova/common-ground/blob/main/routes/main.js"
click node_post_routes "https://github.com/priscilla-ruilova/common-ground/blob/main/routes/posts.js"
click node_comment_routes "https://github.com/priscilla-ruilova/common-ground/blob/main/routes/comments.js"
click node_auth_guard "https://github.com/priscilla-ruilova/common-ground/blob/main/middleware/auth.js"
click node_auth_controller "https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/auth.js"
click node_passport_config "https://github.com/priscilla-ruilova/common-ground/blob/main/config/passport.js"
click node_users "https://github.com/priscilla-ruilova/common-ground/blob/main/models/User.js"
click node_posts_controller "https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/posts.js"
click node_comments_controller "https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/comments.js"
click node_post_records "https://github.com/priscilla-ruilova/common-ground/blob/main/models/Post.js"
click node_comment_records "https://github.com/priscilla-ruilova/common-ground/blob/main/models/comment.js"
click node_upload_middleware "https://github.com/priscilla-ruilova/common-ground/blob/main/middleware/multer.js"
click node_cloudinary_helper "https://github.com/priscilla-ruilova/common-ground/blob/main/middleware/cloudinary.js"
click node_database_connection "https://github.com/priscilla-ruilova/common-ground/blob/main/config/database.js"
click node_login_view "https://github.com/priscilla-ruilova/common-ground/blob/main/views/login.ejs"
click node_signup_view "https://github.com/priscilla-ruilova/common-ground/blob/main/views/signup.ejs"
click node_profile_view "https://github.com/priscilla-ruilova/common-ground/blob/main/views/profile.ejs"
click node_feed_view "https://github.com/priscilla-ruilova/common-ground/blob/main/views/feed.ejs"
click node_post_view "https://github.com/priscilla-ruilova/common-ground/blob/main/views/post.ejs"
click node_parcel_model "https://github.com/priscilla-ruilova/common-ground/blob/main/models/Parcel.js"

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_express,node_main_routes,node_post_routes,node_comment_routes,node_database_connection,node_login_view,node_signup_view toneBlue
class node_auth_guard,node_auth_controller,node_passport_config,node_users toneAmber
class node_posts_controller,node_comments_controller,node_post_records,node_comment_records,node_upload_middleware,node_cloudinary_helper,node_profile_view,node_feed_view,node_post_view toneMint
class node_parcel_model,node_resource_map,node_foreclosure_map,node_gis toneRose
class node_growers toneIndigo
```

## Components

### Web and routing

- [Express server](https://github.com/priscilla-ruilova/common-ground/blob/main/server.js): `server.js`
- [Main routes](https://github.com/priscilla-ruilova/common-ground/blob/main/routes/main.js): `routes/main.js`
- [Post routes](https://github.com/priscilla-ruilova/common-ground/blob/main/routes/posts.js): `routes/posts.js`
- [Comment routes](https://github.com/priscilla-ruilova/common-ground/blob/main/routes/comments.js): `routes/comments.js`
- [MongoDB connection](https://github.com/priscilla-ruilova/common-ground/blob/main/config/database.js): `config/database.js`
- [Login view](https://github.com/priscilla-ruilova/common-ground/blob/main/views/login.ejs): `views/login.ejs`
- [Signup view](https://github.com/priscilla-ruilova/common-ground/blob/main/views/signup.ejs): `views/signup.ejs`

### Accounts and access

- [Auth guard](https://github.com/priscilla-ruilova/common-ground/blob/main/middleware/auth.js): `middleware/auth.js`
- [Account handlers](https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/auth.js): `controllers/auth.js`
- [Local sign-in](https://github.com/priscilla-ruilova/common-ground/blob/main/config/passport.js): `config/passport.js`
- [User records](https://github.com/priscilla-ruilova/common-ground/blob/main/models/User.js): `models/User.js`

### Community posts

- [Post handlers](https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/posts.js): `controllers/posts.js`
- [Comment handlers](https://github.com/priscilla-ruilova/common-ground/blob/main/controllers/comments.js): `controllers/comments.js`
- [Post records](https://github.com/priscilla-ruilova/common-ground/blob/main/models/Post.js): `models/Post.js`
- [Comment records](https://github.com/priscilla-ruilova/common-ground/blob/main/models/comment.js): `models/comment.js`
- [Image upload middleware](https://github.com/priscilla-ruilova/common-ground/blob/main/middleware/multer.js): `middleware/multer.js`
- [Cloudinary client](https://github.com/priscilla-ruilova/common-ground/blob/main/middleware/cloudinary.js): `middleware/cloudinary.js`
- [Profile view](https://github.com/priscilla-ruilova/common-ground/blob/main/views/profile.ejs): `views/profile.ejs`
- [Feed view](https://github.com/priscilla-ruilova/common-ground/blob/main/views/feed.ejs): `views/feed.ejs`
- [Post view](https://github.com/priscilla-ruilova/common-ground/blob/main/views/post.ejs): `views/post.ejs`

### Land resources

- [Parcel model](https://github.com/priscilla-ruilova/common-ground/blob/main/models/Parcel.js): `models/Parcel.js`
- **Resource map**
- **Foreclosure monitor**
- **GIS experience**

### Other components

- **Community members**

## Connections

- Community members → Express server: send requests (evidence: `server.js`)
- Express server → MongoDB connection: connects to (evidence: `server.js`)
- Express server → Local sign-in: configures (evidence: `server.js`)
- Express server → Main routes: mounts (evidence: `server.js`)
- Express server → Post routes: mounts (evidence: `server.js`)
- Express server → Comment routes: mounts (evidence: `server.js`)
- Main routes → Account handlers: routes to (evidence: `routes/main.js`)
- Main routes → Post handlers: routes to (evidence: `routes/main.js`)
- Main routes → Auth guard: guards routes (evidence: `routes/main.js`)
- Post routes → Post handlers: routes to (evidence: `routes/posts.js`)
- Post routes → Image upload middleware: uploads through (evidence: `routes/posts.js`)
- Post routes → Auth guard: guards routes (evidence: `routes/posts.js`)
- Comment routes → Comment handlers: routes to (evidence: `routes/comments.js`)
- Account handlers → User records: creates and checks (evidence: `controllers/auth.js`)
- Local sign-in → User records: authenticates (evidence: `config/passport.js`)
- Post handlers → Post records: reads and writes (evidence: `controllers/posts.js`)
- Post handlers → Comment records: reads (evidence: `controllers/posts.js`)
- Post handlers → Cloudinary client: uploads and deletes (evidence: `controllers/posts.js`)
- Comment handlers → Comment records: writes (evidence: `controllers/comments.js`)
- Post handlers → Profile view: renders (evidence: `controllers/posts.js`)
- Post handlers → Feed view: renders (evidence: `controllers/posts.js`)
- Post handlers → Post view: renders (evidence: `controllers/posts.js`)
- Account handlers → Login view: renders (evidence: `controllers/auth.js`)
- Account handlers → Signup view: renders (evidence: `controllers/auth.js`)
- Community members → Resource map: view resources (evidence: `README.md`)
- Community members → Foreclosure monitor: check land risk (evidence: `README.md`)
- Community members → GIS experience: use mapping (evidence: `README.md`)
- Community members → Parcel model: track parcels (evidence: `README.md`)
