Skip to content

Mommy

Mommy (hereinafter the β€œApplication”) is a web-based application that provides users with supportive and loving messages, optionally personalized with their name. The Application uses a Fastify-based backend server that serves both a landing page and an API endpoint, delivering encouraging phrases with configurable β€œmommy” personas. It is designed for ease of use, accessibility, and providing emotional support through positive reinforcement.

1. User Documentation

How to Use Mommy

The Mommy application provides a simple web interface for receiving encouraging messages:

  1. Visit the Application: Navigate to the Mommy web application in your browser
  2. Optional Name Entry: Enter your name in the text field if you’d like personalized messages
  3. Request Love: Click the β€œI need some love…” button to receive an encouraging message
  4. Receive Your Message: A supportive phrase will appear, personalized with your name if provided

Features

  • Personalized Messages: Over 100 unique encouraging phrases that can be personalized with your name
  • Accessibility-Focused Design: Uses OpenDyslexic font and high-contrast styling for better readability
  • Mobile-Friendly: Responsive design that works on all device sizes
  • No Registration Required: Instant access without any account creation

API Endpoint

The application also provides a simple API:

  • Endpoint: /api
  • Method: GET
  • Optional Parameter: name (string) - Your name for personalization
  • Response: Plain text encouraging message

Example: GET /api?name=Alex returns a personalized encouraging message.

2. Technical Documentation

Architecture Overview

Mommy is built using:

  • Backend: Fastify web framework (Node.js/TypeScript)
  • Frontend: Vanilla HTML/CSS/JavaScript (no frameworks)
  • Configuration: Modular phrase and persona configuration files

Project Structure

src/
β”œβ”€β”€ index.ts # Main server entry point
β”œβ”€β”€ config/
β”‚ β”œβ”€β”€ html.ts # HTML template for landing page
β”‚ β”œβ”€β”€ mommy.ts # Mommy persona names ("your mommy", "mama", etc.)
β”‚ └── phrases.ts # 100+ encouraging phrase templates

Server Implementation

The application uses Fastify to serve:

  1. Landing Page (/): Returns the complete HTML interface
  2. API Endpoint (/api): Returns personalized encouraging messages

Message Generation

Messages are generated by:

  1. Randomly selecting a phrase template from phrases.ts
  2. Randomly selecting a β€œmommy” persona from mommy.ts
  3. Interpolating {{ name }} and {{ mommy }} variables in the template
  4. Converting to lowercase and returning as plain text

Installation and Setup

Prerequisites

  • Node.js (18+ recommended)
  • pnpm package manager

Development Setup

Terminal window
# Install dependencies
pnpm install
# Run in development mode with auto-reload
pnpm dev
# Build for production
pnpm build
# Run production server
pnpm start
# Run tests
pnpm test
# Lint code
pnpm lint

Production Deployment

The server listens on port 8008 by default. For production deployment:

  1. Build the project: pnpm build
  2. Start the server: pnpm start
  3. Configure reverse proxy (nginx/Apache) if needed

Configuration

Adding New Phrases

Edit src/config/phrases.ts to add new encouraging messages. Use:

  • {{ name }} for user’s name interpolation
  • {{ mommy }} for mommy persona interpolation

Adding New Mommy Personas

Edit src/config/mommy.ts to add new ways mommy refers to herself.

Testing

The project includes comprehensive tests using Vitest:

  • Server endpoint testing
  • Configuration validation
  • Phrase uniqueness verification
  • HTML response validation

License

This software is licensed under Naomi’s Public License. Copyright held by Naomi Carrigan.

Privacy

The application:

  • Does not store user data persistently
  • Does not use cookies or tracking
  • Processes names only for message personalization
  • Does not log personal information

Content Policy

All phrases are designed to be:

  • Supportive and encouraging
  • Appropriate for all ages
  • Non-discriminatory
  • Focused on positive reinforcement

4. Contributing Documentation

Development Workflow

  1. Fork and Clone: Fork the repository and clone your fork
  2. Install Dependencies: Run pnpm install
  3. Create Feature Branch: git checkout -b feature/your-feature
  4. Make Changes: Implement your changes with tests
  5. Test: Run pnpm test and pnpm lint
  6. Commit: Use conventional commit messages
  7. Pull Request: Submit PR with clear description

Code Standards

  • TypeScript: Strict typing enabled
  • ESLint: Uses @nhcarrigan/eslint-config
  • Testing: Vitest with coverage requirements
  • Documentation: JSDoc comments for all functions

Adding Content

New Encouraging Phrases

To add new phrases to src/config/phrases.ts:

  1. Follow the existing template format
  2. Use {{ name }} and {{ mommy }} placeholders
  3. Keep messages positive and supportive
  4. Ensure phrases are appropriate for all audiences
  5. Add tests to verify uniqueness

New Mommy Personas

To add new personas to src/config/mommy.ts:

  1. Add family-friendly terms
  2. Ensure they work grammatically in all phrase templates
  3. Test with existing phrases

Testing Guidelines

  • All new features must include tests
  • Maintain 100% test coverage
  • Test both success and error cases
  • Verify phrase interpolation works correctly

Submission Guidelines

  • Follow existing code style
  • Include tests for new functionality
  • Update documentation as needed
  • Ensure all checks pass before submitting