You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is Sonexa?
Sonexa is a premium, full-stack medical reporting web application built specifically for fetal ultrasound specialists (particularly TIFFA — Targeted Imaging For Fetal Anomalies). It allows clinicians to securely log in, fill in detailed fetal scan data across structured tabs, apply reusable text snippet templates, preview a fully formatted multi-page clinical report, and export it to PDF — all from a sleek glassmorphic browser interface.
Think of it as a private, self-hosted digital reporting suite for sonographers — replacing paper forms and generic word processors with a structured, intelligent, print-ready report generator backed by a cloud database.
Users sign in with Email/Password, get access to their personal vault of patient reports, manage reusable anatomy snippets (templates), configure their profile, and generate print-ready 6-page clinical PDFs — all within a stunning violet–fuchsia–pink glassmorphic dark UI.
How Does It Work?
For Users (Clinicians / Sonographers)
Open the App — The user visits the Sonexa URL and is greeted by a cinematic animated login screen — a centered logo that morphs and slides to the top-left corner as the glassmorphic sign-in card fades in.
Sign In — The user signs in using Email/Password (with sign-up, email verification support, and password reset via Firebase).
View the Dashboard — After logging in, the user sees their personal report vault:
A grid of patient report cards, sorted by last updated date.
Each card shows patient name, ID, age, and visit date.
Quick actions: Edit, Delete, Print (PDF view), and Clone as Template.
Create a Report — The user clicks New Report and is taken to the multi-tab ReportEditor. The editor is divided into 5 structured tabs:
Patient Info: Name, ID, Age/Sex, Visit No, Referred By, Visit Date, LMP Date, LMP EDD.
Fetus Survey: Presentation, Placenta, Liquor, SDP, AFI, Umbilical Cord, Fetal Activity, Cardiac Activity, FHR, plus a Maternal/Cervix templated textarea.
Biometry & Bones: BPD, HC, AC, FL-Rt, EFW (with auto-calculated gestational age and percentile) and Long Bones, TCD, Aneuploidy Markers.
Anatomy & Doppler: Fetal Anatomy (Head, Neck, Spine, Face, etc.) each with snippet template selectors, plus Fetal Doppler.
Auto-Biometry Calculations — The system uses clinical formulae (Hadlock, Mediscan) to automatically calculate gestational age (e.g., "28W 3D") and growth percentile for each biometry measurement whenever a value or date changes.
Snippet Templates — For every anatomy text field, clinicians can select from their saved reusable snippets (e.g., "Normal Head View", "Normal Heart") or save the current content as a new snippet.
Upload Reference Images — Doctors can upload reference ultrasound images alongside the report form for visual reference while typing.
View & Print Report — Clicking Print navigates to the ReportView, rendering a full, clinical-grade 6-page A4 report featuring graphs, anatomy breakdowns, doppler readings, and legal doctor signature blocks.
Download as PDF — Uses dom-to-image + jsPDF to render each A4 page as a JPEG image and bundle them into a multi-page PDF, saved as Sonexa_Report_<PatientName>.pdf.
Profile Settings — Users can update their display name, upload a profile photo (stored as a base64 data URL in Turso), change passwords, or securely delete their account and associated data.
The Key Architecture Idea
Sonexa uses a single Express server that serves both the React SPA and all API routes, heavily optimized for Vercel deployment:
Mode
Behaviour
Development
Vite middleware is injected into the Express server for Hot Module Reload (HMR). Run with npm run dev (tsx server.ts).
Production
Vite builds the frontend into /dist. Express serves the static files and handles all /api/* routes as a Vercel Serverless Function.
Client-Side Compute: The auto-biometry calculation engine runs entirely client-side using clinical Hadlock/Mediscan formulae — no server round-trips needed.
Stateless Storage: Profile photos are stored as base64 data URLs directly in the Turso users table, avoiding the need for dedicated file storage services.
Technologies Used
Frontend (What You See)
Technology
What It Does
React 19
The entire UI is a React Single-Page Application.
TypeScript
Strict typing across all components, types, and API calls.
TailwindCSS v4
Utility classes for rapid, consistent glassmorphic dark UI styling.
Framer Motion
Powers cinematic login animations and smooth page transitions.
Lucide React
The icon library used for all UI icons.
React Router DOM v7
Client-side routing between Dashboard, Editor, Print Views, and Profile.
Backend (Behind the Scenes)
Technology
What It Does
Express (Node.js)
The web framework powering all API routes (CRUD operations).
TypeScript (tsx)
The backend is executed directly using tsx — no local compile step needed.
Turso (libSQL)
Globally distributed, edge-native SQLite database storing all users, reports, and templates.
Vite Middleware
In development, Vite is embedded directly inside the Express server for HMR.
Auth & PDF Generation
Technology
What It Does
Firebase Auth
Manages all user authentication. The Firebase UID acts as the database primary key.
dom-to-image & jsPDF
Converts HTML DOM pages into high-res JPEGs, then assembles them into a downloadable multi-page A4 PDF.
Deployment (Vercel)
Technology
What It Does
Vercel
Hosts both the static frontend (CDN) and the Express backend (Serverless Function via @vercel/node).
esbuild
Bundles server.ts → dist/server.cjs for highly optimized Vercel deployment.
API Endpoints
User & Utility Management
Route
Method
Description
/api/users/:userId
GET
Fetch a user's profile (photo URL)
/api/users/:userId
POST
Create or update a user record (upsert photoURL)
/api/users/:userId
DELETE
Delete a user and cascade delete reports/templates
# Turso DatabaseTURSO_DATABASE_URL=libsql://your-database.turso.ioTURSO_AUTH_TOKEN=your-turso-auth-token# Firebase (Authentication)VITE_FIREBASE_API_KEY=AIza...VITE_FIREBASE_AUTH_DOMAIN=your-app.firebaseapp.comVITE_FIREBASE_PROJECT_ID=your-project-idVITE_FIREBASE_STORAGE_BUCKET=your-app.appspot.comVITE_FIREBASE_MESSAGING_SENDER_ID=123456789VITE_FIREBASE_APP_ID=1:123456789:web:abcdef# Gemini AI (Optional - for future AI-assist features)GEMINI_API_KEY=your-gemini-api-key# App URLAPP_URL=[https://your-app.run.app](https://your-app.run.app)
Summary
Sonexa is a production-grade, full-stack fetal ultrasound clinical reporting platform built by Spirit Services. Clinicians log in via Firebase Auth, create and manage detailed patient scan reports backed by Turso's edge database, apply reusable anatomy snippet templates, auto-compute biometry gestational ages and percentiles using clinical Hadlock/Mediscan formulae, and export pixel-perfect 6-page A4 clinical reports as PDFs — all wrapped in a premium glassmorphic violet/fuchsia dark UI with a cinematic animated login sequence.
The entire stack — React 19, TailwindCSS v4, Framer Motion, Express, Turso, Firebase — is deployed globally on Vercel with zero infrastructure to manage.
A full-stack medical reporting web app for fetal ultrasound specialists featuring automated biometry calculations, snippet templates, and dynamic clinical PDF generation.