@oliverbill/fastroute-domain
v0.3.0
Published
FastRoute shared domain rules (single source of truth) for mobile + backend.
Readme
fastroute-domain
Single source of truth for FastRoute business rules, shared across:
- React Native (Android/iOS)
- Backend (Node/Nest)
- Orchestrators (n8n) indirectly via an API that imports this package
This repository implements the rules extracted from your n8n flows:
- Validate JWT (structural + result normalization)
- Add Route (DBSCAN preconditions + clustering params defaults + waypoint generation)
- Includes meter-based clustering helper:
clusterizeAddressPointsByMeters
- Includes meter-based clustering helper:
- Finish Route (route status + no pending waypoints)
- Finish Waypoint (allowed transitions + mandatory photo metadata + upload/record preconditions)
Install
npm i fastroute-domainUsage (examples)
import {
validateJwtInput,
dbscanDefaults,
dbscanMetersDefaults,
validateDbscanPoints,
clusterizeAddressPointsByMeters,
generateWaypointsForCluster,
canFinishRoute,
validateFinishWaypoint
} from "fastroute-domain";Development
npm i
npm run test
npm run buildNotes
- This library is pure: no network calls, no Supabase SDK calls.
- JWT verification is represented as:
- structural validation (token presence)
- normalization of a provider response (valid/invalid)
Your backend (or edge function) should perform the actual Supabase /auth/v1/user call and then feed the response to these helpers.
