Security Architecture

Security at LifeQuant

Your life data is deeply personal. LifeQuant is designed to keep that data protected through application-level encryption, authenticated access, user-level data isolation, and controlled handling of information sent to external services.

This page explains the security controls currently implemented in the LifeQuant application.

Protecting Your Data

LifeQuant stores information such as your profile, activities, goals, financial configurations, reflections, summaries, and insights in MongoDB.

Sensitive fields are protected with application-level AES-256-GCM encryption before they are written to the database.

This means that selected sensitive values are encrypted by the LifeQuant backend rather than being stored as ordinary plaintext.

Application-Level Encryption

LifeQuant uses:

  • AES-256-GCM authenticated encryption
  • 256-bit encryption keys
  • A new 12-byte random initialization vector (IV) for each encrypted field write
  • A 16-byte authentication tag to provide integrity protection
  • Versioned ciphertext format to support future encryption migrations

Encryption is implemented in the backend using Node.js's native cryptography capabilities.

Sensitive encrypted data includes selected fields across user profiles, life events, goals, goal analytics, daily reflections, summaries, insights, and food-processing logs.

Password Protection

Passwords are never stored as plaintext.

LifeQuant uses bcryptjs with 12 salt rounds to hash passwords before they are stored.

When you log in, the password you provide is compared against the stored hash. The original password cannot be recovered from the stored password hash.

Password hashes are also excluded from normal user JSON serialization.

Authentication

LifeQuant supports multiple authentication mechanisms:

Email and Password

Users can create accounts using an email address and password. Email verification uses a 6-digit, time-limited OTP sent through the application's email delivery system.

Google Sign-In

LifeQuant supports Google authentication using Google's OAuth infrastructure. Google authentication tokens are verified through Google's APIs before the LifeQuant account is created or linked.

Session Authentication

Authenticated API requests use signed JSON Web Tokens (JWTs).

JWTs currently have a 7-day expiration period and are sent to the backend through the HTTP Authorization: Bearer header.

LifeQuant currently stores the JWT in the browser's localStorage. Authentication does not use cookies.

User Data Isolation

Each user's LifeQuant data is associated with their account through a user identifier.

Backend database operations explicitly scope user-owned resources to the authenticated user's ID.

For example, events, goals, goal logs, analytics, summaries, insights, and daily aggregates are queried using the authenticated user's ownership identifier.

This prevents ordinary user requests from simply requesting another user's records by changing a resource ID.

Administrative endpoints use a separate authorization layer that verifies the authenticated user's role before granting access.

Protecting Sensitive Fields

The following categories contain fields that are protected with application-level encryption where implemented:

Account information
User profile information
Financial configurations
Life and activity event details
Goal descriptions and metadata
Goal analytics
Goal tracking metadata
Daily reflections
Generated summaries
AI-generated insights
Certain food-processing logs

Encryption is applied transparently through LifeQuant's repository layer before protected fields are persisted.

Encryption Key Protection

The application's primary data-encryption key is maintained on the backend as the DATA_ENCRYPTION_KEY environment variable.

The encryption key:

  • Is required to be exactly 32 bytes
  • Is loaded only by the backend
  • Is not included in frontend bundles
  • Is not returned through the application's API responses

The repository also contains a manual migration mechanism for changing encryption keys.

Automated key rotation is not currently implemented.

AI and Your Data

LifeQuant uses external AI services for certain features, including natural-language activity parsing and nutritional heuristics.

The application currently uses Groq Cloud API for these AI operations.

When LifeQuant sends information for natural-language activity parsing, the data sent includes:

  • The user's activity or message text
  • Active custom goal titles when relevant

The implementation does NOT send the user's LifeQuant user ID, email address, or account credentials to the AI provider as part of these prompts.

For food-related AI heuristics, the application sends unresolved food information and relevant portion context.

What LifeQuant Does Not Claim

The LifeQuant codebase can verify what information is sent to the AI service, but it cannot independently verify the AI provider's:

  • Data retention policies
  • Internal logging practices
  • Model-training policies
  • Infrastructure security controls

Those policies are governed by the respective external provider.

Third-Party Services

LifeQuant integrates with several external services to provide specific functionality.

ServicePurposeInformation Transmitted
GroqAI activity parsing and food heuristicsActivity text, custom goal titles, food item information
EdamamNutrition informationIngredient or food query strings
GoogleAuthenticationAuthentication/token information required for Google sign-in
Gmail SMTPVerification and password-reset emailsRecipient email, first name, OTP
TelegramMessaging interfaceMessages and activity information sent through the Telegram integration
Meta WhatsApp Cloud APIMessaging interfaceMessages and activity information sent through the WhatsApp integration

Third-party API credentials are kept on the backend using environment variables and are not exposed through the frontend application.

API Security

LifeQuant's API uses several application-level controls.

Authentication

Protected endpoints require a valid JWT through the Authorization header.

Authorization

Authenticated requests are associated with the user represented by the JWT.

Database operations use the authenticated user's ID to scope access to user-owned resources.

Input Validation

The backend validates structured inputs before processing them. Examples include:

  • User profile type and range validation
  • Event data validation
  • Goal schema validation
  • Email validation
  • Password length validation
  • OTP validation
  • CSV upload restrictions

CSV activity imports are limited to 2 MB and restricted to CSV files.

CORS

The backend uses an explicit CORS origin allowlist rather than accepting arbitrary origins.

The configured origins include LifeQuant's production domains and designated development origins.

Database Security

LifeQuant uses MongoDB with Mongoose.

The database connection is configured through the backend's MONGODB_URI environment variable, and the connection configuration specifies SSL/TLS.

Mongoose is used as the application's database abstraction layer for database operations.

Application-level encryption provides an additional layer of protection for designated sensitive fields before they are stored.

What We Do Not Claim

The application source code alone cannot verify MongoDB Atlas's infrastructure-level controls, including:

  • Encryption-at-rest configuration
  • Backup configuration
  • Backup retention
  • Disaster recovery procedures
  • Physical infrastructure security

These depend on the database provider's infrastructure and configuration.

Background Jobs

LifeQuant uses scheduled backend jobs for certain automated operations.

Vercel Cron endpoints are protected using a backend CRON_SECRET and bearer-token verification.

This prevents unauthenticated requests from being treated as authorized cron invocations.

File Upload Protection

LifeQuant supports CSV imports for activity data.

Uploads are:

  • Restricted to CSV files
  • Limited to 2 MB
  • Processed using in-memory storage before being handled by the application

Browser Security

LifeQuant's frontend is built with React and communicates with the backend through its API.

The application does not use dangerouslySetInnerHTML in the frontend codebase.

Authentication tokens are stored in browser localStorage and attached to API requests using the Authorization header.

LifeQuant does not currently use authentication cookies.

The current implementation does not include several browser-level security mechanisms such as:

  • Content Security Policy headers
  • Explicit HSTS configuration
  • X-Frame-Options
  • X-Content-Type-Options
  • Referrer-Policy
  • Permissions-Policy
  • Cookie-based HttpOnly / Secure / SameSite controls
  • Because LifeQuant uses bearer tokens in request headers rather than cookies, its authentication architecture does not rely on cookie-based session authentication.

    Logging and Error Handling

    LifeQuant uses centralized backend error handling for common application errors, including:

    • Invalid database identifiers
    • Database validation errors
    • Duplicate database records
    • Invalid or expired JWTs
    • Unexpected server errors

    Stack traces are logged on the backend but are not returned in API responses.

    The application does not intentionally log passwords or JWT tokens through its standard logging statements.

    However, development logging currently includes certain operational data such as raw LLM responses, parser prompts, active goal titles, and raw Edamam responses.

    For this reason, development logs should be treated as potentially sensitive operational data.

    Secrets and Credentials

    Backend credentials are loaded through environment variables rather than being embedded directly into application code.

    These include credentials for:

    MongoDB
    JWT signing
    Application encryption
    Groq
    Edamam
    Gmail SMTP
    Telegram
    WhatsApp
    Vercel Cron authorization

    The Google OAuth client ID used by the frontend is intentionally public because it is a client-side OAuth identifier rather than a backend secret.

    Account and Data Deletion

    LifeQuant provides account deletion functionality.

    The current deletion implementation removes the user's:

    • User account
    • Events
    • Daily aggregates
    • Goals
    • Goal logs
    • Insights

    Shared nutrition-cache data is not deleted when an individual account is removed because that cache is not user-scoped.

    An Important Transparency Note

    The current implementation does not include Summary and GoalAnalytics in the bulk account-deletion operation.

    Therefore, LifeQuant does not currently claim that account deletion removes every database record associated with a user.

    This is an identified implementation limitation and is separate from the primary account and activity records listed above.

    What LifeQuant Can Verify

    The following security controls are directly supported by the current application code:

    • Sensitive database fields use AES-256-GCM application-level encryption.
    • Passwords are hashed using bcryptjs with 12 salt rounds.
    • JWT-based authentication is implemented with 7-day token expiration.
    • Administrative endpoints require an authenticated admin role.
    • User-owned data is scoped using user identifiers.
    • CORS uses an explicit origin allowlist.
    • AI prompts omit user IDs and email addresses.
    • Vercel Cron routes require a configured secret.
    • CSV uploads are limited to 2 MB and restricted to CSV files.
    • Backend secrets are loaded through environment variables.
    • Centralized error handling is implemented.

    What Cannot Be Verified From Application Code Alone

    Some aspects of security depend on infrastructure providers, operational procedures, or external policies rather than application source code.

    The LifeQuant repository cannot independently verify:

    • Cloud provider physical security
    • MongoDB Atlas encryption-at-rest configuration
    • Cloud infrastructure DDoS protection
    • Backup frequency and retention
    • Disaster recovery procedures
    • Internal employee access controls
    • Database access auditing
    • External AI provider data retention and model-training policies
    • External nutrition provider data retention policies
    • Compliance certifications such as SOC 2, ISO 27001, HIPAA, or GDPR compliance

    LifeQuant therefore does not make these claims based solely on the application's source code.

    Security Is an Ongoing Process

    Security is not a feature that gets checked off a list and then forgotten in a drawer with old college assignments.

    LifeQuant's security controls are part of the application's ongoing development and are reviewed as the architecture evolves.

    The controls described on this page reflect the implementation present in the LifeQuant codebase at the time this documentation was prepared.

    For infrastructure-level and third-party security practices, the relevant provider's documentation and configuration remain the authoritative source.