# cooperkeenan/parkalot architecture

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

- Interactive diagram: https://gitdiagram.com/cooperkeenan/parkalot
- Repository: https://github.com/cooperkeenan/parkalot

## Overview

This repository is a small Azure Functions-based automation service whose purpose is to reserve a parking spot automatically each day.

At a high level, the architecture is:

- A Python Azure Functions app as the runtime host
- A single main function, `ReserveParkalot`, as the orchestration entrypoint
- A set of internal service modules that split the reservation workflow into steps
- Local Azure Storage emulation via Azurite for development/runtime state
- Shell scripts and container support for local execution and deployment

Main runtime boundary

- `parkalot-func/` is the application boundary.
- `parkalot-func/function_app.py` and `parkalot-func/ReserveParkalot/function.json` indicate an Azure Functions project, with the function definition and bindings separated from the business logic.
- `host.json` and `local.settings.json` are the standard Azure Functions host/configuration files, so the app is designed to run in the Azure Functions host locally and in Azure.

Core business workflow

The main workflow lives under `parkalot-func/ReserveParkalot/`:

- `coordinator.py` is the orchestration layer. This is the most important application-level component from an architecture perspective.
- The coordinator likely drives the reservation process end-to-end and coordinates the subordinate services.
- `date_calculator.py` determines which date should be reserved, which suggests the reservation is not just “reserve now” but “reserve the correct day” according to business rules.
- `login_service.py` handles authentication to the external Parkalot system.
- `reservation_service.py` performs the actual reservation operation.
- `verification_service.py` checks that the reservation succeeded or validates the resulting state.
- `notification_service.py` sends a success/failure/status notification after the workflow completes.
- `notification_factory.py` likely chooses or constructs the right notification implementation or payload, which implies the notification mechanism is abstracted from the orchestration flow.

Likely execution/data flow

A reasonable diagram of the flow would be:

- Azure Functions trigger invokes `ReserveParkalot`
- `ReserveParkalot` delegates to `coordinator.py`
- `coordinator.py`:
  - computes the target reservation date via `date_calculator.py`
  - authenticates via `login_service.py`
  - submits the reservation via `reservation_service.py`
  - validates the outcome via `verification_service.py`
  - emits a result message via `notification_service.py` and `notification_factory.py`

This is a classic orchestration-plus-services split: the function entrypoint is thin, and the actual business process is decomposed into reusable steps.

External dependencies and boundaries

The repository name and module names imply at least one external system:

- The Parkalot reservation backend or website is the primary business dependency. The code likely logs in, reserves a parking spot, and verifies success against that external system.
- A notification channel is also external, though the exact medium is not visible from the tree. The architecture clearly includes a notification boundary, but the transport could be email, messaging, or another alert mechanism.

Local infrastructure and state

The top-level `c:azurite/` directory contains Azurite state:

- `__azurite_db_blob__.json`
- `__azurite_db_queue__.json`
- `__azurite_db_table__.json`
- `__blobstorage__/...`

This indicates the project depends on Azure Storage abstractions during development or local execution. In an Azure Functions app, storage is usually part of the host/runtime plumbing rather than the reservation business logic. The presence of Azurite suggests:

- local emulation of Blob/Queue/Table storage
- persisted runtime state for the function host
- support for local testing without requiring live Azure Storage

Supporting tooling

- `Dockerfile` shows the function app can be containerized.
- `deploy.sh` suggests a scripted deployment path.
- `manager.sh` likely provides local management or orchestration for running the app and/or emulator.
- `logs/parkalot.log` indicates runtime logging is captured locally, which is useful for diagnosing the workflow steps above.

Architectural boundaries to show in a diagram

If you are drawing this system, the important boundaries are:

- Azure Functions host boundary
  - contains the trigger and function entrypoint
- Application workflow boundary
  - `coordinator.py` plus the service modules
- External Parkalot system boundary
  - authentication, reservation, and verification calls
- Notification boundary
  - outbound status reporting
- Local Azure Storage emulator boundary
  - Azurite backing the function host during development

Overall shape

This is not a multi-service distributed system. It is a single-function automation app with a clean internal separation between orchestration and step-specific services. The main architectural idea is “one scheduled/triggered function coordinates a reservation workflow against an external system, then reports the result.”

Main entry points: [`parkalot-func/ReserveParkalot/coordinator.py`](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/coordinator.py) (Coordinator), [`parkalot-func/host.json`](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/host.json) (Functions host), [`parkalot-func/ReserveParkalot/notification_service.py`](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/notification_service.py) (Notifier), [`parkalot-func/function_app.py`](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/function_app.py) (Function app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph "Azure Functions app"
  host["Functions host<br/>runtime<br/>[host.json]"]
  function_app["Function app<br/>entrypoint<br/>[function_app.py]"]
  reserve_func["ReserveParkalot<br/>function binding<br/>[function.json]"]
  coordinator["Coordinator<br/>orchestrator<br/>[coordinator.py]"]
  date_calc["Date calc<br/>business rule<br/>[date_calculator.py]"]
  login_service["Login service<br/>auth step<br/>[login_service.py]"]
  reservation_service["Reservation service<br/>workflow step"]
  verification_service["Verification<br/>workflow step"]
  notification_service["Notifier<br/>workflow step"]
  notification_factory["Notify factory"]
end

subgraph "Local runtime"
  azurite[("Azurite<br/>storage emulator")]
  local_settings["Local settings<br/>config"]
  dockerfile["Docker image<br/>container support"]
  deploy_script["Deploy script<br/>ops script<br/>[deploy.sh]"]
  manager_script["Manager script<br/>ops script<br/>[manager.sh]"]
  logs["Logs<br/>runtime log<br/>[parkalot.log]"]
end

subgraph "External systems"
  parkalot_backend(("Parkalot backend<br/>external system"))
  notify_target(("Notify target<br/>external channel"))
end

host -->|"runs"| function_app
function_app -->|"registers"| reserve_func
reserve_func -->|"invokes"| coordinator
coordinator -->|"computes date"| date_calc
coordinator -->|"authenticates"| login_service
coordinator -->|"reserves"| reservation_service
coordinator -->|"verifies"| verification_service
coordinator -->|"notifies"| notification_service
notification_service -->|"builds via"| notification_factory
login_service -->|"uses"| parkalot_backend
reservation_service -->|"calls"| parkalot_backend
verification_service -->|"checks"| parkalot_backend
notification_service -->|"sends"| notify_target
host -->|"stores state"| azurite
host -->|"configured by"| local_settings
dockerfile -->|"packages"| function_app
deploy_script -->|"deploys"| dockerfile
manager_script -->|"manages"| host
logs -->|"records"| coordinator

click host "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/host.json"
click function_app "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/function_app.py"
click reserve_func "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/function.json"
click coordinator "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/coordinator.py"
click date_calc "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/date_calculator.py"
click login_service "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/login_service.py"
click reservation_service "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/reservation_service.py"
click verification_service "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/verification_service.py"
click notification_service "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/notification_service.py"
click notification_factory "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/ReserveParkalot/notification_factory.py"
click azurite "https://github.com/cooperkeenan/parkalot/tree/main/c:azurite"
click local_settings "https://github.com/cooperkeenan/parkalot/blob/main/local.settings.json"
click dockerfile "https://github.com/cooperkeenan/parkalot/tree/main/parkalot-func/Dockerfile"
click deploy_script "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/deploy.sh"
click manager_script "https://github.com/cooperkeenan/parkalot/blob/main/manager.sh"
click logs "https://github.com/cooperkeenan/parkalot/blob/main/parkalot-func/logs/parkalot.log"

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 host,function_app,reserve_func,coordinator,date_calc,login_service,reservation_service,verification_service,notification_service,notification_factory toneBlue
class azurite,local_settings,dockerfile,deploy_script,manager_script,logs toneAmber
class parkalot_backend,notify_target toneMint
```

## Components

### Azure Functions app

Python Azure Functions boundary and workflow code

- [Functions host](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/host.json): runtime · Azure Functions runtime boundary · `parkalot-func/host.json`
- [Function app](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/function_app.py): entrypoint · Python function registration and trigger wiring · `parkalot-func/function_app.py`
- [ReserveParkalot](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/function.json): function binding · Main function definition and bindings · `parkalot-func/ReserveParkalot/function.json`
- [Coordinator](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/coordinator.py): orchestrator · Drives the reservation workflow end to end · `parkalot-func/ReserveParkalot/coordinator.py`
- [Date calc](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/date_calculator.py): business rule · Selects the reservation date · `parkalot-func/ReserveParkalot/date_calculator.py`
- [Login service](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/login_service.py): auth step · Authenticates with Parkalot · `parkalot-func/ReserveParkalot/login_service.py`
- [Reservation service](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/reservation_service.py): workflow step · Submits the parking reservation · `parkalot-func/ReserveParkalot/reservation_service.py`
- [Verification](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/verification_service.py): workflow step · Checks reservation success or state · `parkalot-func/ReserveParkalot/verification_service.py`
- [Notifier](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/notification_service.py): workflow step · Sends workflow outcome notifications · `parkalot-func/ReserveParkalot/notification_service.py`
- [Notify factory](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/ReserveParkalot/notification_factory.py): factory · Builds notification payloads or implementations · `parkalot-func/ReserveParkalot/notification_factory.py`

### Local runtime

Emulation, host config, and execution support

- [Azurite](https://github.com/cooperkeenan/parkalot/tree/HEAD/c%3Aazurite): storage emulator · Local Azure Storage emulation for runtime state · `c:azurite`
- [Local settings](https://github.com/cooperkeenan/parkalot/blob/HEAD/local.settings.json): config · Local Azure Functions configuration · `local.settings.json`
- [Docker image](https://github.com/cooperkeenan/parkalot/tree/HEAD/parkalot-func/Dockerfile): container support · Containerized execution for the function app · `parkalot-func/Dockerfile`
- [Deploy script](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/deploy.sh): ops script · Scripted deployment path · `parkalot-func/deploy.sh`
- [Manager script](https://github.com/cooperkeenan/parkalot/blob/HEAD/manager.sh): ops script · Local run and management helper · `manager.sh`
- [Logs](https://github.com/cooperkeenan/parkalot/blob/HEAD/parkalot-func/logs/parkalot.log): runtime log · Captured function runtime output · `parkalot-func/logs/parkalot.log`

### External systems

Parkalot backend and outbound notification targets

- **Parkalot backend**: external system · External reservation site or API
- **Notify target**: external channel · Outbound notification destination

## Connections

- Functions host → Function app: runs · Functions host loads the Python app
- Function app → ReserveParkalot: registers · Function app exposes the ReserveParkalot trigger
- ReserveParkalot → Coordinator: invokes · Entry function delegates to the orchestration layer
- Coordinator → Date calc: computes date · Selects the target reservation date
- Coordinator → Login service: authenticates · Logs in before reservation actions
- Coordinator → Reservation service: reserves · Submits the booking request
- Coordinator → Verification: verifies · Checks that the reservation succeeded
- Coordinator → Notifier: notifies · Reports success or failure at the end of the workflow
- Notifier → Notify factory: builds via · Uses factory to construct notification output
- Login service → Parkalot backend: uses · Authenticates against the external Parkalot system
- Reservation service → Parkalot backend: calls · Sends reservation requests to Parkalot
- Verification → Parkalot backend: checks · Validates reservation state in Parkalot
- Notifier → Notify target: sends · Emits status notifications to an external channel
- Functions host → Azurite: stores state · Uses local storage emulation during development
- Functions host → Local settings: configured by · Local runtime settings for the Functions host
- Docker image → Function app: packages · Builds the function app into a container image
- Deploy script → Docker image: deploys · Uses container or app packaging for deployment
- Manager script → Functions host: manages · Supports local execution and host management
- Logs → Coordinator: records · Captures workflow execution output
