CodeGlow: Browser-Based Code Tool
CodeGlow: Browser-Based Code Tool
CodeGlow
Submitted in partial fulfillment of the requirements for the award of the
degree of
BACHELOR OF TECHNOLOGY IN
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Dec 2025
1
ACKNOWLEGDEMENT
Most importantly, we would like to express our immense gratitude to our supervisor
for his/her patient guidance, encouragement, training, and advice he/she has
provided throughout the time. The knowledge we have gained throughout this time
will stay with us for years to come. We have been extremely lucky to have such a
supervisor who cared for our work, and responded to our questions and queries so
promptly. It was a great privilege to get to collaborate with him/her and work under
his/her guidance. Though the following project and report is an individual work, we
would never be able to explore the depths of the topic, without the help, support,
guidance & efforts of our able supervisor. His/Her infectious enthusiasm and
unlimited zeal have been major driving forces throughout the work.
Lastly, we are indebted to all the teaching and non-teaching staff members of the
university for helping us directly or indirectly by all means throughout the course of
our study and project work.
2
Abstract
The system offers real-time syntax highlighting for over 190 programming
languages through [Link], automatic code beautification via Prettier, and
instant JavaScript syntax error detection using Esprima. Operating entirely on
the frontend using HTML, CSS, and JavaScript, CodeGlow delivers a fast,
responsive, and portable solution accessible from any device.
3
This project showcases the potential of client-side JavaScript libraries to
deliver enterprise-level functionality without backend infrastructure, proving
that powerful development tools can be lightweight, accessible, and free for
everyone.
Table of Contents:
Abstract ................................................................................................ i
3.2 ER Diagram
4
3.3 Use Case Model Description
4.2 Technologies
References ................................................................................. 22
5
1. Objectives
The main objective of this study is to conduct a detailed analysis and practical
implementation of [Link], Prettier, and Esprima, which are the three key
technologies integrated into the CodeGlow project.
These tools enhance the functionality, performance, and usability of the application by
enabling syntax highlighting, automatic code formatting, and syntax error detection.
The section defines both the general goals and the specific objectives achieved during the
design and development of the CodeGlow platform.
Primary Objective:
To develop and analyze a browser-based code enhancement tool that provides real-time
syntax highlighting, code formatting, and syntax validation using modern JavaScript
libraries.
________________________________________
Detailed Objectives:
Integrate [Link] to automatically detect and apply syntax color themes to more than
190 programming languages, improving code readability and visual clarity.
Utilize Prettier as the default code formatter to maintain a clean, standardized, and
professional layout of the code, reducing human effort in maintaining indentation and
structure.
Employ Esprima to analyze JavaScript code and identify syntax-related issues instantly,
preventing logical errors during the coding process.
6
4. To Create a User-Friendly Interface:
Design an interactive, minimal, and responsive user interface using HTML5, CSS3, and
JavaScript, ensuring smooth accessibility across devices and browsers.
Incorporate Base64 encoding and URL parameter techniques for generating shareable
links, enabling collaboration without requiring any backend or database.
Adopt a modular design where each tool — [Link], Prettier, and Esprima —
functions as an independent module that can be extended or upgraded without affecting
other components.
________________________________________
Extended Explanation:
The objectives of the CodeGlow system go beyond basic functionality; they aim to
combine usability, automation, and scalability within a single web-based platform.
7
By integrating [Link], developers experience dynamic syntax highlighting without
needing to manually define language tokens.
Prettier acts as a universal formatter that automatically restructures code with proper
spacing, indentation, and alignment — creating visually consistent output regardless of
the user’s writing style.
Meanwhile, Esprima provides the crucial layer of syntactic validation, ensuring that any
JavaScript code entered is structurally correct before execution.
Furthermore, the project was designed to be open-source, portable, and lightweight, using
only client-side technologies.
This ensures accessibility, transparency, and ease of deployment on any modern browser
without server dependencies.
The ultimate objective is to deliver a smart, interactive, and educational tool that
replicates the efficiency of professional code editors within a simple web environment.
2. Methodology
The methodology defines the structured process followed to design, develop, and
evaluate the CodeGlow system using three core libraries — [Link], Prettier, and
Esprima.
Each library was integrated through a separate logical component, tested individually,
and later combined into a unified interface.
This section explains the systematic workflow, research approach, tools, and testing
strategies adopted during the project lifecycle.
________________________________________
Overview of Methodology
The development of CodeGlow was based on the Software Development Life Cycle
(SDLC) model, primarily adopting the Iterative Waterfall Approach.
8
Each phase — requirement gathering, design, implementation, testing, and deployment
— was repeated for the three major modules to ensure stability and functionality.
The libraries were evaluated for compatibility, ease of integration, and performance
impact on the web application.
________________________________________
Step-by-Step Methodology
1. Requirement Analysis:
The first step was to identify the needs of developers and students for an online code
formatting and syntax analysis tool.
A survey of existing online code editors (like CodePen, JSFiddle, and StackBlitz)
revealed the need for a lightweight, client-side alternative that required no login or
database.
o For syntax highlighting, [Link] was chosen over [Link] due to its auto-detection
feature and support for 190+ languages.
O For code formatting, Prettier was preferred over [Link] because it provides
consistent output, follows standard formatting rules, and is widely used by professional
developers.
O For syntax validation, Esprima was selected as it is the official ECMAScript parser,
used by popular tools like ESLint.
The architecture was designed using a modular structure, separating the UI, logic, and
library layers.
4. Interface Design:
9
The UI was built with simplicity and usability in mind, offering a clean editor area, theme
toggle, and real-time feedback panel.
5. Integration of [Link]:
The first integration involved connecting [Link] to the editor to detect and highlight
code dynamically.
Using the library’s built-in highlightAuto() method, CodeGlow automatically detects the
programming language without requiring user input.
Syntax coloring themes were customized through CSS to create a visually appealing
display.
6. Integration of Prettier:
Prettier was then linked to the editor to format code on a button click.
The formatting process uses the library’s API to parse and restructure code according to
standardized rules.
Users can instantly beautify JavaScript code and eliminate inconsistent spacing or
indentation errors.
7. Integration of Esprima:
When a user runs syntax validation, Esprima parses the code and generates an Abstract
Syntax Tree (AST).
Any error detected is displayed in real-time with the line and column number for easy
debugging.
The share feature uses Base64 encoding and URL parameters to generate unique
shareable links for each code snippet, promoting collaboration and easy sharing without
server-side storage.
10
Each module was tested across multiple browsers — Google Chrome, Mozilla Firefox,
and Edge — to ensure cross-platform compatibility.
Performance was validated by checking load times, code rendering accuracy, and
response to user actions.
The system was tested for syntax detection accuracy, formatting precision, and overall
responsiveness.
After the successful testing phase, detailed documentation was prepared describing each
library’s purpose, integration steps, and performance impact.
The final analysis confirmed that CodeGlow achieved all project objectives — providing
a real-time, browser-based solution for developers to highlight, format, and debug code
efficiently.
________________________________________
Workflow Summary
•Processing: [Link] detects and colors syntax → Prettier formats the code →
Esprima validates syntax.
•Output: The system displays highlighted, formatted, and error-free code with an option
to share or search.
This modular workflow allows CodeGlow to run completely offline (after libraries are
loaded once) and perform all tasks locally within the browser.
The lightweight nature of this methodology ensures speed, portability, and scalability,
making CodeGlow suitable for academic use, coding practice, and real-world
applications.
________________________________________
11
4. Iterative testing and validation process.
In summary, the methodology of the CodeGlow project revolves around three major
pillars — automation, accuracy, and accessibility.
By using [Link], Prettier, and Esprima together, the system achieves real-time
syntax visualization, instant code beautification, and structural validation — all within
the simplicity of a web browser.
2.1 Abstract
The CodeGlow project represents a modern approach to web-based code visualization
and analysis, integrating three powerful open-source JavaScript libraries — [Link],
Prettier, and Esprima.
The core aim of this project is to simplify the process of reading, formatting, and
validating source code directly within a web browser, eliminating the need for heavy
IDEs or server dependencies.
Through real-time syntax highlighting, automatic code beautification, and instant syntax
error detection, the system provides a clean, responsive, and user-friendly environment
for developers, students, and educators alike.
This report focuses on understanding the theoretical concepts, working mechanisms, and
practical implementation of these three libraries and how they collectively enhance the
overall coding experience.
________________________________________
Overview
In today’s fast-paced software industry, developers rely on tools that make code easier to
interpret and debug. The CodeGlow platform was designed as a client-side web
application using HTML, CSS, and JavaScript, making it lightweight, portable, and easy
to use on any modern browser.
Its modular structure allows independent operation of each library while maintaining
seamless interaction between them.
12
• Prettier is implemented for code formatting, ensuring that the written code follows
consistent indentation, spacing, and alignment rules.
• Esprima functions as a syntax parser, analyzing JavaScript code and identifying syntax
errors before execution.
These three components work in harmony to provide an all-in-one solution for developers
looking to write, clean, and validate their code quickly and efficiently.
________________________________________
The main purpose of this project is to demonstrate how client-side libraries can be
combined to create an intelligent, feature-rich, and responsive code editing experience
within a browser environment.
By utilizing open-source tools like [Link], Prettier, and Esprima, the CodeGlow
project showcases the potential of integrating front-end technologies to deliver real-time
functionality without relying on back-end servers or complex infrastructure.
________________________________________
Uses [Link] to automatically detect and colorize syntax from more than 190
programming languages.
This feature enhances visual comprehension and helps developers differentiate between
keywords, data types, and operators.
Employs Esprima to analyze JavaScript code in real time, highlighting syntax issues with
line and column references, allowing for faster debugging.
13
Allows users to locate keywords, variables, or functions within large code blocks,
improving navigation and reducing time spent scanning code manually.
6. Language Auto-Detection:
The system runs entirely in the browser, using only HTML, CSS, and JavaScript. This
ensures fast performance and zero dependency on servers.
Displays immediate feedback about formatting and syntax correctness, giving developers
clear insight into their code structure.
9. Cross-Browser Compatibility:
The application has been tested successfully on Google Chrome, Mozilla Firefox, and
Microsoft Edge, ensuring stable behavior across environments.
________________________________________
Key Advantages
14
• Modularity: Each library can be upgraded or replaced independently.
________________________________________
Summary
In conclusion, the Abstract of the CodeGlow project highlights how the integration of
[Link], Prettier, and Esprima delivers an effective and elegant solution for real-time
code editing and validation on the web.
This approach bridges the gap between professional development tools and educational
web platforms, providing a seamless environment for learning, debugging, and
showcasing code.
The system not only improves productivity and readability but also emphasizes the
potential of combining open-source technologies to create professional-grade utilities
accessible to everyone, directly from a web browser.
2.2 Introduction
In the field of software development, code readability, accuracy, and presentation are
critical aspects that directly influence both productivity and maintainability.
Developers often work with large and complex codebases that require proper syntax
highlighting, consistent formatting, and real-time validation.
The CodeGlow project was developed to address this need — offering developers and
learners a web-based platform for syntax highlighting, code formatting, and syntax error
detection.
15
[Link] focuses on the visual structure of code by applying syntax colorization,
Prettier enhances the aesthetic layout through proper formatting, and Esprima ensures
technical correctness by validating JavaScript syntax.
________________________________________
With the increasing shift toward browser-based development tools, there is a growing
demand for lightweight and accessible environments that support instant editing and
debugging.
Beginners, students, and even professional developers often need a quick solution to test
small snippets or understand syntax patterns without opening a full-fledged IDE.
________________________________________
1. [Link]:
2. Prettier:
O Reduces human error and saves time spent on manual code beautification.
16
3. Esprima:
________________________________________
Problem Statement
When developers work with raw or unformatted code, several challenges arise:
• Syntax errors remain unnoticed until runtime, wasting time and resources.
To address these issues, the CodeGlow platform integrates automation tools that handle
these aspects instantly, ensuring developers can focus purely on logic rather than code
aesthetics or error tracking.
________________________________________
System Concept
This entire workflow occurs on the client-side, meaning all processes are executed within
the user’s browser without external data transfer or API calls.
________________________________________
17
1. Promotes clean coding habits through structured formatting.
10. Delivers a visually appealing user interface through modern design principles.
________________________________________
Technical Foundation
The system architecture is based on HTML5 for structure, CSS3 for design, and
JavaScript (ES6) for functionality.
Each library is imported via a CDN (Content Delivery Network) and executed
asynchronously to ensure smooth performance.
The logic flow connects the input editor, highlighting engine, formatter, and syntax
checker in a single page application (SPA) model.
________________________________________
Educational Relevance
It bridges the gap between theoretical coding knowledge and practical coding tools,
allowing students to see the effect of good code practices in real time.
18
________________________________________
Conclusion of Introduction
The integration of these tools provides a complete solution for developers seeking
simplicity, functionality, and precision in code visualization.
2.3 Objectives
The objectives of the CodeGlow project are centered around creating an intelligent,
browser-based environment for syntax highlighting, code formatting, and syntax
validation.
This section describes the specific goals and purposes of each library integrated into the
system — [Link], Prettier, and Esprima — and explains how they collectively fulfill
the overall mission of improving code quality, readability, and efficiency.
Together, they establish a seamless workflow for users to write, visualize, and debug
code in real time using only a web browser.
________________________________________
The first objective of the CodeGlow project is to integrate [Link] to enable real-time
syntax highlighting for multiple programming languages.
This helps in improving the visual clarity and readability of source code by color-coding
keywords, data types, variables, functions, and control structures.
By distinguishing code elements through color and style, users can quickly understand
logic flow and structure.
19
[Link] also supports automatic language detection, which means users don’t need to
manually specify the language of their code — the library identifies it automatically
based on the syntax patterns.
This makes the tool more intelligent and user-friendly, suitable for both beginners and
experienced developers.
________________________________________
The second objective focuses on integrating Prettier, a highly reliable and widely used
code formatter.
Prettier reformats messy or unorganized code into a structured, indented, and readable
format, following globally accepted style rules.
By clicking a single button, users can transform irregularly spaced code into a visually
uniform structure.
This feature eliminates the manual effort required for indentation and enhances the
professional appearance of code snippets.
________________________________________
Esprima allows CodeGlow to identify syntax and structural errors within JavaScript code
before execution.
When a user clicks the validation button, Esprima parses the input and provides
immediate feedback with error details such as line and column number.
This objective ensures that users can debug and correct their scripts without needing to
run them in a separate environment.
20
________________________________________
Using HTML5 and CSS3, the interface follows a modern glassmorphism theme,
providing a clean and professional design.
Buttons for highlighting, formatting, validating, and sharing are arranged logically,
ensuring smooth user experience and accessibility.
________________________________________
The system is designed to process user input automatically — once the code is entered, it
undergoes language detection, formatting, and error validation sequentially.
This objective eliminates manual effort and provides developers with near-instant results,
replicating the efficiency of IDEs without requiring installation.
________________________________________
[Link] supports over 190 programming languages, while Prettier and Esprima are
optimized for JavaScript and related frameworks.
One objective of the project is to ensure that the system can handle multiple coding
languages effectively.
This cross-language compatibility makes CodeGlow suitable for diverse coding tasks —
from HTML and CSS editing to Python and Java development.
________________________________________
21
This objective focuses on minimizing load times, reducing dependencies, and ensuring
that the tool can run offline after the initial library load.
Such a lightweight structure ensures efficiency even on low-spec systems and mobile
devices.
________________________________________
A significant goal of CodeGlow is to enable code sharing without the need for accounts
or backend storage.
The system uses Base64 encoding and URL parameters to generate a unique link for each
code snippet.
Users can share this link with peers, teachers, or collaborators, who can then open it in
their browser and view the same highlighted or formatted code.
This fosters collaboration, code review, and knowledge sharing in educational and
professional settings.
________________________________________
One key objective is to ensure that users receive instant responses from each operation —
whether it’s highlighting, formatting, or syntax checking.
This real-time validation helps identify errors early and promotes an interactive learning
environment where users understand the impact of their code changes immediately.
________________________________________
The final objective is to create a modular and scalable architecture that can be expanded
easily in the future.
22
This ensures that CodeGlow remains future-ready and adaptable to evolving coding
trends and technologies.
________________________________________
Summary
In conclusion, the objectives of the CodeGlow project are not limited to visual
improvement but extend to functionality, learning enhancement, and productivity.
The detailed objectives defined here serve as the foundation for all subsequent phases of development,
design, and testing, ensuring that CodeGlow continues to meet both educational and professional standards.
2.4 ER Diagram
23
24
25
The Entity Relationship (ER) Diagram of the CodeGlow project represents the logical
structure of data flow and the relationships between different components in the system.
The ER model defines the main entities, their attributes, and the relationships among
them. This theoretical design ensures scalability, allowing future versions of CodeGlow
to incorporate persistent data storage and user management features.
________________________________________
1. Visualize how different components (like code snippets, users, and programming
languages) relate to each other.
2. Define the logical flow of data between entities within the system.
4. Establish a clear data structure that can be used if CodeGlow integrates with databases
like Firebase, MySQL, or MongoDB.
5. Provide a blueprint for developers to expand the application into a multi-user, data-
driven platform.
________________________________________
The ER model primarily involves three main entities and several supporting attributes
that define the logical structure of the application.
1. User Entity
• Description:
26
Although the current system is frontend-only, this entity becomes essential for future
user-based features like login systems, preferences, and saved code snippets.
• Attributes:
• Role in System:
The User entity interacts with the CodeSnippet entity by creating, editing, formatting, or
sharing code snippets.
________________________________________
2. CodeSnippet Entity
• Description:
• Attributes:
• Role in System:
27
CodeSnippet acts as the core data object manipulated by all libraries — [Link]
highlights it, Prettier formats it, and Esprima validates it.
________________________________________
3. Language Entity
• Description:
Each code snippet must belong to one programming language, identified automatically or
manually selected by the user.
• Attributes:
O Syntax_Style – The theme or highlighting rule set used by [Link] for that
language.
O File_Extension – Common extension for the language (e.g., .js, .py, .html).
• Role in System:
The Language entity ensures proper mapping between the user’s code snippet and the
highlighting/formatting rules.
________________________________________
Although not implemented in the current frontend version, the following entities are part
of the theoretical ER model for future scalability:
1. Theme Entity:
O Stores color schemes and layout preferences (e.g., light or dark mode).
2. ShareLink Entity:
28
O Represents the generated Base64 and URL parameter combination for sharing code
online.
3. ErrorLog Entity:
________________________________________
O Each snippet can generate one shareable link that uniquely represents its encoded
content.
O A code snippet may contain multiple syntax errors, each logged as a separate entry.
O Each language can have multiple theme options available for syntax highlighting.
________________________________________
The logical data flow within the CodeGlow system follows this pattern:
29
• The system treats the input as a CodeSnippet entity.
• Esprima checks for syntax errors and updates the Error_Status or ErrorLog.
________________________________________
8. Helps developers identify primary keys, foreign keys, and relationship types.
10. Promotes consistency and integrity in data handling if the system scales up.
________________________________________
Summary
Even though the current version operates entirely on the frontend, this theoretical model
ensures that CodeGlow can evolve into a complete full-stack application in the future.
The structured entity relationships make the system scalable, extensible, and adaptable
for academic learning, professional use, and collaborative coding environments.
30
2.5 Architecture Design
The Architecture Design of the CodeGlow system defines the logical structure, flow of
data, and interaction among its functional modules.
Although the project is primarily frontend-based, it follows a modular and layered design
approach, ensuring that every component performs a specific task while maintaining
overall system integrity.
Their integration creates a seamless workflow for syntax highlighting, code formatting,
and syntax validation.
________________________________________
1. Architectural Overview
1. User Interface (Presentation Layer) – Handles interaction between the user and the
system.
3. Data Interaction Layer – Deals with the flow of information, including user input,
formatted output, and optional shareable data.
This modular structure ensures flexibility and allows easy integration of new libraries or
tools without altering the core design.
________________________________________
• It is built using HTML5 and CSS3, providing a clean and modern layout that supports
both desktop and mobile views.
31
O A code editor area (textarea or content-editable div).
O Functional buttons such as Highlight, Format, Check Syntax, Search, and Share.
________________________________________
This is the heart of the CodeGlow system, where all major operations are executed using
JavaScript.
Each library is initialized and called through separate scripts, ensuring modularity and
independence.
This module is essential for improving code readability and language recognition.
32
• Works through the [Link]() API, triggered by user interaction (e.g., Format
button).
• Parses code into an Abstract Syntax Tree (AST) for internal structure checking.
This module plays a vital role in error prevention and logical correctness.
________________________________________
Although CodeGlow currently operates without a backend, the data interaction layer
manages:
This enables the system to share snippets efficiently without requiring a database or user
authentication.
________________________________________
1. User Input: The user pastes or types code into the editor.
33
2. Language Detection: [Link] identifies the programming language.
6. Display Result: The formatted and validated code is displayed in the output section.
7. Optional Sharing: The final code is encoded and converted into a shareable link.
________________________________________
The process is sequential but independent — meaning each module can operate even if
others are disabled.
For example:
This modular independence ensures high system reliability and ease of debugging.
________________________________________
• Processing Phase: CodeGlow triggers respective library functions for detection, formatting, and
validation.
• Optional Phase: User can copy, search, or share the final result.
This cycle occurs entirely within the browser using asynchronous JavaScript methods, ensuring smooth
performance and zero delay.
________________________________________
34
8. Key Architectural Features
2. Lightweight and Fast: Libraries are optimized for minimal load time.
7. Offline Usability: Functions even without an internet connection after initial load.
10. Extendability: Compatible with future tools like Monaco Editor or [Link].
________________________________________
________________________________________
Its multi-layered structure ensures a balance between functionality and simplicity, setting
the foundation for future enhancements such as theme customization, AI-based code
suggestions, and backend integration.
This architecture not only supports current features but also ensures long-term scalability
and maintainability of the CodeGlow platform.
35
2.6 Use Case Model Description
The Use Case Model of the CodeGlow system represents the functional interaction
between the user and the system.
It describes how different users (actors) interact with the software to achieve their goals,
and it defines the various tasks or operations that the system must perform in response to
user actions.
Although CodeGlow is a frontend-based web application, its use case model provides a
conceptual understanding of how the system behaves under different user actions such as
writing, highlighting, formatting, validating, and sharing code.
This section presents a detailed theoretical explanation of all the actors, use cases, system
responses, and interaction scenarios involved in the project.
________________________________________
1. Identify and define all possible interactions between the user and CodeGlow.
2. Describe each functional feature of the system in terms of what the user does and how
the system responds.
3. Provide a structured overview of the system’s behavior for developers and testers.
4. Ensure that all major requirements — from syntax highlighting to sharing code — are
captured and implemented accurately.
5. Establish a foundation for designing detailed workflows and sequence diagrams later
in the development process.
________________________________________
An actor is any external entity (human or system) that interacts with the application to
perform specific operations.
36
• Represents the person interacting with the system — a student, developer, or educator.
• The user performs all major operations such as inputting code, formatting, validating,
searching, and sharing snippets.
• The system executes actions such as highlighting, formatting, error detection, and
generating shareable links.
• It acts as the responder, processing input and delivering output in real time.
________________________________________
Each use case represents a specific goal that the user can accomplish through the system.
The following are the primary use cases identified for the CodeGlow application:
________________________________________
•Description: The user enters or pastes raw code into the editor area of the CodeGlow
interface.
• Postcondition: The entered code becomes available for further processing (highlighting,
formatting, etc.).
• System Response: The system accepts the input text and stores it temporarily in
memory.
________________________________________
37
• System Response: The selected or detected language type is stored and used for syntax
highlighting.
________________________________________
3. Highlight Code
• Description: The user clicks the Highlight button to apply color-coded syntax
formatting using [Link].
• System Response: The system analyzes the code, identifies keywords, and applies
appropriate syntax coloring themes.
________________________________________
4. Format Code
• Description: The user chooses to beautify the code using the Prettier formatter.
• System Response: Prettier reformats the code, ensuring consistent indentation, spacing,
and alignment.
• Outcome: The formatted code replaces the raw version in the editor, providing a neat
and professional appearance.
________________________________________
5. Validate Syntax
• Description: The user requests syntax validation using the Esprima parser.
• System Response: The system parses the JavaScript code and detects any syntax errors.
• Error Handling: If errors are found, they are displayed with line and column
information; otherwise, a success message (“Syntax Correct”) appears.
• Outcome: The user can identify and correct syntax issues before running the code
elsewhere.
________________________________________
6. Search in Code
• Description: The user uses the in-code search bar to find specific keywords, functions,
or variables.
38
• System Response: JavaScript highlights all occurrences of the searched term.
• Outcome: Improves navigation in long code files, helping users quickly locate relevant
sections.
________________________________________
• Description: The user clicks on the Share button to create a shareable link for the code
snippet.
• System Response:
• Outcome: A unique link is generated that can be copied and shared with others.
• Alternative Flow: If the code is empty, the system prompts the user to enter text first.
________________________________________
• Description: The user can copy either the raw or formatted version of the code to the
clipboard.
• System Response: The browser’s Clipboard API stores the copied content for further
use.
• Outcome: Users can easily paste the formatted or validated code into other applications
or editors.
________________________________________
• Description: Allows the user to clear all text and start fresh.
________________________________________
39
10. Exit Application or Refresh
• System Response: All unsaved code is cleared (unless a shareable link was generated).
________________________________________
• All libraries — [Link], Prettier, and Esprima — are loaded dynamically through
CDN links.
• Each use case executes independently but can be combined in any order based on user
needs.
• The system assumes that the user has a modern browser supporting JavaScript ES6 or
above.
________________________________________
5. Pre-conditions
3. The user should enter valid text or code into the editor to perform any action.
4. Basic browser permissions for clipboard and URL access must be enabled.
________________________________________
6. Post-conditions
1. The system must display highlighted or formatted code without data loss.
3. Shareable links, if generated, must open with the same code content.
4. The application should remain stable and responsive during user interaction.
40
________________________________________
________________________________________
8. Summary
In summary, the Use Case Model for CodeGlow demonstrates how the user interacts with
the system to perform tasks such as writing, highlighting, formatting, validating,
searching, and sharing code.
It provides a clear conceptual framework for understanding system behavior and ensures
that every feature serves a distinct purpose.
Through these use cases, the CodeGlow system achieves its primary goal — offering
developers a seamless, real-time, and intuitive platform for writing and refining code
entirely within a browser environment.
41
Although CodeGlow is primarily a frontend JavaScript-based project, its logical design
can still be represented using object-oriented concepts such as classes, attributes,
methods, and relationships.
This section explains each class, its attributes, operations, and interdependencies in detail
— focusing on how [Link], Prettier, and Esprima modules are encapsulated within
the system’s architecture.
________________________________________
2. To describe the major classes that represent the logical building blocks of CodeGlow.
3. To define how data and control flow between modules such as the editor, syntax
highlighter, code formatter, and syntax validator.
________________________________________
1. Editor Class
5. SearchManager Class
6. ShareManager Class
7. UIController Class
Each class performs a unique function but collaborates with others to complete the
overall workflow of the CodeGlow application.
42
________________________________________
1. Editor Class
• Purpose:
Serves as the main interaction point between the user and the system.
It holds the code entered by the user and passes it to other modules for processing.
• Attributes:
• Methods:
• Relationships:
________________________________________
• Purpose:
Manages syntax detection and highlighting of the code entered by the user.
• Attributes:
• Methods:
43
O detectLanguage(codeInput) – Automatically detects the language of the code.
• Relationships:
This class directly interacts with the Editor class to access the raw code and updates the
UI through the UIController class.
________________________________________
• Purpose:
• Attributes:
• Methods:
• Relationships:
Works closely with Editor and SyntaxValidator classes to ensure that formatted code
remains valid and error-free.
________________________________________
• Purpose:
Detects syntax and structural errors within the code before execution.
• Attributes:
44
O errorList – Stores error details such as line and column numbers.
• Methods:
• Relationships:
________________________________________
5. SearchManager Class
• Purpose:
Allows users to search specific keywords, variables, or functions within the code.
• Attributes:
• Methods:
• Relationships:
Interacts with the Editor and UIController classes to provide visual feedback.
________________________________________
45
6. ShareManager Class
• Purpose:
Handles the generation and decoding of shareable links using Base64 encoding.
• Attributes:
• Methods:
• Relationships:
________________________________________
7. UIController Class
• Purpose:
Manages all visual updates and interactions between backend logic and user interface.
• Attributes:
• Methods:
• Relationships:
46
The UIController acts as the central bridge connecting Editor, SyntaxHighlighter,
CodeFormatter, and SyntaxValidator classes.
________________________________________
• Editor ↔ SyntaxHighlighter:
The Editor provides input code, and the SyntaxHighlighter returns highlighted content.
• Editor ↔ CodeFormatter:
Raw code from the Editor is beautified by the CodeFormatter and returned as formatted
output.
• Editor ↔ SyntaxValidator:
The Editor sends the current code for syntax checking; validation results are sent back for
display.
• SyntaxValidator ↔ UIController:
• ShareManager ↔ Editor:
Acts as the central communication hub, managing visual updates and user feedback.
________________________________________
1 Modularity: Each class handles a specific function, making the system easy to maintain.
2. Reusability: Core functions like highlighting and formatting can be reused across
projects.
4. Encapsulation: Data such as code input and errors are contained within their respective
classes.
47
5. Low Coupling: Each class operates independently, reducing dependency errors.
6. High Cohesion: Functions within each class are closely related to its purpose.
7. Extendability: The system allows the addition of new classes like ThemeManager or
FileHandler in the future.
10. Maintainability: Easier debugging and testing due to the clear class structure.
________________________________________
6. Summary
In summary, the Class Diagram of CodeGlow defines the structure and relationships of
all main modules in the system.
It ensures that every function — from syntax highlighting and formatting to error
detection and code sharing — is handled by a dedicated class.
This modular and object-oriented design promotes clarity, scalability, and efficient
integration of libraries such as [Link], Prettier, and Esprima.
The clear class hierarchy and communication flow between these components make
CodeGlow a robust and maintainable system for modern web-based coding
environments.
It depicts how the User, Editor Interface, and internal system modules such as
[Link], Prettier, and Esprima communicate to accomplish a specific task — from
entering code to producing highlighted, formatted, and validated output.
48
Unlike static diagrams like the Class Diagram, the Sequence Diagram focuses on the
temporal order of events, showing how one action triggers another and how data moves
between components in a logical, step-by-step sequence.
________________________________________
The main objectives of the Sequence Diagram in the CodeGlow system are to:
2. Show the order in which processes occur when a user interacts with the application.
3. Describe how each library ([Link], Prettier, Esprima) performs its task
sequentially.
4. Clarify the dependencies between system modules and the data they exchange.
________________________________________
2. User Interface (UI) – The editor area and buttons where input and output are displayed.
7. UIController – Manages the visual updates and displays the processed results to the
user.
Each object performs its function in a coordinated manner to create a smooth and real-
time user experience.
49
________________________________________
The general workflow of CodeGlow can be divided into six major stages, showing how
each event occurs in sequence:
________________________________________
• This raw input becomes the primary data source for subsequent processing.
• The Editor sends this input to the UIController for action handling.
________________________________________
• If the user has not specified a language, [Link] automatically determines it based
on syntax patterns.
• The system applies a color theme and returns the highlighted HTML content to the UI.
________________________________________
• When the user clicks the Format button, the UIController passes the raw or highlighted
code to Prettier.
• The CodeFormatter processes the code using predefined formatting rules (indentation,
semicolons, spacing).
50
• The formatted code is then returned to the UIController and displayed in the editor area,
replacing the original content.
________________________________________
• Upon clicking the Check Syntax button, the UIController forwards the formatted code
to Esprima.
• Esprima parses the code and creates an Abstract Syntax Tree (AST) representation.
• The validator checks for structural issues such as missing parentheses, braces, or
incorrect keywords.
• If errors are detected, error messages with line and column numbers are returned to the
UI.
• If no errors are found, a success message such as “Syntax Valid” is displayed to the
user.
________________________________________
• Search:
The SearchManager scans the code and highlights all matching terms using JavaScript
DOM operations.
• Share:
The ShareManager encodes the current code using Base64 and generates a unique URL
parameter.
________________________________________
51
• After all operations, the UIController compiles the results — including highlighted
code, formatted text, and syntax feedback — and renders them in the interface.
• The User views the final output and can copy, share, or re-edit the code.
In conclusion, the Sequence Diagram of the CodeGlow project explains how user inputs
are processed step-by-step through [Link], Prettier, and Esprima, leading to
highlighted, formatted, and validated code output.
It captures the dynamic nature of the application and the message exchange between
components.
This design ensures that CodeGlow maintains clarity, speed, and responsiveness,
providing a seamless coding experience directly through the browser.
The sequential interaction of these modules not only demonstrates modular programming
practices but also highlights the efficiency of combining multiple open-source libraries in
a single integrated environment.
3. System Design
The System Design of the CodeGlow project defines how different components — user
interface, libraries, and logic — interact to achieve a smooth and efficient workflow.
The design focuses on simplicity, modularity, and performance, ensuring that each tool
performs its role without dependency conflicts.
The system works entirely on the frontend, with no backend or database integration,
making it fast, portable, and ideal for academic and real-world use.
________________________________________
1. Modular Architecture:
The system is divided into independent modules — [Link] for syntax highlighting,
Prettier for formatting, and Esprima for syntax validation.
2. Client-Side Operation:
52
All functionalities are executed within the browser using HTML, CSS, and JavaScript,
eliminating the need for server-side processing.
This ensures low latency, offline support, and quick response times.
Users can easily write, format, check, and share code through intuitive buttons and
panels.
Each stage is handled by a specific library, ensuring smooth data flow and instant
feedback.
5. Future Scalability:
• Esprim
3.2 Technologies
a: Detects and reports syntax errors in JavaScript code.
• Google Chrome & Mozilla Firefox: Used for browser-based testing and validation.
• HTML5: Defines the structure of the application and the editor layout.
53
• JavaScript (ES6): Implements logic for syntax highlighting, formatting, and validation.
• Base64 Encoding: Enables shareable code link generation without backend storage.
• CDN Libraries: Used for importing external tools like [Link], Prettier, and
Esprima efficiently.
4. Results
The CodeGlow – Smart Code Highlighter project has been successfully implemented as a
lightweight, responsive, and browser-based application using HTML, CSS, and
JavaScript. The tool provides key features including:
Each feature has been tested across modern browsers such as Google Chrome and
Firefox, ensuring cross-platform compatibility. The UI has been designed with a clean,
glassmorphism-based aesthetic and performs efficiently even on low-spec systems. The
application's performance and responsiveness confirm that all intended functionality was
achieved with minimal resource usage and no backend dependency.
The system demonstrates real-time feedback, enhances code readability, and simplifies
code-sharing without requiring user registration or login. It is suitable for developers,
students, and educators alike..
The modular architecture and frontend-only design make CodeGlow portable, fast, and
easy to deploy. The application can function entirely offline (except for loading external
libraries), and its simple design ensures that even beginners can use it effectively.
54
CodeGlow has proven to be a practical, real-world tool that simulates features seen in
modern online IDEs and coding assistants.
The project not only demonstrates technical knowledge in frontend development but also
reflects real-world design patterns through its use of open-source libraries and modular
integration.
Future Enhancement :
Although CodeGlow is fully functional in its current version, several enhancements can
be considered for future development:
Extend formatting support beyond JavaScript to include HTML, CSS, and Python.
2. Backend Integration
Add Firebase or [Link] to enable users to save and retrieve code snippets across devices.
Allow users to create accounts to store code, themes, and preferences securely.
Enable side-by-side comparison of two code snippets using libraries like jsdiff.
Allow users to upload .js, .py, or .html files for instant highlighting.
55
Provide export options for code with styles applied.
6. References
• [Link], “[Link] Documentation”, [Online]. Available: [Link]
[Accessed: April 18, 2025].
• Mozilla Developer Network, “Base64 Encoding and URL API – MDN Docs”,
[Online]. Available: [Link]
[Accessed: April 18, 2025].
56
57
58
59
60