Skip to main content

System Architecture

Sakai LMS is built on a layered architecture that separates core services from presentation and tool functionality. This design enables modularity, extensibility, and maintainability across the platform.

Architecture Layers

Sakai’s architecture consists of three primary layers:

Kernel Layer

Core services and APIs that provide foundational functionality for all tools

Portal Layer

User interface framework that controls the outer UI and manages tool rendering

Tool Layer

Individual applications (assignments, gradebook, etc.) that provide specific functionality

High-Level Architecture Diagram

Component Manager

At the heart of Sakai is the Component Manager, which uses Spring Framework to configure and wire service implementations.
package org.sakaiproject.component.api;

public interface ComponentManager {
    /**
     * Find a component that is registered to provide this interface.
     */
    <T> T get(Class<T> iface);
    
    /**
     * Check if this interface Class has a registered component.
     */
    boolean contains(Class iface);
    
    /**
     * Get all interfaces registered in the component manager.
     */
    Set<String> getRegisteredInterfaces();
}
The Component Manager creates the Sakai Application Context, which serves as the parent Spring context for the entire platform. Services are configured using components.xml files in each module’s WEB-INF directory.

Service Location Pattern

Sakai uses a service location pattern where tools access kernel services through the Component Manager rather than direct instantiation:
// Correct: Use service location
SiteService siteService = ComponentManager.get(SiteService.class);
Site site = siteService.getSite(siteId);

// Incorrect: Don't instantiate services directly
// SiteService siteService = new SiteServiceImpl(); // WRONG!

Key Architectural Principles

1. Separation of Concerns

  • Kernel: Provides core services (user management, authorization, content hosting)
  • Portal: Manages UI chrome, navigation, and tool rendering
  • Tools: Implement specific educational features

2. API/Implementation Split

Each service is defined as:
  • API (interface): Located in kernel/api/src/main/java/org/sakaiproject/*/api/
  • Implementation: Located in kernel/kernel-impl/src/main/java/org/sakaiproject/*/impl/
Reference: kernel/README.md:5-33

3. Spring-Based Dependency Injection

Services are wired using Spring XML configuration:
<!-- Example: site-components.xml -->
<bean id="org.sakaiproject.site.api.SiteService"
      class="org.sakaiproject.site.impl.SiteServiceImpl"
      init-method="init" destroy-method="destroy">
    <property name="sqlService" ref="org.sakaiproject.db.api.SqlService"/>
    <property name="entityManager" ref="org.sakaiproject.entity.api.EntityManager"/>
</bean>

Portal Architecture

The portal layer controls the outer UI and manages how tools are rendered to users.

Portal Components

Main portal implementation that handles requests and delegates to handlersLocation: portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/SkinnableCharonPortal.java
Special URL handlers for different portal functions:
  • Direct tool access: /portal/directtool/{tool-id}?sakai.site={site-id}
  • Bug reports: /portal/generatebugreport
Manages tool rendering using templates (Morpheus theme)Module: portal-render-engine-impl
Reference: portal/README.md:1-49

Entity Producer Pattern

Many kernel services implement the EntityProducer interface, which enables:
  • Archive and merge functionality
  • Import/export capabilities
  • Consistent entity handling
public interface EntityProducer {
    /**
     * @return a short string identifying the resources kept here
     */
    String getLabel();
    
    /**
     * @return true if the service wants to be part of archive/merge
     */
    boolean willArchiveMerge();
    
    /**
     * Archive the resources for the given site.
     */
    String archive(String siteId, Document doc, Stack<Element> stack, 
                   String archivePath, List<Reference> attachments);
}
Reference: kernel/api/src/main/java/org/sakaiproject/entity/api/EntityProducer.java:37-76
Services like SiteService, UserDirectoryService, ContentHostingService, and AuthzGroupService all implement EntityProducer, enabling consistent site import/export functionality.

Technology Stack

  • Backend Framework: Spring Framework (dependency injection, MVC)
  • ORM: Hibernate (for database persistence)
  • Template Engine: Thymeleaf (preferred for new development)
  • Frontend: Web Components using Lit library, Bootstrap 5.2
  • Java Version: Java 17 (trunk), Java 11 (Sakai 22/23)

Module Structure

Typical Sakai module structure:
module-name/
├── api/              # Service interfaces
├── impl/             # Service implementations
│   └── src/main/webapp/WEB-INF/
│       └── components.xml
├── tool/             # Web application (UI)
└── pom.xml
Reference: source/assignment/

Next Steps

Kernel Services

Learn about core kernel services and APIs

Tool Architecture

Understand how tools are structured

Sites & Workspaces

Explore site and workspace concepts

Build docs developers (and LLMs) love