How supportopenhouse/ohsupplyforms works
Purpose and Entry Points
Openhouse Forms is a server-rendered/static-client property-management workflow. Ground staff record property visits, sales staff create token/deal records, and managers review records linked by a shared UID. The Node/Express entry point is openhouse-forms/server.js; browser entry pages are served from openhouse-forms/public/, notably visit.html, token-request.html, token-deal.html, and admin.html.
HTTP Application Layer
openhouse-forms/server.js initializes Express, runs database migration at startup, serves static assets, and mounts route modules. Route modules define the business API boundary between vanilla browser pages and PostgreSQL:
• Visit capture and property lookup: openhouse-forms/routes/visit.js
• Token request/deal workflows: openhouse-forms/routes/token-request.js, openhouse-forms/routes/token-deal.js
• Listing/finalization lifecycle: openhouse-forms/routes/listing.js, openhouse-forms/routes/final.js
• Scheduling and pending requests: openhouse-forms/routes/schedule.js, openhouse-forms/routes/pending-request.js
Property Workflow and UID Linkage
The central control flow begins with a visit record, which generates or uses a UID and persists property/visit context. Subsequent sales-side flows retrieve this shared identity to prefill or update token, listing, schedule, and deal stages. The route separation suggests the application models operational states as distinct form-driven stages rather than a single generic CRUD interface. Primary UI surfaces include openhouse-forms/public/visit.html, openhouse-forms/public/listing.html, and openhouse-forms/public/final.html.
Data Persistence and Reference Data
PostgreSQL is accessed through a shared pool in openhouse-forms/db/pool.js. Schema creation/migration is centralized in openhouse-forms/db/migrate.js and invoked on server startup; initial city/locality/society and related reference data is loaded by openhouse-forms/db/seed.js. Configuration/dropdown APIs are isolated in openhouse-forms/routes/config.js, keeping reference-data retrieval separate from transactional workflows.
Authentication and Administrative Boundaries
Authentication middleware resides in openhouse-forms/middleware/auth.js, establishing a protected-route boundary where applied by the server/routes. Administrative and operational pages are static clients backed by APIs, including openhouse-forms/public/admin.html and openhouse-forms/public/my-properties.html. Shared client behavior, including common request/UI utilities, is concentrated in openhouse-forms/public/js/shared.js.
Documents, Billing, and External Integrations
Server utilities handle outbound artifacts and communications: PDF/invoice generation in openhouse-forms/utils/pdf-template.js and openhouse-forms/utils/invoice-template.js; email via openhouse-forms/utils/email-sender.js and openhouse-forms/utils/gmail-send.js; WhatsApp messaging through openhouse-forms/utils/whatsapp.js. Associated business endpoints include openhouse-forms/routes/cp-bill.js, openhouse-forms/routes/ama-details.js, and openhouse-forms/routes/external.js. OCR ingestion is separately bounded in openhouse-forms/routes/ocr.js.
Runtime and Infrastructure
The runtime is Node.js with Express and a vanilla HTML/CSS/JavaScript frontend—no frontend build pipeline. PostgreSQL is intended to run on Neon, with DATABASE_URL supplied through environment configuration. Render hosts the long-running Node service. PDFKit performs server-side PDF generation; Gmail/email and WhatsApp utilities indicate external messaging-provider dependencies. Deployment must permit startup migrations and a separately invoked seed operation.
Main entry points: server.js Express server · pool.js Database pool · shared.js Shared client utilities · cp-bill.js Billing and external API
Components 21
Static browser client
- Visit form · Ground staff capture property visits and UID context.
openhouse-forms/public/visit.html - Sales forms · Token request and deal forms use the shared property identity.
openhouse-forms/public/token-request.html - Listing lifecycle forms · Listing and finalization are distinct operational stages.
openhouse-forms/public/listing.html - Admin operations
openhouse-forms/public/admin.html - Shared client utilities · Common request and UI behavior for static pages.
openhouse-forms/public/js/shared.js
Express API
- Express server · Serves static clients, runs migrations, and mounts APIs.
openhouse-forms/server.js - Auth middleware
openhouse-forms/middleware/auth.js - Visit and property API · Captures visits and performs property lookup.
openhouse-forms/routes/visit.js - Token workflows · Request and deal stages retrieve and update shared UID records.
openhouse-forms/routes/token-request.js - Listing and final API · Handles listing and finalization lifecycle stages.
openhouse-forms/routes/listing.js - Schedule and pending API
openhouse-forms/routes/schedule.js - Reference data API · Separates dropdown and configuration data from transactions.
openhouse-forms/routes/config.js - Billing and external API · Exposes billing, AMA, external, and OCR business endpoints.
openhouse-forms/routes/cp-bill.js
PostgreSQL data layer
- Database pool
openhouse-forms/db/pool.js - Schema migration · Creates or upgrades schema at service startup.
openhouse-forms/db/migrate.js - Reference-data seed · Loads initial city, locality, society, and related data separately.
openhouse-forms/db/seed.js - Neon PostgreSQL · Connected through DATABASE_URL.
Documents and integrations
- PDF and invoice generation · Produces outbound PDF and invoice artifacts with PDFKit.
openhouse-forms/utils/pdf-template.js - Email and WhatsApp · Sends email and WhatsApp communications through providers.
openhouse-forms/utils/email-sender.js - Messaging providers · Gmail/email and WhatsApp delivery dependencies.
Other components
- Render · Hosts the long-running Node service.
Connections 28
- Visit form → Shared client utilities: uses
- Sales forms → Shared client utilities: uses
- Listing lifecycle forms → Shared client utilities: uses
- Admin operations → Shared client utilities: uses
- Shared client utilities → Express server: API requests
- Express server → Auth middleware: applies where protected
- Express server → Visit and property API: mounts
- Express server → Token workflows: mounts
- Express server → Listing and final API: mounts
- Express server → Schedule and pending API: mounts
- Express server → Reference data API: mounts
- Express server → Billing and external API: mounts
- Visit and property API → Token workflows: shared UID context
- Token workflows → Listing and final API: advances shared records
- Visit and property API → Database pool: queries and persists
- Token workflows → Database pool: reads and updates
- Listing and final API → Database pool: persists stages
- Schedule and pending API → Database pool: reads and updates
- Reference data API → Database pool: reads reference data
- Billing and external API → Database pool: reads business records
- Database pool → Neon PostgreSQL: DATABASE_URL
- Express server → Schema migration: runs at startup
- Schema migration → Neon PostgreSQL: migrates schema
- Reference-data seed → Neon PostgreSQL: loads reference data
- Billing and external API → PDF and invoice generation: generates artifacts
- Billing and external API → Email and WhatsApp: sends notifications
- Email and WhatsApp → Messaging providers: delivers
- Render → Express server: hosts