Supporting Modules
These smaller modules provide the infrastructure around the core voice pipeline: user onboarding, operational visibility, file storage, templating, and background job scheduling.
Signup
Section titled “Signup”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:
- Validate all inputs (name, email format, password length, org name)
- Check for duplicate email in
email_password_account - Hash password with bcrypt
- Create a Twilio subaccount for the organization
- Insert records:
user→email_password_account→organization→member→session - 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.
Dashboard
Section titled “Dashboard”Path: src/mods/dashboard/
Real-time operational overview for the organization.
Endpoint: GET /api/dashboard/stats (authenticated)
Returns: DashboardStats containing:
| Field | Type | Description |
|---|---|---|
total_calls_7d | u32 | Call count, last 7 days |
pending_todos | u32 | Todos needing review |
active_contacts | u32 | Contacts with at least one call |
total_contacts | u32 | All org contacts |
call_activity | Vec<DailyCallCount> | 7-day bar chart data (date, label, count) |
recent_calls | Vec<RecentCall> | Top 5 recent calls with contact name, recording flag |
todo_status_counts | Vec<TodoStatusCount> | Counts per status (pending_review, approved, etc.) |
call_heatmap | Vec<HeatmapCell> | 7×24 grid (day 0–6, hour 0–23, count) |
call_heatmap_max | u32 | Max cell value for opacity scaling |
UI Components
Section titled “UI Components”- 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
Template
Section titled “Template”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.
Job Scheduling
Section titled “Job Scheduling”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.