Skip to content

Supporting Modules

These smaller modules provide the infrastructure around the core voice pipeline: user onboarding, operational visibility, file storage, templating, and background job scheduling.

Path: src/mods/signup/

Handles new user registration in a single API call.

Endpoint: POST /api/auth/sign-up (public, no auth required)

Parameters: name, email, password, organization_name

Flow:

  1. Validate all inputs (name, email format, password length, org name)
  2. Check for duplicate email in email_password_account
  3. Hash password with bcrypt
  4. Create a Twilio subaccount for the organization
  5. Insert records: useremail_password_accountorganizationmembersession
  6. Return session token (auto-login, 30-day TTL)

New organizations get report_daily_enabled: true and report_per_call_enabled: true by default.

On failure, cleanup helpers cascade-delete partially created records.

Response variants: Success(session_token), InvalidUserName, InvalidEmail, PasswordTooShort, InvalidOrganizationName, EmailAlreadyRegistered, TwilioSubaccountError, InternalError.

Path: src/mods/dashboard/

Real-time operational overview for the organization.

Endpoint: GET /api/dashboard/stats (authenticated)

Returns: DashboardStats containing:

FieldTypeDescription
total_calls_7du32Call count, last 7 days
pending_todosu32Todos needing review
active_contactsu32Contacts with at least one call
total_contactsu32All org contacts
call_activityVec<DailyCallCount>7-day bar chart data (date, label, count)
recent_callsVec<RecentCall>Top 5 recent calls with contact name, recording flag
todo_status_countsVec<TodoStatusCount>Counts per status (pending_review, approved, etc.)
call_heatmapVec<HeatmapCell>7×24 grid (day 0–6, hour 0–23, count)
call_heatmap_maxu32Max cell value for opacity scaling
  • KPI Cards — 4-card grid: total calls, avg duration (coming soon), pending todos, active contacts
  • Call Activity Chart — CSS bar chart, amber bars, 7-day view
  • Call Heatmap — 7×24 grid with amber opacity scaling, hour labels every 3 hours, scrollable
  • Recent Calls — Clickable rows linking to call details, shows contact name and recording icon
  • Todo Status — Color-coded progress bars per status
  • Quick Actions — 3 cards: Create Agent, Buy Phone, New Contact

Path: src/mods/template/

Development scaffolding demonstrating the server function pattern. Contains a minimal echo API and component.

Endpoint: POST /api/echo (public) — returns the input string unchanged.

The Echo component calls echo_endpoint on each keystroke and displays "Server echoed: {response}". The HomeView renders only this component. A commented-out test_api handler demonstrates agent prompt generation.

Path: src/mods/store/

Server-side file storage for call recordings and transcriptions.

pub async fn write_file(name: &str, data: &[u8]) -> Result<(), AppError>

Writes to data/{name} on the local filesystem, creating parent directories as needed. Server-only (#[cfg(not(target_family = "wasm"))]).

No read, delete, or list operations exist yet.

Path: src/bases/job/

Defines the trait interface for background jobs.

#[async_trait]
pub trait JobTrait: Send + Sync {
fn spec(&self) -> String; // Cron expression, e.g. "0 8 * * *"
async fn f(&self) -> (); // Work to execute
}

Implementors declare a cron schedule via spec() and the work function via f(). The Send + Sync bounds enable multi-threaded scheduling. Error handling is the implementor’s responsibility — f() returns ().

The job runner and registry live outside this base module, in the application layer.

  • Agent — quick actions link to agent creation
  • Phone — quick actions link to phone purchase
  • Call — dashboard displays call activity and recent calls
  • Twilio — signup creates a Twilio subaccount