> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlecker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

# Introduction to Lecker CMS

## Table of Contents

* [Project Structure](#project-structure)
* [Core Components](#core-components)
* [Lecker CMS UI](#lecker-cms-ui)
* [Important Tables and Terms](#important-tables-and-terms)
* [Libraries](#libraries)
* [Modules](#modules)
* [Security Best Practices](#security-best-practices)

## Project Structure

The Lecker project follows a specific file structure:

* `application/`
  * `config/` - Database connection, base URL, constants, routes, autoload, etc.
  * `controllers/` - Main project functions for frontend, backend, content management, etc.
  * `core/` - Contains MY\_Controller with shared functions
  * `helpers/` - Contains besc\_helper for simple helper functions
  * `language/` - Contains language lines accessed via `$this->lang->line('your_line_key')`
  * `libraries/` - Project libraries and Lecker\_crud
  * `models/` - Models named by the controller where they are used
  * `views/` - HTML views for frontend, mail, authentication etc.
* `assets/` - Fixed assets shared between projects
* `system/` - Core CodeIgniter libraries and PHP files, including Model.php
* `items/` - Project-specific assets (JavaScript, CSS, images, uploads)
* `vendor/` - Composer and third-party libraries
* `composer.json` & `composer.lock` - List of installed libraries
* `index.php` - Application entry point (switch to production environment for live sites)
* `.htaccess`

## Core Components

### Controllers

1. Backend & Repository Controller
   * Basic backend functions
   * Repository management (overviews, teaser image selectors)

2. Content Controller
   * Setup of editable tables in CMS
   * Content Helper for displaying buttons and data
   * Module saving, cloning, and display
   * Error logging

3. Authentication & User Controller
   * Backend and frontend login
   * Password reset

4. Frontend Controller
   * Public-facing views
   * Data preparation

5. Lecker Controller
   * Core of the CRUD system
   * Functions for rendering tables, editing, filtering, and image upload

6. MY\_Controller
   * Universal functions used throughout the app
   * Image preparation for modules
   * Naming functions
   * Error logging functions

### Models

Models specify database queries for CRUD operations using CodeIgniter syntax. The `Model.php` in the system folder defines universal model functions that can be used anywhere.

## Lecker CMS UI

The Content Management System is accessible via the Backend at `/backend` (default setting editable in routes.php). Key features include:

* Dashboard with editable tables
* Menu divided into groups:
  * Normal project user: Content, General, Repositories
  * Projects with shop: additional Shop category
  * Developers: additional Dev Area category
* Settings for user data and dashboard customization

<Note>
  Login requires a backend\_user with admin set to 1 to access and edit tables.
</Note>

## Important Tables and Terms

1. Entity
   * Middle point to connect with teaser images and items
   * First image taken as main, can be reordered
   * Define table columns and relationships
   * Uses entity\_teaser\_relation
   * Types:
     * Article Entity: represented by a page with dynamic modules
     * Noarticle Entity: exist independently, without articles or modules
   * Must be specified in constants for ID generation

2. Article (table items)
   * Subordinate to Entity
   * Contains modules and language-specific content
   * Defined via pretty URL
   * Four visibility options:
     * Visible
     * Only with direct link
     * Logged in only
     * Hidden
   * Can be associated with multiple modules (text, image, gallery)
   * Supports multiple languages (specify in constants)
   * Can link original article with secondary language articles

3. Image Repository
   * Central storage for images and photos
   * Connect to entities as teaser images, modules, or noarticle entities
   * Public/private settings (private images blurred in backend)
   * Resized and saved by default in three versions using Imagick library:
     * Frontend image
     * Full size
     * Thumbnail

4. Tags
   * General (associated with any Article Entity)
   * Specific to certain Noarticle or Article entity types
   * Default tag connected with Normal Article entity

5. File Repository
   * For saving various file types (mainly smaller PDF files or ZIP packages)
   * Used in articles via download module

6. User Table
   * Accessible only to superadmin
   * For creating and managing user accounts and permissions

7. Dev Area
   * Not visible for non-dev backend users
   * Contains error logs, article overview, debugging tables, and stats
   * Automatic error logging using MY\_Controller functions

## Libraries

Lecker includes several libraries:

* PDF creator
* Shopping functions
* Picture creation
* CKEditor for text editing
* PHPMailer

## Modules

Modules for articles are specified in three main areas:

1. Content Controller
   * Types of modules and their columns

2. crud.php
   * Preview of modules in backend
   * Module editor
   * Icons

3. Frontend Controller
   * Detail function to collect article-specific modules and content

4. JavaScript files
   * edit.js in items/backend
   * Module-specific JavaScript files
   * Specifies transfer of information between module editor and preview

## Security Best Practices

1. Keep the CMS and plugins up to date
2. Implement basic security measures
3. Use secrets management:
   * Create a `.env` file in the root directory - see template under installation
   * Access secrets using `$_ENV['SECRET_NAME']`
   * Use phpdotenv library
