How joannebrennanelliott/project_smart_parking works
1. Overall shape
This repository is a small Node.js smart-parking system organized around a gRPC backend, a browser-facing bridge, and a SQLite persistence layer. The README describes higher-level parking features such as occupancy monitoring, pre-booking, alerts, and find-my-car, but the code layout shows the core architecture is service-driven rather than a monolithic web app.
2. API contract
The main interface boundary is defined in protos/smartparking.proto. That file is the canonical contract for the system’s gRPC services and messages, and it is what ties the client side and server side together.
3. Backend service
server.js is the backend service implementation. Based on the repo structure, it is likely the gRPC server that exposes parking-related operations such as bookings, user management, occupancy status, and logging. This is the central business-logic boundary.
4. Bridge layer
bridge.js acts as the intermediary between the browser/UI and the gRPC backend. This is an important architectural seam: instead of the browser talking directly to gRPC, the bridge translates or proxies requests into the service layer, which is a common pattern when the UI is not gRPC-native.
5. Browser UI
index.html is the main GUI entry point. client_browser.js appears to be the browser-side client logic that drives the interface and interacts with the bridge. This layer is responsible for presenting parking status, booking flows, and user-facing features like alerts or “find my car.”
6. Non-browser client
client.js suggests there is also a direct Node.js client, likely for testing, administration, or command-line access to the gRPC service. This means the backend is not exclusively browser-driven; it supports at least one alternate consumer.
7. Persistence layer
The database/ directory contains SQLite schema and migration scripts, and there is a users.db file both at the repo root and under database/, indicating local embedded storage rather than a separate database service. The system persists users, bookings, and audit records in SQLite.
8. Schema and migration management
Files such as init_db.js, migrate_bookings.js, add_*_column.js, create_audit_log_table.js, and fix_audit_log_table.js show the data model evolved over time through scripted migrations rather than a full ORM. check_schema.sql provides a schema verification step. This suggests the database is managed as a set of incremental local scripts.
9. Audit and reporting
view_audit_log.js, view_bookings.js, and view_users.js are inspection/reporting utilities. They indicate the system keeps operational history, likely for admin visibility into user actions, booking changes, and access events. The audit log is a distinct concern from the transactional booking data.
10. Data flow
The most likely end-to-end flow is: browser UI → browser client → bridge → gRPC server → SQLite database. Administrative or diagnostic flows can bypass the browser and go through client.js or the view_* scripts directly against the database.
11. Feature boundaries
The README’s smart-parking features map cleanly to backend responsibilities:
- Occupancy monitoring: backend state readout, likely exposed through gRPC
- Disabled-space pre-booking: booking logic plus user/permit validation
- 15/30-minute alerts: time-based backend logic tied to booking or parking duration
- Parking location / find-my-car: stored location metadata returned through service calls
These are application features, not separate infrastructure modules in the tree.
12. Architecture takeaway
This repo is best diagrammed as a three-tier local system: a browser UI, a Node.js bridge/service boundary, and a SQLite-backed gRPC backend. The proto file defines the service contract; the database scripts define the local persistence schema; and the view scripts provide operational/admin visibility into the stored parking data.
Main entry points: users.db SQLite DB · bridge.js Bridge · server.js Backend Server · client.js Node Client
Components 17
Clients & UI
Browser and direct Node.js entry points that initiate parking workflows.
- Browser UI · Main browser-facing interface for smart parking workflows.
index.html - Browser Client · Client-side logic that talks through the bridge.
client_browser.js - Bridge · Translates browser requests into backend service calls.
bridge.js - Node Client · Direct non-browser consumer of the parking service.
client.js
Service Layer
gRPC contract and backend service implementation.
- gRPC Contract · Canonical service and message definition for the system.
protos/smartparking.proto - Backend Server · Core parking service implementation and business logic boundary.
server.js
Persistence
SQLite database and schema management scripts.
- DB Init · Initial database creation and setup script.
database/init_db.js - Booking Migration · Updates booking-related persistence structure.
database/migrate_bookings.js - Schema Updates · Representative migration scripts for evolving user and booking fields.
database/add_disabledAccess_column.js - Audit Table · Creates or repairs the audit log storage.
database/create_audit_log_table.js - Schema Check · Verifies the current database schema state.
database/check_schema.sql - SQLite DB · Local persistent store for users, bookings, and audit records.
users.db
Ops & Reporting
Utilities for inspecting operational data and records.
- User Viewer · Inspects stored user records.
view_users.js - Booking Viewer · Inspects stored booking records.
view_bookings.js - Audit Viewer · Inspects audit and activity history.
database/view_audit_log.js - DB Booking View · Database-local booking inspection utility.
database/view_bookings.js - DB User View · Database-local user inspection utility.
database/view_users
Connections 17
- Browser UI → Browser Client: loads · The browser UI is driven by browser-side logic.
- Browser Client → Bridge: calls · Browser client sends requests through the bridge.
- Bridge → gRPC Contract: uses · Bridge follows the gRPC contract when calling the backend.
- Bridge → Backend Server: proxies to · Bridge forwards browser operations to the service.
- Node Client → gRPC Contract: uses · Direct Node client is shaped by the same proto contract.
- Node Client → Backend Server: calls · Node client can reach the backend directly.
- Backend Server → SQLite DB: persists · Backend reads and writes local parking data.
- DB Init → SQLite DB: initializes · Bootstrap script creates the embedded database.
- Booking Migration → SQLite DB: migrates · Booking schema changes are applied to the database.
- Schema Updates → SQLite DB: evolves · Incremental scripts add and adjust stored fields.
- Audit Table → SQLite DB: creates · Audit log structure is created or repaired in SQLite.
- Schema Check → SQLite DB: verifies · Schema check inspects database structure.
- User Viewer → SQLite DB: reads · User reporting utility reads from the database.
- Booking Viewer → SQLite DB: reads · Booking reporting utility reads from the database.
- Audit Viewer → SQLite DB: reads · Audit viewer reads history records from SQLite.
- DB Booking View → SQLite DB: reads · Database-local booking viewer reads the embedded store.
- DB User View → SQLite DB: reads · Database-local user viewer reads the embedded store.