Skip to content
Angular UI for DSpace 7. See the README below for links to resources and documentation.
Branch: master
Clone or download
tdonohue Merge pull request #424 from 4Science/DSpace#423
Fix issue with getSearchLink
Latest commit e179596 Jun 9, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode initial commit Nov 30, 2016
config Reset URL to use DSpace 7 REST API Demo site. May 17, 2019
docs Set a few configuration options an env variables. May 11, 2018
e2e 56434: e2e test fix Nov 21, 2018
resources Merge pull request #401 from atmire/Group-Entity-Types May 31, 2019
src Fix issue with getSearchLink Jun 8, 2019
webpack replace npm variable with dedicated script to run webpack with a larg… May 17, 2019
.dockerignore expand dockeringore based on gitignore Jul 28, 2018
.editorconfig initial commit Nov 30, 2016
.gitignore Additional IDE generated files ignored Dec 1, 2017
.travis.yml Removed call to global script from travis setup May 29, 2019
Dockerfile fix base image name Jul 27, 2018 update requirement versions in docs May 17, 2019
angular.json another intermediate commit Sep 6, 2018
app.yaml dependency upgrades, server and platform module updates, linting wip Jul 12, 2017
karma.conf.js test fixes Mar 15, 2018
nodemon.json added tests for new HostWindowService code Apr 26, 2018
package.json Bump webpack-bundle-analyzer from 2.13.1 to 3.3.2 May 30, 2019
postcss.config.js dependency upgrades, server and platform module updates, linting wip Jul 12, 2017
protractor.conf.js Run Travis using headless Chrome addon Nov 28, 2017
rollup.config.js updated angular/rxjs to v6 successfully Aug 31, 2018
spec-bundle.js upgrade to angular6 Aug 24, 2018
tsconfig.json Test to fix travis build issue May 24, 2018
tslint.json 55143: fixed all tests Oct 11, 2018
typedoc.json dependency upgrades, server and platform module updates, linting wip Jul 12, 2017
webpack.config.js resolved PR feedback Nov 20, 2018
yarn.lock Bump webpack-bundle-analyzer from 2.13.1 to 3.3.2 May 30, 2019

Build Status Coverage Status Universal Angular


The next UI for DSpace, based on Angular Universal.

This project is currently in pre-alpha.

You can find additional information on the wiki or the project board (

If you're looking for the 2016 Angular 2 DSpace UI prototype, you can find it here

Quick start

Ensure you're running Node >= v8.0.x, npm >= v5.x and yarn >= v1.x

# clone the repo
git clone

# change directory to our repo
cd dspace-angular

# install the local dependencies
yarn install

# start the server
yarn start

Then go to http://localhost:3000 in your browser

NOTE: currently there's not much to see at that URL. We really do need your help. If you're interested in jumping in, and you've made it this far, please look at the the project board (, grab a card, and get to work. Thanks!

Not sure where to start? watch the training videos linked in the Introduction to the technology section below.

Table of Contents

Introduction to the technology

You can find more information on the technologies used in this project (Angular 2, Typescript, Angular Universal, RxJS, etc) on the DuraSpace wiki


  • Node.js, npm, and yarn
  • Ensure you're running node >= v8.x, npm >= v5.x and yarn >= v1.x

If you have nvm or nvm-windows installed, which is highly recommended, you can run nvm install --lts && nvm use to install and start using the latest Node LTS.


  • yarn run global to install the required global dependencies
  • yarn install to install the local dependencies


Default configuration file is located in config/ folder.

To change the default configuration values, create local files that override the parameters you need to change:

  • Create a new file in config/ for devel environment;
  • Create a new file in config/ for production environment;

To use the configuration parameters in your component:

import { GLOBAL_CONFIG, GlobalConfig } from '../config';

constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig) {}

Running the app

After you have installed all dependencies you can now run the app. Run yarn run watch to start a local server which will watch for changes, rebuild the code, and reload the server for you. You can visit it at http://localhost:3000.

Running in production mode

When building for production we're using Ahead of Time (AoT) compilation. With AoT, the browser downloads a pre-compiled version of the application, so it can render the application immediately, without waiting to compile the app first. The compiler is roughly half the size of Angular itself, so omitting it dramatically reduces the application payload.

To build the app for production and start the server run:

yarn start

If you only want to build for production, without starting, run:

yarn run build:prod

This will build the application and put the result in the dist folder


# clean everything, including node_modules. You'll need to run yarn install again afterwards.
yarn run clean

# clean files generated by the production build (.ngfactory files, css files, etc)
yarn run clean:prod

# cleans the distribution directory
yarn run clean:dist


Test a Pull Request

If you would like to contribute by testing a Pull Request (PR), here's how to do so. Keep in mind, you do not need to have a DSpace backend / REST API installed locally to test a PR. By default, the dspace-angular project points at our demo REST API

  1. Pull down the branch that the Pull Request was built from. Easy instructions for doing so can be found on the Pull Request itself.
    • Next to the "Merge" button, you'll see a link that says "command line instructions".
    • Click it, and follow "Step 1" of those instructions to checkout the pull down the PR branch.
  2. yarn run clean (This resets your local dependencies to ensure you are up-to-date with this PR)
  3. yarn install (Updates your local dependencies to those in the PR)
  4. yarn start (Rebuilds the project, and deploys to localhost:3000, by default)
  5. At this point, the code from the PR will be deployed to http://localhost:3000. Test it out, and ensure that it does what is described in the PR (or fixes the bug described in the ticket linked to the PR).

Once you have tested the Pull Request, please add a comment and/or approval to the PR to let us know whether you found it to be successful (or not). Thanks!

Unit Tests

Unit tests use Karma. You can find the configuration file at the same level of this README file:./karma.conf.js If you are going to use a remote test enviroment you need to edit the ./karma.conf.js. Follow the instructions you will find inside it. To executing tests whenever any file changes you can modify the 'autoWatch' option to 'true' and 'singleRun' option to 'false'. A coverage report is also available at: http://localhost:9876/ after you run: yarn run coverage.

To correctly run the tests you need to run the build once with: yarn run build.

The default browser is Google Chrome.

Place your tests in the same location of the application source code files that they test.

and run: yarn run test

E2E test

E2E tests use Protractor + Selenium server + browsers. You can find the configuration file at the same level of this README file:./protractor.conf.js Protractor is installed as 'local' as a dev dependency.

If you are going to use a remote test enviroment you need to edit the './protractor.conf.js'. Follow the instructions you will find inside it.

The default browser is Google Chrome.

Protractor needs a functional instance of the DSpace interface to run the E2E tests, so you need to run:yarn run watch

or any command that bring up the DSpace interface.

Place your tests at the following path: ./e2e

and run: yarn run e2e

Continuous Integration (CI) Test

To run all the tests (e.g.: to run tests with Continuous Integration software) you can execute:yarn run ci Keep in mind that this command prerequisites are the sum of unit test and E2E tests.


To build the code documentation we use TYPEDOC. TYPEDOC is a documentation generator for TypeScript projects. It extracts informations from properly formatted comments that can be written within the code files. Follow the instructions here to know how to make those comments.

Run:yarn run docs to produce the documentation that will be available in the 'doc' folder.


# deploy production in standalone pm2 container
yarn run deploy

# remove production from standalone pm2 container
yarn run undeploy

Other commands

There are many more commands in the scripts section of package.json. Most of these are executed by one of the commands mentioned above.

A command with a name that starts with pre or post will be executed automatically before or after the script with the matching name. e.g. if you type yarn run start the prestart script will run first, then the start script will trigger.

Recommended Editors/IDEs

To get the most out of TypeScript, you'll need a TypeScript-aware editor. We've had good experiences using these editors:


See the guide on the wiki

File Structure

├──                                           * This document
├── app.yaml                                            * Application manifest file
├── config                                              * Folder for configuration files
│   ├── environment.default.js                          * Default configuration files
│   └── environment.test.js                             * Test configuration files
├── docs                                                * Folder for documentation
├── e2e                                                 * Folder for e2e test files
│   ├── app.e2e-spec.ts                                 *
│   ├── app.po.ts                                       *
│   ├── pagenotfound                                    *
│   │   ├── pagenotfound.e2e-spec.ts                    *
│   │   └── pagenotfound.po.ts                          *
│   └── tsconfig.json                                   * TypeScript configuration file for e2e tests
├── karma.conf.js                                       * Karma configuration file for Unit Test
├── nodemon.json                                        * Nodemon ( configuration
├── package.json                                        * This file describes the npm package for this project, its dependencies, scripts, etc.
├── postcss.config.js                                   * PostCSS ( configuration file
├── protractor.conf.js                                  *
├── resources                                           * Folder for static resources
│   ├── data                                            * Folder for static data
│   │   └── en                                          * Folder for i18n English data
│   ├── i18n                                            * Folder for i18n translations
│   │   └── en.json                                     * i18n translations for English
│   └── images                                          * Folder for images
│       ├── dspace-logo-old.png                         *
│       ├── dspace-logo.png                             *
│       └── favicon.ico                                 *
├── rollup.config.js                                    * Rollup ( configuration
├── spec-bundle.js                                      *
├── src                                                 * The source of the application
│   ├── app                                             *
│   │   ├── app-routing.module.ts                       *
│   │   ├── app.component.html                          *
│   │   ├── app.component.scss                          *
│   │   ├── app.component.spec.ts                       *
│   │   ├── app.component.ts                            *
│   │   ├── app.effects.ts                              *
│   │   ├── app.module.ts                               *
│   │   ├── app.reducer.ts                              *
│   │   ├── browser-app.module.ts                       * The root module for the client
│   │   ├── +collection-page                            * Lazily loaded route for collection module
│   │   ├── +community-page                             * Lazily loaded route for community module
│   │   ├── core                                        *
│   │   ├── header                                      *
│   │   ├── +home                                       * Lazily loaded route for home module
│   │   ├── +item-page                                  * Lazily loaded route for item module
│   │   ├── object-list                                 *
│   │   ├── pagenotfound                                *
│   │   ├── server-app.module.ts                        * The root module for the server
│   │   ├── shared                                      *
│   │   ├── store.actions.ts                            *
│   │   ├── store.effects.ts                            *
│   │   ├── thumbnail                                   *
│   │   └── typings.d.ts                                * File that allows you to add custom typings for libraries without TypeScript support
│   ├── backend                                         * Folder containing a mock of the REST API, hosted by the express server
│   │   ├── api.ts                                      *
│   │   ├── cache.ts                                    *
│   │   ├── data                                        *
│   │   └── db.ts                                       *
│   ├── config                                          *
│   │   ├── cache-config.interface.ts                   *
│   │   ├── config.interface.ts                         *
│   │   ├── global-config.interface.ts                  *
│   │   ├── server-config.interface.ts                  *
│   │   └── universal-config.interface.ts               *
│   ├── config.ts                                       * File that loads environmental and shareable settings and makes them available to app components
│   ├── index.csr.html                                  * The index file for client side rendering fallback
│   ├── index.html                                      * The index file
│   ├── main.browser.ts                                 * The bootstrap file for the client
│   ├── main.server.ts                                  * The express ( config and bootstrap file for the server
│   ├── modules                                         *
│   │   ├── cookies                                     *
│   │   ├── data-loader                                 *
│   │   ├── transfer-http                               *
│   │   ├── transfer-state                              *
│   │   ├── transfer-store                              *
│   │   └── translate-universal-loader.ts               *
│   ├── routes.ts                                       * The routes file for the server
│   ├── styles                                          * Folder containing global styles
│   │   ├── _mixins.scss                                *
│   │   └── variables.scss                              * Global sass variables file
│   ├── tsconfig.browser.json                           * TypeScript config for the client build
│   ├── tsconfig.server.json                            * TypeScript config for the server build
│   └── tsconfig.test.json                              * TypeScript config for the test build
├── tsconfig.json                                       * TypeScript config
├── tslint.json                                         * TSLint ( configuration
├── typedoc.json                                        * TYPEDOC configuration
├── webpack                                             * Webpack ( config directory
│   ├── helpers.js                                      *
│   ├── webpack.aot.js                                  * Webpack ( config for AoT build
│   ├── webpack.client.js                               * Webpack ( config for client build
│   ├── webpack.common.js                               *
│   ├──                                 * Webpack ( config for production build
│   ├── webpack.server.js                               * Webpack ( config for server build
│   └── webpack.test.js                                 * Webpack ( config for test build
├── webpack.config.ts                                   *
└── yarn.lock                                           * Yarn lockfile (

3rd Party Library Installation

Install your library via yarn add lib-name --save and import it in your code. --save will add it to package.json.

If the library does not include typings, you can install them using yarn:

yarn add d3
yarn add @types/d3 --dev

If the library doesn't have typings available at @types/, you can still use it by manually adding typings for it:

  1. In src/typings.d.ts, add the following code:

      declare module 'typeless-package';
  2. Then, in the component or file that uses the library, add the following code:

      import * as typelessPackage from 'typeless-package';

Done. Note: you might need or find useful to define more typings for the library that you're trying to use.

If you're importing a module that uses CommonJS you need to import as

import * as _ from 'lodash';

Managing Dependencies (via yarn)

This project makes use of yarn to ensure that the exact same dependency versions are used every time you install it.

  • yarn creates a yarn.lock to track those versions. That file is updated automatically by whenever dependencies are added/updated/removed via yarn.
  • Adding new dependencies: To install/add a new dependency (third party library), use yarn add. For example: yarn add some-lib.
    • If you are adding a new build tool dependency (to devDependencies), use yarn add some-lib --dev
  • Upgrading existing dependencies: To upgrade existing dependencies, you can use yarn upgrade. For example: yarn upgrade some-lib or yarn upgrade some-lib@version
  • Removing dependencies: If a dependency is no longer needed, or replaced, use yarn remove to remove it.

As you can see above, using yarn commandline tools means that you should never need to modify the package.json manually. We recommend always using yarn to keep dependencies updated / in sync.

Further Documentation

See ./docs for further documentation.

Frequently asked questions

  • Why is my service, aka provider, is not injecting a parameter correctly?
    • Please use @Injectable() for your service for typescript to correctly attach the metadata
  • Where do I write my tests?
    • You can write your tests next to your component files. e.g. for src/app/home/home.component.ts call it src/app/home/home.component.spec.ts
  • How do I start the app when I get EACCES and EADDRINUSE errors?
    • The EADDRINUSE error means the port 3000 is currently being used and EACCES is lack of permission to build files to ./dist/
  • What are the naming conventions for Angular 2?
  • Why is the size of my app larger in development?
    • The production build uses a whole host of techniques (ahead-of-time compilation, rollup to remove unreachable code, minification, etc.) to reduce the size, that aren't used during development in the intrest of build speed.
  • node-pre-gyp ERR in yarn install (Windows)
    • install Python x86 version between 2.5 and 3.0 on windows. See this issue
  • How do I handle merge conflicts in yarn.lock?
    • first check out the yarn.lock file from the branch you're merging in to yours: e.g. git checkout --theirs yarn.lock
    • now run yarn install again. Yarn will create a new lockfile that contains both sets of changes.
    • then run git add yarn.lock to stage the lockfile for commit
    • and git commit to conclude the merge


You can’t perform that action at this time.