### Run MemberJunction Installer Script Source: https://docs.memberjunction.org/docs/installation-guide Executes the MemberJunction installer script from the root of the unzipped download file. This script guides the setup process, with an option to use a pre-configured 'install.config.json' file for automated installations. ```shell mj install ``` -------------------------------- ### Run MemberJunction Setup and Start Source: https://docs.memberjunction.org/docs/developer-overview Bash commands to execute the setup script and then start the MemberJunction sample application. Configuration of the database connection is required before running. ```Bash npm run setup npm start ``` -------------------------------- ### Configure Environment and Run Installation Source: https://docs.memberjunction.org/MJ Guides through the process of setting up MemberJunction. This involves copying a configuration example, updating database and authentication settings, and then executing the installation script which sets up the database schema and initial metadata. ```bash # Copy example configuration # cp install.config.json.example install.config.json # Update install.config.json with your settings # Set environment variables for API keys if needed # Run the installation script node InstallMJ.js ``` -------------------------------- ### Install MemberJunction CLI Source: https://docs.memberjunction.org/docs/installation-guide Installs the MemberJunction CLI tool globally using npm. This command ensures the CLI is available system-wide for managing MemberJunction installations and operations. ```shell npm install --global @memberjunction/cli ``` -------------------------------- ### Install Core MemberJunction Packages Source: https://docs.memberjunction.org/docs/libraries Installs the essential MemberJunction packages required for starting a new project. This includes the core functionalities, GraphQL integration, and UI components. ```bash npm install @memberjunction/core @memberjunction/graphql @memberjunction/ui ``` -------------------------------- ### MemberJunction Installation Command Source: https://docs.memberjunction.org/discuss This snippet represents the command used for installing or setting up a MemberJunction instance. It is typically run after initial project setup and may involve generating code or database entities. ```bash mj install ``` -------------------------------- ### Run MemberJunction Database Migration Source: https://docs.memberjunction.org/docs/installation-guide Executes database migrations for MemberJunction using the CLI. It can target specific branches like 'main' and supports running migrations from local directories or GitHub repositories for v2.0.0+. ```shell mj migrate -t main ``` -------------------------------- ### mj-sync Push CI Command Example Source: https://docs.memberjunction.org/docs/memberjunction-metadata-sync Provides an example of the push command used in a CI/CD pipeline, typically with flags like `--ci` to indicate an automated environment. Requires prior installation of the CLI. ```bash - name: Push Metadata to Production run: | npm install -g @memberjunction/metadata-sync mj-sync push --ci --entity="AI Prompts" ``` -------------------------------- ### Check MemberJunction CLI Version Source: https://docs.memberjunction.org/docs/installation-guide Verifies the installed version of the MemberJunction CLI tool. This is a useful command to confirm a successful installation or to check compatibility. ```shell mj version ``` -------------------------------- ### Initialize MemberJunction Explorer Application Source: https://docs.memberjunction.org/docs/mj-explorer Example of initializing the MemberJunction Explorer application with API endpoints, authentication provider, theme settings, and feature flags. It demonstrates the asynchronous setup process. ```TypeScript import { ExplorerApplication } from '@memberjunction/explorer'; import { MsalAuthProvider } from '@memberjunction/msal-auth'; // Create an authentication provider const authProvider = new MsalAuthProvider({ clientId: 'your-client-id', tenantId: 'your-tenant-id', redirectUri: 'http://localhost:3000/auth/callback' }); // Configure the Explorer ExplorerApplication.initialize({ apiUrl: 'http://localhost:3001/api', graphqlUrl: 'http://localhost:4000/graphql', authProvider: authProvider, theme: { primaryColor: '#3f51b5', secondaryColor: '#f50057', darkMode: false }, features: { skipEnabled: true, dashboardsEnabled: true, reportsEnabled: true, adminEnabled: true } }) .then(() => { // Start the application ExplorerApplication.start(); }) .catch(error => { console.error('Failed to initialize Explorer:', error); }); ``` -------------------------------- ### CI/CD Integration Example (GitHub Actions) Source: https://docs.memberjunction.org/docs/codegen-1 A GitHub Actions workflow example for integrating CodeGen into a CI/CD pipeline. It checks out code, sets up Node.js, installs dependencies, runs the CodeGen command, and commits generated code. ```yaml # GitHub Actions workflow example name: CodeGen on: push: branches: [ main ] paths: - 'database/**' - 'schema/**' jobs: generate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '16' - name: Install dependencies run: npm ci - name: Run CodeGen run: npx mj-codegen --config ./codegen-config.json - name: Commit generated code uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: "chore: update generated code" file_pattern: src/generated/** ``` -------------------------------- ### Create SQL Database Users and Assign Permissions Source: https://docs.memberjunction.org/docs/installation-guide Creates database users mapped to the previously created SQL logins and assigns appropriate roles (`db_owner` for CodeGen, `db_datareader`/`db_datawriter` for Connect) within the target MemberJunction database. ```sql USE [YourMemberJunctionDB]; GO -- Create database users for the logins CREATE USER [MJ_CodeGen] FOR LOGIN [MJ_CodeGen]; CREATE USER [MJ_Connect] FOR LOGIN [MJ_Connect]; -- Assign permissions EXEC sp_addrolemember 'db_owner', 'MJ_CodeGen'; EXEC sp_addrolemember 'db_datareader', 'MJ_Connect'; EXEC sp_addrolemember 'db_datawriter', 'MJ_Connect'; ``` -------------------------------- ### MemberJunction Configuration Settings Source: https://docs.memberjunction.org/docs/installation-guide Illustrates common configuration parameters for MemberJunction, including database connection details, credentials, and Microsoft Entra authentication settings. These can be set in `mj.config.js` or as environment variables. ```yaml # Your database name dbDatabase: MJ_DATABASE # The server on which your database resides dbHost: localhost # A login for that database server with admin authorization codeGenLogin: privileged_login # The password for the privileged login codeGenPassword: 'VeryStr0ngP@ssw0rd' # Y for local connections using a self-signed certificate dbTrustServerCertificate: Y # Your database name DB_DATABASE=MJ_DATABASE # The server on which your database resides DB_HOST=localhost # A login for that database server with admin authorization CODEGEN_DB_USERNAME=privileged_login # The password for the privileged login CODEGEN_DB_PASSWORD='VeryStr0ngP@ssw0rd' # Y for local connections using a self-signed certificate DB_TRUST_SERVER_CERTIFICATE=Y # A login for that database server with basic authorization DB_USERNAME=api_login # The password for the basic login DB_PASSWORD='VeryStr0ngP@ssw0rd' # The password for the basic login # Details for Microsoft Entra (MSLA) authentication TENANT_ID=d7d0c6b8-77fe-4710-be21-c5cd8ddb52ce WEB_CLIENT_ID=f58fbea0-c82d-4efb-911c-ee240614cd17 ``` -------------------------------- ### Auth0 and Introspection Configuration Source: https://docs.memberjunction.org/docs/installation-guide Sets up environment variables for Auth0 authentication, including domain, client ID, and client secret. Also enables GraphQL introspection queries for development and testing. ```env AUTH0_DOMAIN=dev-9ydqm0sWvrRk8csZ.us.auth0.com AUTH0_CLIENT_ID=mSEjf2qX9KGMwHcVuEzwaCIwqHFcruS2 AUTH0_CLIENT_SECRET=BHb1KOO_mUdaa-bOsezfc0Xl1_skJUvpVJn-nj8rsncw4bC2qX9OhTJskJUvpVJn ENABLE_INTROSPECTION=true ``` -------------------------------- ### Create SQL Server Logins for MemberJunction Source: https://docs.memberjunction.org/docs/installation-guide Creates necessary SQL Server logins for CodeGen and Connect roles, specifying strong passwords. These logins are essential for database schema management and application data access. ```sql USE master; GO -- Create the CodeGen login (used for schema management and code generation) CREATE LOGIN [MJ_CodeGen] WITH PASSWORD = 'YourStrongPassword1!'; -- Create the Connect login (used for application data access) CREATE LOGIN [MJ_Connect] WITH PASSWORD = 'YourStrongPassword2!'; ``` -------------------------------- ### Core Package Configuration Example Source: https://docs.memberjunction.org/docs/key-components Provides an example JSON structure for configuring the MemberJunction core package. This includes settings for database connections, authentication providers, and logging levels, which can be managed via environment variables or configuration files. ```JSON { "database": { "provider": "mssql", "connectionString": "Server=localhost;Database=MemberJunction;User Id=sa;Password=yourpassword;" }, "authentication": { "provider": "msal", "options": { "clientId": "your-client-id", "tenantId": "your-tenant-id" } }, "logging": { "level": "info", "outputs": ["console", "file"] } } ``` -------------------------------- ### CodeGen Command-Line Usage Examples Source: https://docs.memberjunction.org/docs/codegen-1 Examples of using the CodeGen command-line interface with different options. This includes enabling verbose logging and redirecting logs to a file. ```bash # Enable verbose logging npx mj-codegen --verbose --config ./codegen-config.json # Output logs to file npx mj-codegen --log ./codegen.log --config ./codegen-config.json ``` -------------------------------- ### Install Node.js Dependencies Source: https://docs.memberjunction.org/docs/developer-overview Bash command to install all necessary Node.js dependencies for the MemberJunction project using npm. This should be run after cloning the repository. ```Bash npm install ``` -------------------------------- ### Install Project Dependencies Source: https://docs.memberjunction.org/MJ Installs all necessary Node.js packages for the MemberJunction project using npm. Ensure you have Node.js and npm installed before running this command. ```bash npm install ``` -------------------------------- ### MemberJunction Integration and Deployment Source: https://docs.memberjunction.org/docs/datasets Information on integrating data into MemberJunction and deploying the system. Covers authentication, cloud setup (Azure), and automated user creation. ```APIDOC Integration and Deployment: - Integrate Data: Methods for integrating external data. - Deployment: - Authentication: Authentication mechanisms. - Cloud Setup (Azure): Specifics for Azure cloud deployment. - Create a new user in MemberJunction automatically: Process for automated user creation. ``` -------------------------------- ### Start MemberJunction Services Source: https://docs.memberjunction.org/MJ Starts the MemberJunction API server and the Explorer UI. These commands are typically run in separate terminal windows to have both the backend and frontend running concurrently. ```bash # Start the API server npm run start:api # In another terminal, start the Explorer UI npm run start:explorer ``` -------------------------------- ### Example Metadata File Structure Source: https://docs.memberjunction.org/docs/memberjunction-metadata-sync Provides a visual representation of the hierarchical directory structure used by the MemberJunction metadata sync tool, including configuration files and data files. ```markdown metadata/ ├── .mj-sync.json # Global sync configuration ├── ai-prompts/ │ ├── .mj-sync.json # Defines entity: "AI Prompts" │ ├── customer-service/ │ │ ├── .mj-folder.json # Folder metadata (CategoryID, etc.) │ │ ├── greeting.json # AI Prompt record with embedded models │ │ ├── greeting.prompt.md # Prompt content (referenced) │ │ └── greeting.notes.md # Notes field (referenced) │ └── analytics/ │ ├── .mj-folder.json # Folder metadata (CategoryID, etc.) │ ├── daily-report.json # AI Prompt record │ └── daily-report.prompt.md # Prompt content (referenced) ├── templates/ # Reusable JSON templates │ ├── standard-prompt-settings.json # Common prompt configurations │ ├── standard-ai-models.json # Standard model configurations │ ├── high-performance-models.json # High-power model configurations │ └── customer-service-defaults.json # CS-specific defaults └── template-entities/ ├── .mj-sync.json # Defines entity: "Templates" ├── email/ │ ├── .mj-folder.json # Folder metadata │ ├── welcome.json # Template record │ └── welcome.template.html # Template content (referenced) └── reports/ ├── .mj-folder.json # Folder metadata ├── invoice.json # Template record └── invoice.template.html # Template content (referenced) ``` -------------------------------- ### Implementing and Registering Business Rules Source: https://docs.memberjunction.org/docs/mjcore Provides an example of creating a `BusinessRule` to enforce validation logic before an entity is saved. The rule is then registered with the `BusinessRuleRegistry` for system-wide application. ```TypeScript import { BusinessRule, EntityEvent } from '@memberjunction/core'; // Create a business rule that validates the organization name const nameValidationRule = new BusinessRule({ entity: 'Organization', event: EntityEvent.BeforeSave, description: 'Ensure organization name meets requirements', execute: async (entity) => { if (!entity.name || entity.name.length < 3) { return { isValid: false, errors: ['Organization name must be at least 3 characters'] }; } return { isValid: true }; } }); // Register the business rule BusinessRuleRegistry.register(nameValidationRule); ``` -------------------------------- ### CodeGen Plugin Configuration Source: https://docs.memberjunction.org/docs/codegen-1 Example JSON configuration for registering a CodeGen plugin. This specifies the path to the plugin file and any associated options, such as the output directory for generated files. ```json { "plugins": [ { "path": "./plugins/documentation-plugin.ts", "options": { "outputPath": "./docs/generated" } } ] } ``` -------------------------------- ### GraphQL API Request Flow Example Source: https://docs.memberjunction.org/docs/memberjunction-architecture Illustrates the sequence of interactions for a typical GraphQL API request within the MemberJunction architecture, from client to database and back. ```sequence sequenceDiagram participant Client participant GraphQL API participant EntityService participant Repository participant Database Client->>GraphQL API: Query for member data GraphQL API->>EntityService: Get member(s) EntityService->>Repository: Find members Repository->>Database: Execute query Database-->>Repository: Return results Repository-->>EntityService: Map to entities EntityService-->>GraphQL API: Return entities GraphQL API-->>Client: Return formatted response ``` -------------------------------- ### Explorer Configuration JSON Source: https://docs.memberjunction.org/docs/mj-explorer Provides an example of the configuration structure for the MemberJunction Explorer, typically used in environment variables or a configuration file. It includes API endpoints and feature flags. ```JSON { "explorer": { "apiUrl": "http://localhost:3001/api", "graphqlUrl": "http://localhost:4000/graphql", "features": { "skipEnabled": true, "dashboardsEnabled": true, "reportsEnabled": true, "adminEnabled": true }, "theme": { "primaryColor": "#3f51b5", "secondaryColor": "#f50057", "darkMode": false } } } ``` -------------------------------- ### Run CodeGen for Sample App Source: https://docs.memberjunction.org/docs/building-and-running-the-sample-app Navigate to the CodeGen directory and execute the command to generate necessary code artifacts for the sample application's specific entities. ```bash npm run start ``` -------------------------------- ### Apply Database Scripts Source: https://docs.memberjunction.org/docs/building-and-running-the-sample-app Execute SQL scripts on the target database to create the necessary schemas, tables, views, and other database objects, followed by populating the sample app metadata. ```sql -- MJ_BASE_Structure.YYYY_MM_DD.sql -- This file contains the DDL statements necessary to create the schemas, tables, views, and other database objects necessary. ``` ```sql -- MJ_BASE_Dataset.YYYY_MM_DD.sql -- This file contains the data itself for the sample app metadata. Run this file after the Structure file has successfully run on your database. ``` -------------------------------- ### Azure SQL Server Creation Steps Source: https://docs.memberjunction.org/docs/cloud-setup Procedural steps for creating an Azure SQL Server instance via the Azure portal. This involves configuring server name, admin credentials, subscription, resource group, and location. The server hostname is a key output for subsequent configurations. ```APIDOC Azure SQL Server Creation: Purpose: To host the Member Junction database. Steps: 1. Navigate to SQL Servers in the Azure portal. 2. Click 'Add' to create a new server. 3. Configure: - Server name: Unique name for the SQL Server. - Admin login: Username for server administration. - Password: Password for the admin login. - Subscription: Azure subscription to use. - Resource group: Resource group to place the server in. - Location: Azure region for the server. 4. Click 'Review + create' and then 'Create'. Output: Server hostname (e.g., yourservername.database.windows.net) required for MJ configuration. ``` -------------------------------- ### RLS Filter Example 1: Simple Field Restriction Source: https://docs.memberjunction.org/docs/establish-row-level-security-rls This RLS filter clause restricts access based on specific values in the LastName field, allowing users to see records where the last name starts with 'A', 'B', or 'C'. ```sql LastName LIKE 'A%' OR LastName LIKE 'B%' OR LastName LIKE 'C%' ``` -------------------------------- ### Azure Static Web App Creation for MJExplorer Source: https://docs.memberjunction.org/docs/cloud-setup Steps to create an Azure Static Web App for hosting the MJExplorer frontend. Configuration involves app name, region, and deployment source (e.g., GitHub). This enables serving the user interface for Member Junction. ```APIDOC Azure Static Web App Creation for MJExplorer: Purpose: Host the Member Junction Explorer (MJExplorer) frontend. Steps: 1. Navigate to 'Static Web Apps' in the Azure portal and click 'Create'. 2. Configure: - App name: Unique name for the MJExplorer static web app. - Region: Azure region. - Deployment source: Connect to repository (GitHub, Azure DevOps). - Subscription: Azure subscription. - Resource group: Resource group. 3. Configure build settings (e.g., build presets, app location, API location, output location). 4. Click 'Review + create' and then 'Create'. Output: Static web app URL for accessing MJExplorer. ``` -------------------------------- ### Azure Web App Creation for MJAPI Source: https://docs.memberjunction.org/docs/cloud-setup Steps to create an Azure App Service to host the MJAPI, which provides a GraphQL API. Configuration includes app name, publish method (Code/Docker), runtime stack, region, and service plan. The web app domain name is needed for MJExplorer configuration. ```APIDOC Azure Web App Creation for MJAPI: Purpose: Host the Member Junction API (MJAPI). Steps: 1. Navigate to 'App Services' in the Azure portal and click 'Create'. 2. Configure: - App name: Unique name for the MJAPI web app. - Publish: Choose 'Code' or 'Docker'. - Runtime stack: Select appropriate language/version (e.g., .NET, Node.js). - Region: Azure region. - Subscription: Azure subscription. - Resource group: Resource group. - App Service Plan: Select or create a plan defining compute resources. 3. Click 'Review + create' and then 'Create'. Deployment: Use CI/CD pipelines (Azure DevOps, GitHub Actions) to deploy MJAPI code. Output: Web app domain name (e.g., mjapi.azurewebsites.net) for MJExplorer configuration. ``` -------------------------------- ### JavaScript Example Usage Source: https://docs.memberjunction.org/docs/duplicate-record-checker Demonstrates how to instantiate the `DuplicateRecordDetector` class and call the `getDuplicateRecords` function with example parameters. ```javascript const { DuplicateRecordDetector } = require('ai-vector-dupe'); // Create an instance of the DuplicateRecordDetector const detector = new DuplicateRecordDetector(); // Call getDuplicateRecords detector.getDuplicateRecords({ listID: 'example-list-id', entityID: 'example-entity-id', probabilityScore: 0.9 }); ``` -------------------------------- ### MJ Install Integrity Check Failure Source: https://docs.memberjunction.org/discuss/67fd5920a331f200457d9d41 This snippet captures the specific error messages encountered during the 'mj install' process. It highlights issues with entity field sequence checks, including mismatches in view column order and duplicate sequences within entities. ```text Generating Actions Code... Integrity check results: Integrity check FAILED: entityFieldsSequenceCheck - Entity AI Models has a mismatch between the metadata sequence and the physical column order in the base view [__mj].[vwAIModels] for position 13. Expected AIModelType but found SpeedRank Entity Company Integration Runs has duplicate Entity Field sequences: *ConfigData (12)* RunByUser (12) ``` -------------------------------- ### Azure SQL Database Creation Steps Source: https://docs.memberjunction.org/docs/cloud-setup Procedural steps for creating an Azure SQL Database instance within an existing Azure SQL Server. This includes specifying the database name and selecting appropriate compute and storage tiers. The database name is crucial for MJ configuration. ```APIDOC Azure SQL Database Creation: Purpose: To store Member Junction data and metadata. Prerequisite: An Azure SQL Server must exist. Steps: 1. Navigate to the created SQL Server in the Azure portal. 2. Click 'Add database' on the server overview. 3. Configure: - Database name: Name for the MJ database. - Compute and storage: Select performance tier (e.g., Basic, Standard, Premium) and storage size. 4. Click 'Review + create' and then 'Create'. Output: Database name required for MJ configuration. ``` -------------------------------- ### Backend Server Restart Command Source: https://docs.memberjunction.org/docs/contributing-to-the-sample-app When working on the server code located in the MJAPI folder, you will need to restart the server and run this command after saving your changes to see the updates reflected. ```shell npm run start ``` -------------------------------- ### Generated Interface Definition Example (TypeScript) Source: https://docs.memberjunction.org/docs/codegen-1 An example of a TypeScript interface generated by MemberJunction CodeGen. This interface represents the structure of an entity, providing a contract for data objects. ```TypeScript // Generated by MemberJunction CodeGen // Do not modify this file directly export interface IMember { MemberID: number; FirstName: string; LastName: string; Email: string; MembershipTypeID: number; } ``` -------------------------------- ### MJ_Metadata Dataset Example Source: https://docs.memberjunction.org/docs/datasets An example illustrating the MJ_Metadata Dataset, which contains core metadata for MemberJunction. It shows multiple Dataset Items, each referencing a specific entity and configured for retrieval. ```APIDOC Dataset: { Name: "MJ_Metadata", Description: "Core Metadata for MemberJunction", Dataset Items: [ { Code: "ApplicationEntities", Entity: "Application Entities", WhereClause: NULL, DateFieldToCheck: "UpdatedAt" }, { Code: "Applications", Entity: "Applications", WhereClause: NULL, DateFieldToCheck: "UpdatedAt" }, { Code: "Authorizations", Entity: "Authorizations", WhereClause: NULL, DateFieldToCheck: "UpdatedAt" }, { Code: "Entities", Entity: "Entities", WhereClause: NULL, DateFieldToCheck: "UpdatedAt" }, { Code: "EntityFields", Entity: "Entity Fields", WhereClause: NULL, DateFieldToCheck: "UpdatedAt" } ] } ``` -------------------------------- ### Bump Dependencies and Install Source: https://docs.memberjunction.org/docs/updating-memberjunction-to-a-new-version Updates package.json files to the latest versions and installs them. This command is crucial for monorepos or when updating multiple packages. The `-r` flag updates recursively, and `-q` limits output for piping. ```shell mj bump ``` ```shell mj bump -r ``` ```shell mj bump -rq | xargs -n1 -I{} npm install --prefix {} ``` -------------------------------- ### Generated Entity Class Example (TypeScript) Source: https://docs.memberjunction.org/docs/codegen-1 An example of a TypeScript entity class generated by MemberJunction CodeGen. It demonstrates the use of `@Entity` and `@EntityProperty` decorators to define the class structure, properties with metadata, and navigation properties. ```TypeScript // Generated by MemberJunction CodeGen // Do not modify this file directly import { Entity, EntityBase, EntityProperty } from '@memberjunction/core'; import { MembershipType } from './membershiptype.entity'; @Entity('Member', 'dbo', 'Members') export class Member extends EntityBase { // Properties @EntityProperty({ isPrimaryKey: true, isAutoIncrement: true }) MemberID: number; @EntityProperty({ isRequired: true, maxLength: 100 }) FirstName: string; @EntityProperty({ isRequired: true, maxLength: 100 }) LastName: string; @EntityProperty({ isRequired: true, maxLength: 255 }) Email: string; @EntityProperty({ foreignKey: 'FK_Members_MembershipTypes' }) MembershipTypeID: number; // Navigation properties MembershipType?: MembershipType; // Constructor constructor() { super(); this.MemberID = 0; this.FirstName = ''; this.LastName = ''; this.Email = ''; this.MembershipTypeID = 0; } } ``` -------------------------------- ### Example Member Entity Class in TypeScript Source: https://docs.memberjunction.org/docs/entity-model An example of a custom entity class, `Member`, which inherits from `EntityBase`. It defines properties with metadata decorators, navigation properties to related entities, and custom methods like `getFullName` and lifecycle hooks such as `beforeSave` for custom validation. ```TypeScript @Entity('Member', 'dbo', 'Members') export class Member extends EntityBase { // Properties @EntityProperty({ isPrimaryKey: true, isAutoIncrement: true }) MemberID: number; @EntityProperty({ isRequired: true, maxLength: 100 }) FirstName: string; @EntityProperty({ isRequired: true, maxLength: 100 }) LastName: string; @EntityProperty({ isRequired: true, maxLength: 255 }) Email: string; @EntityProperty({ foreignKey: 'FK_Members_MembershipTypes' }) MembershipTypeID: number; // Navigation properties MembershipType?: MembershipType; // Custom methods getFullName(): string { return `${this.FirstName} ${this.LastName}`; } // Lifecycle hooks async beforeSave(): Promise { // Custom validation logic if (!this.Email.includes('@')) { this.addValidationError('Email', 'Invalid email format'); return false; } return super.beforeSave(); } } ``` -------------------------------- ### Essential Development Commands Source: https://docs.memberjunction.org/MJ Common npm and Turbo commands for building, running, and maintaining the MemberJunction project. Includes commands for building packages, starting services, and ensuring code quality. ```shell # Build everything npm run build # Build specific package turbo build --filter="@memberjunction/core" # Watch mode (auto-rebuild on changes) npm run watch # Start services npm run start:api # Start API server (port 4000) npm run start:explorer # Start Explorer UI (port 4200) # Code quality npm run lint # Run ESLint npm run format # Format with Prettier npm test # Run tests ``` -------------------------------- ### Build Explorer Application (Bash) Source: https://docs.memberjunction.org/docs/mj-explorer Builds the MemberJunction Explorer application using npm. This command compiles the application's assets for deployment. ```bash npm run build ``` -------------------------------- ### Install/Update MemberJunction CLI Source: https://docs.memberjunction.org/docs/updating-memberjunction-to-a-new-version Ensures you have the latest version of the MemberJunction command-line interface installed globally. This is the first step before performing other update operations. ```shell npm install --global @memberjunction/cli ``` ```shell npm update --global @memberjunction/cli ```