---
title: "Architecture"
space: "Frappoint"
url: "https://docs.navari.co.ke/frappoint/developer-architecture"
updated: "2026-11-30"
---

Frappoint is a Frappe app (`frappoint`) that needs ERPNext, Frappe HR (`hrms`) and Payments (`payments`), all on version 16. It has two Frappe modules and two Vue front ends.

## Repository layout

```text
frappoint/                      the Frappe app (Python package)
├── hooks.py                    install, doc events, scheduler, permissions, fixtures
├── frappoint/                  module "Frappoint": appointments and spa
│   ├── doctype/                Service Appointment, Service Booking, Service Type, ...
│   ├── api/                    whitelisted endpoints for the Booking Desk and portal
│   ├── services/               business logic: availability, booking transactions, pricing
│   ├── report/                 Script Reports
│   ├── sidebar/, workspace/    desk navigation
├── vuna_hospitality/           module "Vuna Hospitality": the hotel PMS
│   ├── doctype/                74 DocTypes: Hotel Property, Stay Reservation, Guest Folio, ...
│   ├── api/                    whitelisted endpoints for the Hotel workspace
│   ├── services/               business logic, one module per area (folio, night_audit, ...)
│   ├── report/, print_format/  hotel reports and the Information Folio
│   ├── constants.py            role groups and property-scoped DocTypes
│   └── tests/
├── sample_data/                generate and remove the sample spa and hotel
├── fixtures/                   roles, custom fields, lost reasons
├── payments.py                 payment gateway integration
├── public/, www/               built front ends (generated, not committed)
booking_desk/                   Vue 3 app: the staff Booking Desk (/booking_desk)
portal/                         Vue 3 app: the customer portal (/portal)
```

## Layers

- **DocTypes** hold the data and enforce rules on save (validation, naming, links).
- **Services** (`*/services/*.py`) hold the business logic. Each module starts with a docstring explaining its rules; read it before changing the module. Commands that change several records (holding rooms, posting to a folio, settling) lock rows in a fixed order and are safe to retry.
- **API** (`*/api/*.py`) are thin `@frappe.whitelist()` wrappers that check permissions and call the services. The Vue apps call only these, plus standard `frappe.client` methods. See the [API reference](/frappoint/api-reference).
- **Hooks** (`hooks.py`) connect Frappoint to ERPNext and HRMS documents and run scheduled jobs. See [Hooks, jobs and integrations](/frappoint/hooks-jobs-and-integrations).

## Front ends

Both are Vue 3 single-page apps built with [Frappe UI](https://github.com/frappe/frappe-ui), Vite, Pinia and Tailwind.

| App | Source | Served at | Built to |
| --- | --- | --- | --- |
| Booking Desk | `booking_desk/` | `/booking_desk` | `frappoint/public/booking_desk`, `frappoint/www/booking_desk/index.html` |
| Customer portal | `portal/` | `/portal` | `frappoint/public/portal`, `frappoint/www/portal/index.html` |

The build output is ignored by git; `bench build` produces it.

The Booking Desk has two **workspaces**: *Services* (spa) and *Hotel*. Which ones a user sees depends on their roles (`booking_desk/src/stores/auth.js`) and on whether hospitality is enabled (`booking_desk/src/stores/workspace.store.js`). Routes are in `booking_desk/src/router.js`.

## Hospitality feature flag

Hospitality is switched on by **Enable Hospitality** in Hospitality Settings. `vuna_hospitality/services/feature_flag.py` provides:

- `is_hospitality_enabled()`;
- `@require_hospitality`, used on hotel endpoints so they refuse to run while it's off.

Hooks into shared documents (Service Appointment, POS Invoice, Sales Invoice) check the flag and return at once when it's off, so appointment-only sites are unaffected. `sync_hospitality_visibility` shows or hides the Hospitality desktop icon after migrate and when the setting changes.

## Property scoping

Hotel records belong to a **Hotel Property**. `vuna_hospitality/services/property_scope.py` limits users to the properties in their **User Permissions** on Hotel Property (none means all; System Manager is never limited):

- `permission_query_conditions` and `has_permission` hooks cover every DocType in `PROPERTY_SCOPED_DOCTYPES` (`constants.py`);
- services use `scope_filters()` and `assert_property_access()` for raw SQL and APIs.

Add a new property-scoped DocType to `PROPERTY_SCOPED_DOCTYPES` so it gets the same protection.

## Money and posting

- Folio amounts are handled in integer minor units (`services/money.py`), so totals and splits never drift by rounding.
- Every folio line is created through `services/folio.post()` with a unique **posting key** (for example `night:<stay>:<date>:room`). The key's unique index makes posting exactly-once: a retried night audit, POS submit or check-out never posts twice.
- Folio Transactions are never edited or deleted. Corrections are new lines (reversal, transfer, credit note).

## Hotel inventory

Nightly room-type availability is kept in **Room Type Inventory Day** counters, updated under a row lock when rooms are held, sold or released. What counts as demand is pluggable: `hooks.py` lists `hospitality_inventory_demand_sources` (stays and group blocks), and `inventory.rebuild_property_inventory` recomputes the counters from them.
