Mommy
Mommy (hereinafter the “Application”) is a web-based application that provides users with supportive and loving messages, optionally personalised 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
Section titled “1. User Documentation”How to Use Mommy
Section titled “How to Use Mommy”The Mommy application provides a simple web interface for receiving encouraging messages:
- Visit the Application: Navigate to the Mommy web application in your browser
- Optional Name Entry: Enter your name in the text field if you’d like personalised messages
- Request Love: Click the “I need some love…” button to receive an encouraging message
- Receive Your Message: A supportive phrase will appear, personalised with your name if provided
Features
Section titled “Features”- Personalised Messages: Over 100 unique encouraging phrases that can be personalised 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
Section titled “API Endpoint”The application also provides a simple API:
- Endpoint:
/api - Method: GET
- Optional Parameter:
name(string) - Your name for personalisation - Response: Plain text encouraging message
Example: GET /api?name=Alex returns a personalised encouraging message.
2. Technical Documentation
Section titled “2. Technical Documentation”Architecture Overview
Section titled “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
Section titled “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 templatesServer Implementation
Section titled “Server Implementation”The application uses Fastify to serve:
- Landing Page (
/): Returns the complete HTML interface - API Endpoint (
/api): Returns personalised encouraging messages
Message Generation
Section titled “Message Generation”Messages are generated by:
- Randomly selecting a phrase template from
phrases.ts - Randomly selecting a “mommy” persona from
mommy.ts - Interpolating
{{ name }}and{{ mommy }}variables in the template - Converting to lowercase and returning as plain text
Installation and Setup
Section titled “Installation and Setup”Prerequisites
Section titled “Prerequisites”- Node.js (18+ recommended)
- pnpm package manager
Development Setup
Section titled “Development Setup”# Install dependenciespnpm install
# Run in development mode with auto-reloadpnpm dev
# Build for productionpnpm build
# Run production serverpnpm start
# Run testspnpm test
# Lint codepnpm lintProduction Deployment
Section titled “Production Deployment”The server listens on port 8008 by default. For production deployment:
- Build the project:
pnpm build - Start the server:
pnpm start - Configure reverse proxy (nginx/Apache) if needed
Configuration
Section titled “Configuration”Adding New Phrases
Section titled “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
Section titled “Adding New Mommy Personas”Edit src/config/mommy.ts to add new ways mommy refers to herself.
Testing
Section titled “Testing”The project includes comprehensive tests using Vitest:
- Server endpoint testing
- Configuration validation
- Phrase uniqueness verification
- HTML response validation
3. Legal Documentation
Section titled “3. Legal Documentation”License
Section titled “License”This software is licensed under Naomi’s Public Licence. Copyright held by Naomi Carrigan.
Privacy
Section titled “Privacy”The application:
- Does not store user data persistently
- Does not use cookies or tracking
- Processes names only for message personalisation
- Does not log personal information
Content Policy
Section titled “Content Policy”All phrases are designed to be:
- Supportive and encouraging
- Appropriate for all ages
- Non-discriminatory
- Focused on positive reinforcement
4. Contributing Documentation
Section titled “4. Contributing Documentation”Development Workflow
Section titled “Development Workflow”- Fork and Clone: Fork the repository and clone your fork
- Install Dependencies: Run
pnpm install - Create Feature Branch:
git checkout -b feature/your-feature - Make Changes: Implement your changes with tests
- Test: Run
pnpm testandpnpm lint - Commit: Use conventional commit messages
- Pull Request: Submit PR with clear description
Code Standards
Section titled “Code Standards”- TypeScript: Strict typing enabled
- ESLint: Uses @nhcarrigan/eslint-config
- Testing: Vitest with coverage requirements
- Documentation: JSDoc comments for all functions
Adding Content
Section titled “Adding Content”New Encouraging Phrases
Section titled “New Encouraging Phrases”To add new phrases to src/config/phrases.ts:
- Follow the existing template format
- Use
{{ name }}and{{ mommy }}placeholders - Keep messages positive and supportive
- Ensure phrases are appropriate for all audiences
- Add tests to verify uniqueness
New Mommy Personas
Section titled “New Mommy Personas”To add new personas to src/config/mommy.ts:
- Add family-friendly terms
- Ensure they work grammatically in all phrase templates
- Test with existing phrases
Testing Guidelines
Section titled “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
Section titled “Submission Guidelines”- Follow existing code style
- Include tests for new functionality
- Update documentation as needed
- Ensure all checks pass before submitting