Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Samplestack is a sample application showing how to build a three tier application on MarkLogic. It was released in 2015 on MarkLogic 8 using a Java middle tier and a parallel Node.js stack implementation, with an Angular front end.

As of 2019: While the product team is no longer maintaining the application, the archived repository makes the code available for browsing as a valid reference architecture at a high-level which uses many still relevant features.

Samplestack is a comprehensive sample application that demonstrates how to build an effective MarkLogic application. Based on the idea of a "Question and Answer" website, Samplestack shows you how to integrate MarkLogic into a three-tier application architecture (browser, application server, and database).

README for Version 1.1.0

This application features two middle tiers

  • one for the Java enterprise developer, implemented using Java, Spring and Gradle
  • one for the JavaScript developer, implemented using JavaScript, Node.js and Gulp.

The project includes the following major components:

  • MarkLogic for the database tier
  • MVC browser application implemented in Angular.js
  • Middle-tier REST server implemented in Java/Spring
  • Gradle framework to drive build and configuration of the appserver and database tiers in Java/Groovy
  • Middle-tier REST server implemented in Node.js/Express
  • Gulp-based automation to drive build and configuration of Javascript and database tiers (note: database-tier Gulp-based setup coming soon)
  • Unit and end-to-end tests

This README covers the following topics:

Getting Started

To start, clone this repository. For example, run the following command:

git clone

Then, launch each of the tiers to get a feel for Samplestack's 3-tiered architecture (from the bottom-up):

  1. Database

This version of Samplestack has been tested to run on MarkLogic 8.0-3. Log an issue for questions on compatibility with MarkLogic server versions. Note: There is no direct upgrade path from previous releases. If you had previously been running previous or pre-release version, please perform a full uninstall, including manually deleting data directories, before installing a supported 8.x version for use with Samplestack.

  1. Middle Tier - Application Server

You can choose to run/examine one of two middle tier application servers. Each of these will use the same MarkLogic backend configuration and the same MVC browser application.

Additional Information

For more information, see the following:

Reference Architecture Introduction

Samplestack is an instantiation of MarkLogic’s Reference Architecture. It demonstrates how to structure three-tiered MarkLogic applications for production:

  • MarkLogic plays the role of database in Samplestack’s three-tier architecture. Samplestack shows how to configure MarkLogic to ingest, store, and manipulate documents. With the project comes tooling and configuration files to get MarkLogic primed to expose robust search and data services.

  • The middle tier brokers the data between the database and the browser-based web application, coordinates integration with additional services (LDAP), locally optimizes applicationdatabase communications, and enforces business rules. There will be two versions of Samplestack which you can explore based on your preference. One version features a Java middle tier with a Spring Framework and Gradle automation. There will also be a JavaScriptNode.js implementation with gulp automation.

  • The web-based front-end is a Model-View-Controller browser application which drives workflow using the business services exposed by the middle-tier and presents the user interface. It is implemented as an Angular.js application.

Application Overview

The sample application itself is centered around the idea of a Question and Answer site. It is a searchable, transactional, content-rich web application. Users of the application participate in the crowd-sourced knowledge community by asking questions, submitting answers, commenting, and voting. Search is a rich experience with interactive facets and parameters which enable users to narrow in on the answers they seek. The initial seed dataset is an extract of content from the popular Stack Overflow website. Their archives are made available under CC BY-SA and comprise the seed data for Samplestack.

Each of the features in Samplestack demonstrates an important concept for developers building on MarkLogic:

Samplestack Feature MarkLogic Concept
Full-text Search Indexes, query styles
User records and Question documents Data Model for POJOs and JSON.
Users and Roles (log in, log out) Security (authentication and authorization)
Restricted Content Role-based Permissions
Facets Search constraints, analytics
Ask, Answer, Comment Document updates
Voting Updates impact sorting
Accepted Answers and Reputation Transactional model, data integrity
Related Tags Semantics, using RDF triples and SPARQL


Please see our contributing guidelines.


Samplestack was developed by MarkLogic Engineering and is distributed under the Apache 2.0 license. It is not designed for use in production. Active feedback and questions should be directed to the MarkLogic community on Stack Overflow or refer to the Developer site at


Copyright © 2012-2015 MarkLogic

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.