Skip to main content

Prerequisites

  • NPM installed on your system.
  • Node.js v14 or higher installed on your system.
  • https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/expressjs.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=4f88384a0c8d241344aba03845e71ec4https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/expressjs-dark.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=cb7e625b4702c18ca829fbcd99e5fbf1 Express.js (express) on Node.js.
  • express-session for session management.
  • A valid session store (e.g., express-mysql-session for https://mintcdn.com/dangowebsolutions/D9EO2DwLBeZJ4JPL/icons/directadmin/databases.svg?fit=max&auto=format&n=D9EO2DwLBeZJ4JPL&q=85&s=d635dfc9c7d680fa67388f10aa803708 MySQL).
Install Prerequisites
npm install express express-session express-mysql-session

Install

Any co-dependencies will be installed automatically.
Install CommTrackr
npm install commtrackr

Quick Start

This example demonstrates how to set up https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/commtrackr.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=507bfef28b9b040d0cb6e3c1a5a013e8https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/commtrackr-dark.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=7ccff59f6dc9d18bc140616edd9ec6be CommTrackr in an https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/expressjs.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=4f88384a0c8d241344aba03845e71ec4https://mintcdn.com/dangowebsolutions/aopwfvJagnjWqHdm/icons/commtrackr/expressjs-dark.svg?fit=max&auto=format&n=aopwfvJagnjWqHdm&q=85&s=cb7e625b4702c18ca829fbcd99e5fbf1 Express.js application using a https://mintcdn.com/dangowebsolutions/D9EO2DwLBeZJ4JPL/icons/directadmin/databases.svg?fit=max&auto=format&n=D9EO2DwLBeZJ4JPL&q=85&s=d635dfc9c7d680fa67388f10aa803708 MySQL session store.
server.js
const  = ('express');
const  = ("express-session");
const  = ('express-mysql-session')(); // Use a MySQL session store
const  = new ({
  : '',
  : 3306,
  : '',
  : '',
  : ''
});
.use(({
  : '',
  : '',
  : '',
  : ,
  : false,
  : false
}));

const  = ();

const  = ('commtrackr'); // Import the commtrackr package
.use('/commtrackr', .routes); // Mount routes to /commtrackr path
.init({ // Initialize CommTracker with configurations
  : {
    : 'commtrackr', // Unique identifier for the tenant
    : 'CommTrackr', // Name of the tenant
    : 'CommTrackr', // Name of the tenant for meta title tags
    : 'Easily plan, manage, and track client commissions.', // Description of the tenant
    : 'http://localhost:3000/commtrackr/logo.png', // Tenant logo image
    : '#ffffff', // Tenant theme color (optional)
    : false, // Force dark mode for the tenant (optional)
    : 'http://localhost:3000/commtrackr/banner_public.png', // Tenant banner image
    : 'http://localhost:3000', // Domain for the tenant, including protocol
    : '/commtrackr', // Path that CommTracker is mounted on
    : {
      : false, // Enable or disable authentication
      : '', // Recognizable name of authentication provider
      : '', // URL to redirect to for authentication
    },
    : [], // Additional stylesheets to include
    : [], // Additional scripts to include
    : {} // Custom text overrides for the tenant; see "Custom Text" section below
  },
  : {
    : 'username', // req.session object variable for unique user identification
    : 'Name', // req.session object variable for user name
    : 'role', // req.session object variable for user role
    : { // Use if your role names differ from 'admin', 'dev', or 'user'
      : ['user', 'standard', 'basic'], // Aliases for user roles
      : ['dev', 'developer'], // Aliases for developer roles
      : ['admin', 'administrator', 'superuser'] // Aliases for admin roles
    },
    : { // Alternative access control using numeric levels
      : 'access', // req.session object variable for access level
      : [0], // Access levels for standard users
      : [1], // Access levels for developers
      : [2] // Access levels for admins
    },
    : 'commissions', // req.session object variable for user commissions array
    : [ // Possible commission status strings
      {
        : 'Completed', // Status label
        : 'Completed' // Status value
      }, {
        : 'In Progress',
        : 'In Progress'
      }, {
        : 'On Hold',
        : 'On Hold'
      }, {
        : 'Cancelled',
        : 'Cancelled'
      }
    ],
    : ['amount', 'currency'], // Array of field IDs that admins cannot edit
    : 'users' // req.session object variable for all users array
  },
  : [
    {
      : 'name', // Unique identifier for the field. ID 'user' is reserved by the system and may not be used here
      : 'text', // Field type ('text', 'number', 'date', 'textarea', 'checkbox', 'radio', 'select', 'multiselect')
      : 'Website Name', // Field label
      : 'The name of the website or project.', // Field description
      : 'e.g. My Website', // Placeholder text for the field
      : true, // Whether the field is required
      : [ // Options for select, radio, and multiselect fields
        {
          : 'Option 1', // Option label
          : 'option1' // Option value
        }
      ],
    },
  ],
  : {
    : (, ) => {
      // Custom handler function for processing commission data
      // This function is called when a commission is created
      // You can implement your own logic here, such as saving to a database
      // data contains the commission fields data array
      // Action metadata can be accessed via data.createdAt and data.createdBy
    },
    : (, ) => {
      // Custom handler function for updating commission data
      // This function is called when a commission is updated
      // You can implement your own logic here, such as saving to a database
      // data contains the updated commission object
      // The constant data.id contains the unique commission ID
      // Action metadata can be accessed via data.updatedAt, data.updatedBy, and data.sendEmail
      // Updated metadata can be accessed via data.user, data.amount, data.currency, data.date, data.status, data.locked, and data.assignedTo
      // Updated fields can be accessed via data.fields
      // Updated tasks can be accessed via data.tasks
    },
    : () => {
      // Custom handler function for syncing user's commissions
      // This function is called when the user manually triggers a sync
      // You can implement your own logic here, such as syncing your commissions session variable
    },
  },
});

.listen(3000, () => {
  .('Server is running on http://localhost:3000');
});
More detail on how to configure each option can be found in Set Up.