CodeIgniter File Structure and Architecture | Part-3

    Before reading CodeIgniter Framework File Structure and Architecture, read this post

    Learning CodeIgniter can be a handy skill for web developers and people who want to career as freelancers. Today I’ll guide you basics of the CodeIgniter file structure and architecture. I’ll discuss different files and folders of the CodeIgniter framework, and I’ll help you set up your first CodeIgniter project.

    File Structure

    CI home directory
    CodeIgniter Framework File Structure

    The above image shows the file directory structure of the CodeIgniter.

    It contains three folders:-

    • application
    • system
    • user_guide


    It has all the code required for a web application. Web developer make changes in an application folder. It contains:-

    CodeIgniter Application Directory
    CodeIgniter Framework Application Directory
    • Cache: – cache folder contains all the cached pages rendered by your application. The cache folder increases page access speed as your application doesn’t have to generate the previous page.
    • Config:- Config folders contain various files that configure your web application. The Autoload file loads the libraries at the beginning of the web application. The web server loads different files that are in the autoload file. Web developer writes database username, password, name, driver, etc. on the database file. Routes file is responsible for managing the URL routes to generate pages.
    • Controller:- As the name suggests, it contains all the essential parts of your application. The controller controls your web application flow. A controller file handles all server-side functionalities. A Controller file is responsible for parsing URL request and to generate a web page.
    • Core:- It contains a base class of your web application.
    • Helper:- It contains a helper class of your web application.
    • Hooks:- It contains files that are responsible for modifying the inner working of the framework without hacking the core files.
    • Language:- It contains files related to language. You can create files to create a specific language in your web application.
    • Libraries:- You can store the libraries that you have developed for this application.
    • Logs:- It contains system log files. If your CodeIgniter web application generates error files, then you can view it for an explanation.
    • Models:- It contains all database queries. The controller parses the user request and controller request model to retrieve information from the database table.
    • Third_party:- Third-party plugins are stored here. You can keep all plugins; you used on your application.
    • Views:- It contains all your HTML files. Controller load HTML files from views directory and show on browser.


    This folder contains all core codes, libraries, helpers, and other files. So web developers should not change these files as it may cause web application failure. It has the following folders.

    CodeIgniter System directory
    CodeIgniter Framework System Directory
    • Core:- It contains CodeIgniter’s core class files. It would be best practice if you did not modify it at any cost. If needed, you can use hooks, which lie in the hooks folder of the application directory.
    • Database:- It contains all the core database drivers and other database utilities.
    • Fonts:- It contains files related to font information.
    • Helpers:- It contains all standard CodeIgniter helpers such as cookies, URL, date, etc.
    • Language:- It contains all files related to language. As CodeIgniter supports multiple languages, it has a default language.
    • Libraries:- It contains all standard libraries to support email, file uploads, calendars, etc.  You can create your libraries by extending these files in the application/libraries directory.


    It has a CodeIgniter offline version user guide for developers. It has tips and information to configure and use the CodeIgniter framework. You can learn about various libraries, helpers, and different classes. Before writing code, I suggest you read the user guide for the best and correct practice. You can download user_guide from this link.

    Besides these three folders, it has one crucial file named “index.php”. You can set up your web application environment and error level. If you don’t have proper knowledge and information, it is better not to modify it.

    CodeIgniter Framework Architecture

    CodeIgniter Application Flow
    CodeIgniter Framework Flow

    The CodeIgniter framework provides maximum performance in less time. It loads libraries on request only, and framework components rely significantly less on each other.

    CodeIgniter framework flow is described below:-

    • “index.php” is the default file of the framework. It initializes the base resources. When a user enters a URL on the web browser, that request is passed to the “index.php” file.
    • In the second step, Routing will decide whether to pass the request to security or send it to the cache.
    • If the requested page exists in caching, the Routing passes the request to cache else; it will send the request for security checking.
    • After security checking, the request is sent to the application controller. The application controller loads necessary models, libraries, helpers, plugins, and HTML files from the application/views directory and pass it to view.
    • The view will render the page with all available data and pass it on the cache. If the request is new for the CodeIgniter web application, it will keep that page at the cache.

    CodeIgniter as MVC Framework

    Model, view and controller

    CodeIgniter is designed with Model-View-Controller (MVC) development pattern. MVC separates application logic from presentation.

    • The model represents your data structure. The model contains all the functions that help to retrieve, insert, and update database table information.
    • The view is a web page presented to the user on a web browser. Pages can be fragments like a header or footer, or it can also be an RSS page or any other type of page.
    • The controller acts as a mediator between model and view. It processes HTTP request and generates a web page as an HTTP response.

    It will be the end of CodeIgniter File Structure and Architecture. If it is your first visit to our tutorial series, you can start reading the tutorial series from this link.

    Please! Comment below if you find this post worth reading? I’ll read your all comments and reviews which I’ll improve in a future post.

    Recent Articles


    Related Stories

    1 Comment

    Leave A Reply

    Please enter your comment!
    Please enter your name here

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Get new notification

    Subscribe to our newsletter

    To be updated with all the latest news, offers and special announcements.