JCR (Java Content Repository)
Learn what the JCR is, how AEM uses it to store everything, and why understanding it is fundamental to AEM development.
Last reviewed: December 2024
🔍 What Is It?
JCR in AEM is the Java Content Repository that stores pages, components, assets, and configuration as nodes and properties. AEM uses the Java Content Repository, implemented through Apache Jackrabbit Oak, as the storage layer for site content, components, templates, assets, and many configuration areas. In practice, JCR is the content tree behind paths like /content, /apps, /conf, and /content/dam.
When people search for "AEM JCR" or "what is JCR in AEM," they usually want the direct answer: JCR is the repository model that stores everything as nodes and properties, and AEM reads that tree to render pages, resolve resources, and support authoring.
Quick Facts
- →Used in: Pages, components, DAM assets, templates, permissions, and repository-backed configuration
- →Best for: Understanding how AEM stores content and how Sling resolves real page data
- →Interview importance: High because JCR is a core AEM fundamentals topic
- →Production relevance: High because repository structure affects queries, performance, permissions, and debugging
- →Related topics: Sling, CRXDE Lite, client libraries, components
- →Last updated: July 2026
Key Concepts
- →Node - A repository item similar to a folder or file, such as
cq:Pageornt:unstructured - →Property - A key-value pair stored on a node, such as
jcr:title - →Node type - The structure rules for a node and the child nodes or properties it can contain
- →Path - The unique location of a node, such as
/content/mysite/en/home - →UUID - A stable identifier for repository-level operations
Common Node Types
- →
cq:Page- An AEM page - →
cq:PageContent- The content node under a page - →
cq:Component- A component definition - →
nt:unstructured- A flexible content node - →
dam:Asset- A DAM asset
🎯 Why Do We Need It?
JCR matters because AEM is a repository-first platform. Pages, dialogs, authoring values, assets, and many configuration areas all depend on the way content is structured in the repository.
Developers who understand JCR can read content paths faster, debug authoring issues with more confidence, and reason clearly about Sling Models, permissions, indexing, and query behavior.
Interview Relevance
- →Interviewers ask JCR to test whether you understand the storage model behind AEM pages and components
- →A strong answer explains nodes, properties, paths, and how
sling:resourceTypeconnects content to rendering - →Senior interviews usually push into query performance, repository structure, permissions, and Cloud Service-safe repository changes
🏗️ What Happens in Real Projects?
Production Usage
JCR is used every time an author creates a page, updates a component dialog, uploads an asset, or publishes a content structure that AEM later renders through Sling. Repository-backed paths also drive queries, permissions, content packages, editable templates, and many operational debugging flows.
For example:
- →Creating
/content/mysite/en/homecreates acq:Pageand ajcr:contentnode - →Dialog values are saved as properties on component content nodes
- →Component definitions and template structures are stored in repository paths such as
/appsand/conf - →Sling Models often read JCR-backed resources and properties during rendering
Where to go next
- →Read
Slingafter JCR so repository structure connects to resource resolution and models - →Read
Client Librariesafter that to connect stored content to frontend delivery - →Use AEM interview prep once you can explain JCR paths, node types, and
sling:resourceTypeclearly
⚙️ How It Works
Node Structure Example:
/content/mysite/en/home <- cq:Page node
jcr:content/ <- cq:PageContent node
jcr:title = "Home"
sling:resourceType = "mysite/components/page/home"
root/ <- nt:unstructured
hero/ <- nt:unstructured (hero component)
sling:resourceType = "mysite/components/hero"
heading = "Welcome"
ctaLabel = "Learn More"Accessing JCR in Code:
// From a Sling Model
@Inject
private Resource resource;
// Get the ValueMap (properties)
ValueMap props = resource.getValueMap();
String title = props.get("jcr:title", "Default Title");
// Navigate to child
Resource hero = resource.getChild("root/hero");
// JCR Session (lower-level)
Session session = resourceResolver.adaptTo(Session.class);
Node node = session.getNode("/content/mysite/en/home");💻 Example
JCR Node Structure — How a typical AEM page looks in the JCR.
🤔 Common Confusions
❓ What is the difference between a Node and a Resource in AEM?
A Node is a JCR concept (lower-level Java API). A Resource is a Sling concept (higher-level). In practice, a Resource wraps a Node and adds Sling-specific behavior. In Sling Models, always use Resource - only drop to Node when you need JCR-specific operations like versioning or locking.
❓ What is the difference between /content, /apps, /conf, and /libs?
/content = your site's pages and assets. /apps = your custom code (components, templates, OSGi configs). /conf = configuration (editable templates, policies, cloud configs). /libs = Adobe's code (never modify directly, overlay instead).
🚨 Common Production Issues
Repository corruption - always use proper JCR transactions and never kill the AEM process mid-write.
Large repository size - unmanaged binary assets or version history growing unbounded. Implement regular datastore garbage collection.
Slow JCR queries - unindexed queries on large repositories. Always create Oak indexes for frequently-used query patterns.
ResourceResolver leaks - custom services open service resolvers and do not close them, eventually causing performance degradation or login failures.
Cloud Service deployment fails because of index or package validation - Oak indexes and repository structure changes must be packaged correctly and deployed through Cloud Manager.
✅ Best Practices
Use ResourceResolver (Sling) instead of JCR Session directly - it's safer and more idiomatic.
Always close ResourceResolver and Session in a finally block to prevent resource leaks.
Create Oak indexes for any JCR query used in production - unindexed queries cause full repository traversal.
Use nt:unstructured for component content nodes - it's flexible and doesn't require schema changes.
Use service users and mapped subservices for background writes; never use admin sessions in modern AEM code.
Keep application data with high write volume outside JCR unless it is truly content-managed data.
🏛️ Architect's Note
Understanding the JCR is non-negotiable for AEM architects. Every design decision - URL structure, content organization, template design - maps directly to JCR node structure.
Key principle: Your JCR structure IS your URL structure (for pages). Plan it carefully upfront. Restructuring the JCR in production is painful.
Performance: The JCR is not a relational database. Don't design data models that require complex joins or full-text searches on large datasets. Use external search engines (Solr, Elasticsearch) for complex search requirements.
💬 Frequently Asked Questions
🎯 Key Takeaways
🔗 Related Topics
🎯 Practice this topic in interviews
↗ Where this topic fits
AEM Technology Guide
Return to the AEM learning hub.
AEM Developer Career Path
This AEM developer career path explains how to become an AEM developer through JCR, Sling, HTL, client libraries, Dispatcher, Cloud Service delivery, project depth, and interview-ready enterprise implementation skills.
Drupal Developer Career Path
A practical route through Drupal content modeling, site building, theming, modules, configuration management, APIs, performance, deployment discipline, and interview preparation.
Sources
Sources / References
Use these AEM references to verify the concept in official docs and continue into the most relevant SplashRide pages.
Official documentation
Related SplashRide pages
SplashRide AEM learning path
Browse the full AEM topic collection and learning order on SplashRide.
AEM Interview Prep
Practice AEM interview questions and scenario-based answers.
AEM Developer Career Path
This AEM developer career path explains how to become an AEM developer through JCR, Sling, HTL, client libraries, Dispatcher, Cloud Service delivery, project depth, and interview-ready enterprise implementation skills.
Drupal Developer Career Path
A practical route through Drupal content modeling, site building, theming, modules, configuration management, APIs, performance, deployment discipline, and interview preparation.
CRXDE Lite
Learn how to use CRXDE Lite — AEM's built-in repository browser and editor — for debugging, exploring, and making quick changes.
Apache Sling
Understand Apache Sling — the web framework that powers AEM's URL resolution, request processing, and resource-centric architecture.