# Setting up

# System requirements

Software Minimum Version
Node.js (opens new window) 12.x+
MongoDB (opens new window) 3.6+
ImageMagick (opens new window) (optional) Any

See the links above to install each. To check that these are installed in your environment, try the following commands:

node -v && npm -v
# This will display your Node.js version and npm version (installed with Node),
# if installed.
mongod --version
# This will display your MongoDB version, if installed.
which convert && which identify
# This will display the location of the ImageMagick utilities, if installed.

NOTE

ImageMagick is optional, but recommended. It provides the convert and identify command line tools, which Apostrophe uses to scale and crop images quickly. If you do not install it Apostrophe can still handle image uploads, though more slowly.

# The Apostrophe CLI tool

There is an official CLI (opens new window) for quickly setting up starter code for your Apostrophe project. Once in a project it can also help add new module code with a single command so you can focus on the unique parts rather than copying or remembering boilerplate. Keep an eye out for updates once it is installed since it will continue to evolve to help with additional tasks.

Install the CLI tool:

npm install -g @apostrophecms/cli
# Or `yarn install`, if you prefer. We'll stick to npm commands.

Once installed you have access to the apos command. Simply use that command, or apos --help, to see a list of additional commands anytime.

The CLI is not required to work with Apostrophe. It primarily makes developing with Apostrophe faster and takes care of the more repetitive tasks during development.

# Creating a project

The easiest way to get started with Apostrophe is to use the official starter project. If you have the CLI installed, go into your normal projects directory and use the command:

apos create apos-app

Or without the CLI, clone the boilerplate:

git clone https://github.com/apostrophecms/a3-boilerplate apos-app

If you want to change the project directory name, please do so. We will continue referring to apos-app.

Open the app.js file in the root project directory. Find the shortName setting and change it to match your project (only letters, digits, hyphens and/or underscores). This will be used as the name of your database.

// app.js
require('apostrophe')({
  shortName: 'apos-app', // 👈
  modules: {
  // ...

You should also update the session secret for Express.js (opens new window) to a unique, random string. The starter has a placeholder for this option already. If you do not update this, you will see a warning each time the app starts up.

// modules/@apostrophecms/express/index.js
module.exports = {
  options: {
    session: {
      // If this still says `undefined`, set a real secret!
      secret: undefined
    }
  }
};

Excellent! Back in your terminal we'll install dependencies:

npm install

Before starting up you'll need to create an admin-level user so that you can log in. After running the following command, Apostrophe will ask you to enter a password for this user.

node app @apostrophecms/user:add my-user admin
# Replace `my-user` with the name you want for your first user.

Start the site with npm run dev. The app will then watch for changes in client-side code, rebuilds it, then refresh the browser when it detects any. You can log in with the username and password you created at http://localhost:3000/login (opens new window).

TIP

If you are starting the site in a production environment or do not want the process to watch for changes, start the site with node app.js.

# Next steps

Now that Apostrophe is installed, you're ready to start building. Check out the essentials guide to learn about essential features or read more about Apostrophe's inner workings in the technical overview.