-
Notifications
You must be signed in to change notification settings - Fork 15
Architecture
FreeITSM is a classic LAMP-style web application: PHP server-side with vanilla JS/HTML/CSS on the client. No frameworks, no build step. All 18 modules share a common chrome (waffle menu, header, user account dropdown) but each module is self-contained under its own folder.
| Component | Technology |
|---|---|
| Backend | PHP 7.4β8.4 |
| Database | MySQL 8.0+ via PDO MySQL |
| Frontend | Vanilla JavaScript, HTML5, CSS3 |
| Rich text editing | TinyMCE 6+ |
| Email integration | Microsoft Graph API + Gmail API (OAuth 2.0) |
| Encryption at rest | AES-256-GCM for sensitive values |
| AI features | Pluggable providers β Anthropic Claude / OpenAI / OpenRouter, per-feature keys (AI Providers) + OpenAI embeddings (Knowledge) |
| Web server | Apache (WAMP/XAMPP/LAMP) or any PHP server |
freeitsm/
βββ config.php # References external db_config.php
βββ index.php # Module selection grid (landing page)
βββ .htaccess # URL routing: /login canonical, legacy redirects, MultiViews off β see Root-Folder-Tidy
β
βββ auth/ # Auth pages (served via root .htaccess rewrites β see Root-Folder-Tidy)
β βββ login.php # Analyst login β canonical URL /login
β βββ analyst_logout.php # Logout handler (also aliased as /logout)
β βββ force_password_change.php # Forced password change (expired passwords)
β βββ forgot-password.php # Password reset request β /forgot-password
β βββ reset-password.php # Password reset (token from email) β /reset-password
β βββ oauth_callback.php # Microsoft OAuth 2.0 callback (URL unchanged: /oauth_callback.php)
β βββ google_oauth_callback.php # Google OAuth 2.0 callback (URL unchanged: /google_oauth_callback.php)
β
βββ api/ # ~140 REST endpoints, one folder per module
β βββ v1/ # Public REST API v1 (API-key auth) β see the REST API pages
β
βββ assets/
β βββ css/ # Shared stylesheets β inbox.css (core layout), theme.css (palette tokens), per-module css
β βββ js/ # Shared scripts β inbox.js, i18n.js, tz.js, toast.js, safe-html.js, qrcode.min.js (MFA QR codes), β¦ + TinyMCE library
β βββ images/ # CompanyLogo.png (replace with your own)
β
βββ includes/ # Shared PHP components
β βββ functions.php # connectToDatabase() + analyst module helpers
β βββ waffle-menu.php # Cross-module nav + user account menu
β βββ encryption.php # AES-256-GCM helpers
β βββ totp.php # Pure-PHP TOTP / HOTP (RFC 6238 / 4226)
β βββ i18n.php # Translation helper β see the Internationalisation page
β βββ timezone.php # Per-analyst display timezone β see Timezones & Time Handling
β βββ theme.php # Palette registry β see Theming & Dark Mode
β βββ rbac.php # Capability guards β see Roles & Permissions
β βββ tenancy.php # Company scoping β see Multi-Tenancy
β βββ gmail.php / mailbox_graph.php / mailbox_imap.php # Mailbox providers (Gmail API / MS Graph / basic IMAP-SMTP)
β βββ template_email.php # Automated email templates for ticket events
β βββ module-colors.php # Module colour definitions
β βββ services/ # Shared service layer β see Service Layer Architecture
β
βββ lang/ # Translations, one folder per locale
β
βββ tickets/ # Ticket Management module
β βββ index.php # Three-panel inbox interface
β βββ users.php # User directory & their tickets
β βββ calendar.php # Ticket scheduling calendar
β βββ rota.php # Staff rota weekly grid
β βββ csat/ # CSAT analytics (index.php) + the public survey page (survey.php β canonical URL /csat)
β βββ settings/ # Departments, types, origins, statuses, priorities, SLA, mailboxes, rota shifts
β βββ attachments/ # Email attachment storage (gitignored)
β
βββ asset-management/ # Asset Management module
β βββ dashboard/ # Per-analyst widget dashboard (Chart.js)
β βββ servers/ # vCenter VM inventory with detail modal
β βββ settings/ # vCenter connection settings
β
βββ knowledge/ # Knowledge Base β index.php (article list & editor), review/ (review workflow), settings/
βββ change-management/ # Changes β index.php, calendar.php (scheduled changes), approvals.php, settings/
βββ calendar/ # Calendar β index.php (full calendar view), settings/ (event categories)
βββ morning-checks/ # Morning Checks β daily check interface with PDF export
βββ reporting/ # Reporting β logs/ (logins, email imports), tickets/ (ticket dashboards)
βββ software/ # Software β inventory, dashboard/ (widgets + library.php), licences/, settings/ (API keys)
βββ forms/ # Forms β edit/ (form editor), fill.php (A4-style filler), submissions.php, settings/
βββ lms/ # LMS β index.php (dashboard), player.php (SCORM player), content/ (uploaded packages)
βββ process-mapper/ # Process Mapper β visual flowchart editor
βββ network-mapper/ # Network Mapper β index.php (diagrams landing), diagram.php (per-diagram editor)
βββ tasks/ Β· contracts/ Β· cmdb/ Β· problem-management/ Β· workflow/ # Further modules, same shape
βββ service-status/ Β· system-wiki/ Β· watchtower/ Β· self-service/ # (index.php + settings/ + includes/)
β
βββ system/ # System module (administrators only)
β βββ analysts/ # Analyst accounts (passwords, SSO, teams, per-company access, admin role)
β βββ teams/ # Team management (used across tickets, tasks, contracts, workflows)
β βββ modules/ # Analyst module access control
β βββ encryption/ # Encryption key management
β
βββ browser-extension/ # Chrome/Edge Watchtower extension (Manifest V3) β see Browser Extension
βββ cron/ # Scheduled jobs (SLA breach checks, webhook deliveries, scheduled workflows)
βββ scripts/ # CLI utilities + background workers (Intune sync workers, asset inventory agent)
βββ database/
β βββ freeitsm.sql # Schema bootstrap
βββ docs/ # Design docs (e.g. cmdb.md)
βββ setup/ # Setup verification / diagnostic page (delete after going live)
Each module folder typically contains:
-
index.phpβ landing page -
settings/index.phpβ module config -
help.phpβ in-app guided help page (scroll-spy sidebar, sectioned content) -
includes/header.phpβ module's header bar with its colour gradient and nav tabs
A Microsoft 365-style app launcher in the header of every module page. Each module is registered with a name, path, icon SVG, and colour gradient. Respects $_SESSION['allowed_modules'] to filter visible modules per analyst.
Also contains the user account menu β an initials avatar circle in the top-right of every page. Clicking opens a dropdown with:
- Change Password (validates current, min 8 chars)
- Multi-Factor Authentication (TOTP setup/disable with QR code)
- Logout (with confirmation)
To add a new module, add an entry to the $modules array and matching CSS.
Pure-PHP implementation of RFC 6238 (TOTP) and RFC 4226 (HOTP). No external dependencies β uses PHP's built-in hash_hmac() and random_bytes().
- Secret generation: 20 random bytes β Base32 (32-char string)
- Code generation: HMAC-SHA1, 30-second time step, dynamic truncation β 6-digit code
-
Verification: Β±1 time window (90-second tolerance),
hash_equals()for timing-safe compare -
URI format:
otpauth://totp/FreeITSM:{username}?secret={base32}&issuer=FreeITSM
Secrets are encrypted at rest with AES-256-GCM before being stored in analysts.totp_secret.
AES-256-GCM authenticated encryption for sensitive database values.
-
Key file:
C:\wamp64\encryption_keys\sdtickets.key(outside web root) -
Format:
ENC:+ base64(IV + auth tag + ciphertext) -
Migration-safe: Values without
ENC:prefix pass through unchanged
$encrypted = encryptValue($plaintext);
$plaintext = decryptValue($encrypted);
$mailbox = decryptMailboxRow($mailbox);Encrypted columns include:
-
system_settings:vcenter_*,knowledge_ai_api_key,knowledge_openai_api_key,intune_* -
target_mailboxes:azure_tenant_id,azure_client_id,azure_client_secret,oauth_redirect_uri,imap_server,target_mailbox, plusimap_username,imap_passwordandsmtp_serverfor basic IMAP/SMTP mailboxes analysts.totp_secret
The canonical lists live in the ENCRYPTED_SETTING_KEYS and ENCRYPTED_MAILBOX_COLUMNS constants in includes/encryption.php β a system_settings key or mailbox column is only encrypted/decrypted if it appears there.
A subset of "true secrets" listed in MASKED_SETTING_KEYS are also masked to ****<last4> in API responses, with a save-time convention that blank or asterisk-prefixed submissions mean "leave unchanged" so the user can save the form without re-typing.
Each module's includes/header.php:
- Checks session auth (redirects to login if missing)
- Sets
$current_modulefor waffle-menu highlighting - Renders the header bar with the module's colour gradient
- Includes the waffle button, module nav tabs, and user account avatar
Every module page follows the same skeleton β set $current_page and $path_prefix before the markup, pull in the shared stylesheet and the module header, and define an API_BASE constant for the page's JavaScript:
<?php
session_start();
require_once '../config.php';
$current_page = 'module_name';
$path_prefix = '../';
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../assets/css/inbox.css">
<!-- Module-specific styles in a <style> block -->
</head>
<body>
<?php include 'includes/header.php'; ?>
<div class="main-container module-container">
<!-- Module content -->
</div>
<script>
const API_BASE = '../api/module_name/';
// Module JavaScript
</script>
</body>
</html>- Create the module folder with
index.phpandincludes/header.php - Create an API folder under
api/ - Register it in
includes/waffle-menu.php(add to the$modulesarray + CSS colours) - Add a card to the
index.phplanding page (icon, colour, link) - Add any new tables to
database/freeitsm.sqland the Database Verification schema
Global notification system. Four types: success (green), error (red), warning (amber), info (blue). 9 configurable screen positions via visual grid picker in System Settings β General. Position persisted per-browser in localStorage. Slide-in animations, auto-dismiss after 4s, manual close button.
Native multi-language support with a t('namespace.path.to.key') call pattern in both PHP and JavaScript. The first dot-separated segment of the key maps to a file (lang/<locale>/<namespace>.php); everything after walks a nested PHP array inside that file.
return [
'toolbar' => [
'process' => 'Prozess',
'decision' => 'Entscheidung',
],
];Fallback is per key, not per file. If lang/de/tickets.php has 80% of keys translated, you get 80% in German and the missing 20% in English. Last-resort behaviour returns the key itself so unfilled strings are visible during development.
Locale resolution chain: logged-in analyst's interface_language user preference β browser Accept-Language header (with primary-subtag matching β pt resolves to pt-BR) β 'en' default. Selectable in System β Preferences; on change, persists to user_preferences and reloads the page.
JS bridge: each page declares the namespaces it needs ($translationNamespaces = ['common', 'process-mapper']) and PHP renders window.translations with English fallback already merged into the active locale per key. The JS t() helper does a flat dotted walk β no fallback logic on the client.
Supported locales (20 as of May 2026): en, af, fr, de, es, pt-BR, nl, it, pl, ru, id, hi, bn, ta, te, mr, kn, ml, gu, pa. BCP 47 codes match the HTML lang attribute. Spans Europe (en/fr/de/es/pt-BR/nl/it/pl/ru), South Africa (af β Afrikaans), South Asia (the nine Indian languages), and Indonesia (id β Bahasa Indonesia). Adding a new language is a 2-step code change: add to I18n::SUPPORTED_LOCALES (with native-script display name), and drop .php translation files into lang/<code>/. The System β Preferences dropdown picks the new locale up automatically.
Translated modules: Process Mapper was the pilot; Tickets and Tasks are now fully translated end-to-end (PHP pages and JavaScript) across all 20 locales. Remaining modules follow in phased sweeps β the infrastructure is the hard part and it's done.
-
MySQL 8.0+ with
AUTO_INCREMENTfor primary keys -
$conn->lastInsertId()to retrieve new IDs after INSERT -
Foreign keys with cascading where ownership is real (e.g.
cmdb_objects.parent_idcascade-deletes descendants) β but delete endpoints also remove children explicitly rather than trusting cascades, because installs grown via Database Verification may lack backfilled FKs. Full story, delete-rule conventions, orphan-hunting SQL and the schema-change checklist: Database Integrity -
Soft delete via
is_activeflags rather than physical deletion for user-facing records -
Datetime columns:
created_datetime,last_modified_datetime, etc. (PHP-side defaults)
All endpoints live under api/<module>/ and return JSON. Every endpoint starts with:
session_start();
require_once '../../config.php';
require_once '../../includes/functions.php';
header('Content-Type: application/json');
if (!isset($_SESSION['analyst_id'])) {
echo json_encode(['success' => false, 'error' => 'Not authenticated']);
exit;
}See API Reference for a per-module endpoint summary.
Business logic belongs in a shared service, not in the endpoint. These UI endpoints and their REST API v1 counterparts are thin adapters over a per-module service class, so a rule is written once and can't drift between the UI and the API. If you add a feature with both a UI action and an API endpoint, read Service Layer β one implementation, two interfaces first (rollout status: progress tracker).
AI features share a single provider-agnostic building block β drop renderAiSettingsPanel('<ns>') on a settings page and call aiProviderChat() in the backend. Each feature is configured independently with its own provider (Anthropic / OpenAI / OpenRouter), model and key, kept separate for granular billing visibility:
| Feature | Namespace | Settings location |
|---|---|---|
| Knowledge AI chat | knowledge_ai |
Knowledge β Settings β AI |
| Reply Cleanup | tickets_reply_cleanup |
Tickets β Settings β Reply Cleanup |
| Form generation | forms_ai |
Forms β Settings β AI |
| CMDB AI summary + Suggest Properties | cmdb_ai |
CMDB β Settings β AI Integration |
| Workflow co-author | workflow_ai |
Workflows β Settings β AI |
| RFP Builder | (deferred) | Contracts β Settings β RFP AI |
All keys are encrypted at rest. Most AI features stream output via SSE (claude.ai-style live tokens) for long-running calls. OpenRouter adds a single key reaching hundreds of models across vendors. See AI Providers for the full reference.
| Need to... | Look in... |
|---|---|
| Add a new module | Module folder + api/ + includes/waffle-menu.php + index.php
|
| Change the database connection |
db_config.php (outside the web root, referenced from config.php), includes/functions.php
|
| Add an encrypted setting |
includes/encryption.php β ENCRYPTED_SETTING_KEYS or ENCRYPTED_MAILBOX_COLUMNS
|
| Modify cross-module navigation | includes/waffle-menu.php |
| Change the landing page | index.php |
| Modify the ticket inbox |
tickets/index.php, assets/js/inbox.js
|
| Configure vCenter |
asset-management/settings/, api/assets/get_vcenter.php
|
| Manage knowledge AI |
knowledge/settings/, api/knowledge/ai_chat.php
|
| Design forms |
forms/index.php, api/forms/save_form.php
|
| View form submissions |
forms/submissions.php, api/forms/get_submissions.php
|
| Manage the encryption key |
system/encryption/, api/system/check_encryption.php
|
| Configure module access |
system/modules/, api/system/save_analyst_modules.php
|
| Account menu (avatar / password / MFA) |
includes/waffle-menu.php β renderHeaderRight(), api/myaccount/
|
| MFA login challenge |
auth/login.php (canonical URL /login), api/myaccount/verify_login_otp.php
|
| TOTP implementation | includes/totp.php |
FreeITSM β an open-source IT Service Management platform Β· github.com/edmozley/freeitsm Β· MIT licence
- Installation
- β° Scheduled tasks (cron jobs)
- Architecture
- AI Providers
- Internationalisation (i18n)
- Timezones & Time Handling
- Theming & Dark Mode
- β¨οΈ Command palette (βK)
- π Searching inside tickets
- π Attached documents
- MobileβFriendly
-
Security
- Layer 1 β which modules you can enter
- β³ π§© Module Access Control
- β³ π οΈ Module Access β Developer Guide
- Layer 2 β what you can administer
- β³ π Roles & Permissions
- β³ π οΈ Roles β Developer Guide
- β³ π€ Why capabilities are constants
- Layer 3 β the System module
- β³ π Admin Access Control
- Hardening
- β³ π Security review response 2026-08
- β³ π‘οΈ Security hardening 2026-08
- β³ π οΈ Security hardening 2026-08 β Developer Guide
- β³ π‘οΈ Round three β plain English
- β³ π οΈ Round three β Developer Guide
- Single Sign-On (SSO)
- ποΈ LDAP & Active Directory
- Browser Extension
- API Reference
-
π REST API β how it works
- β³ π« REST API: Tickets
- β³ π» REST API: Assets
- β³ π΄ REST API: Problems
- β³ π REST API: Changes
- β³ π REST API: Knowledge
- β³ β REST API: Tasks
- β³ ποΈ REST API: CMDB
- β³ π REST API: Contracts
- β³ ποΈ REST API: Calendar
- β³ πΏ REST API: Software
- β³ π¦ REST API: Service Status
- β³ βοΈ REST API: Morning Checks
- β³ π REST API: Forms
- β³ βοΈ REST API: Workflow
- β³ πΊοΈ REST API: Network Mapper
- β³ π§ Using the API docs page
- β³ π OpenAPI specification
- β³ β OpenAPI: kept correct
- β³ π οΈ Maintaining the catalogue
- Watchtower
-
Tickets
- β³ Mailbox Authentication
- β³ π€ Email send log
- β³ Basic IMAP mailboxes
- β³ Email rendering & images
- β³ SLA Management
- β³ WhatsApp channel
- β³ π¬ Web chat channel
- β³ π£ Slack channel
- β³ π Linking tickets
- β³ ποΈ Canned responses
- β³ βοΈ Limiting replies to particular senders
- β³ βοΈ Email signatures
- β³ π The public web address
- β³ π Raising a ticket for someone else
- β³ π Merging tickets
- β³ β Splitting tickets
- β³ β Selecting several tickets
- β³ π οΈ Snoozing tickets β Developer Guide
- β³ π₯ Collision detection
- β³ β±οΈ Time tracking
- Problem Management
- Tasks
- Assets
- Knowledge
- Change Management
- Calendar
- Morning Checks
- Reporting
- Software
- Forms
- Contracts
- Service Status
- π Notifications
- π¨ War Room
- Self-Service Portal
- LMS
- Process Mapper
- CMDB
- Network Mapper
- Workflows
- Issue trackers (Jira, Azure DevOps)
- System
-
Overview
- β³ π Progress tracker
- β³ Concepts & vocabulary
- β³ Email routing & mailboxes
- β³ Settings: global vs per-company
- β³ Users & self-service
- β³ Staff cross-company access
- β³ Worked examples
- β³ Pitfalls & gotchas
- β³ Scope: what it's for
- β³ π οΈ Developer Guide (make a module multi-company)
- β³ ποΈ Case study: CMDB (a linked graph)
- β³ π§ͺ Test harness (prove it's isolated)