Skip to content

Project Overview

SafeCall is a comprehensive indoor location tracking and safety system for enterprises. It consists of four main components organized as a monorepo.

Architecture

                    ┌─────────────────┐
                    │  main.config    │
                    │    .json        │
                    └────────┬────────┘

        ┌────────────────────┼────────────────────┐
        │                    │                    │
        ▼                    ▼                    ▼
┌───────────────┐   ┌───────────────┐   ┌───────────────┐
│     lib/      │◄──│   server/     │   │    web/       │
│  (shared TS)  │   │  (Bun API)    │   │  (Frontend)   │
└───────┬───────┘   └───────┬───────┘   └───────┬───────┘
        │                   │                   │
        │                   └─────────┬─────────┘
        │                             │
        │                    ┌────────▼────────┐
        │                    │  Web embedded   │
        │                    │  in server bin  │
        │                    └─────────────────┘


┌───────────────┐
│   mobile/     │
│  (Flutter)    │   ← Contract tests validate API ↔ Dart models
└───────────────┘

Components

ComponentDirectoryTech StackPurpose
Serverserver/Bun, TypeScript, SQLiteBackend API, MQTT bridge, tracking algorithms
Webweb/TypeScript, Bulma, Pixi.jsAdmin UI for management and monitoring
Mobilemobile/Flutter, Flame, DartIndoor navigation app with BLE positioning
Liblib/TypeScript, ValibotShared schemas, DB, HTTP, MQTT, JWT utilities
Scriptsscripts/Bash, TypeScriptBuild, release, install, and CLI tooling

Data Flow

  1. BLE Beacons broadcast advertisement packets (adv1/adv4/adv8)
  2. Gateways receive beacon signals and forward them via MQTT
  3. Server processes MQTT messages for tracking, events, and device sync
  4. Web UI displays real-time tracking, manages infrastructure via HTTP/WebSocket
  5. Mobile App scans BLE beacons directly for indoor navigation and pathfinding

Monorepo Scripts

All scripts are run from the project root with bun:

CommandDescription
bun commitServer release pipeline (version bump, test, build, commit, push)
bun release:mobileMobile release pipeline (test, bump, build, commit, push)
bun buildBuild everything (server binaries + mobile apps)
bun build:serverBuild server binaries only
bun build:mobileBuild mobile apps only (AAB + IPA)
bun test:contractsRun contract tests (server ↔ mobile API validation)
bun docs:devStart docs dev server
bun docs:buildBuild docs static site

Configuration

The project uses a single main.config.json file at the root. Each service uses its directory name as a prefix for its configuration keys. See the Configuration page for details.