Setup Development Environment

In order to work on the API, you'll need to install the source version locally. The application sourcecode is being hosted in the directus/api repo on GitHub.

Requirements

  • A HTTP Web Server that supports URL rewrites
    • Comes with .htaccess included for Apache
  • MySQL 5.2+
    • Database (empty or existing)
    • Database User (with access to database)
  • PHP 7.1+
    • pdo + mysql
    • curl
    • gd
    • fileinfo
    • mbstring
    • xml (Only if you are installing phpunit)
  • Node.js v8.11.3 or higher (preferably v10.6+)
  • Git to fetch the source code from GitHub
  • Composer to install dependencies

Setup Steps

1. Clone the repo

Clone the repo by running

git clone https://github.com/directus/api.git

OR

git clone git@github.com:directus/api.git

Fork

If you want to work on your fork of the project, remember to replace directus with your GitHub username in the url above

2. Install the Composer dependencies

composer install

If you don't want to install any development package use the --no-dev option.

composer install --no-dev

3. Install the npm dependencies of and build the extensions

cd extensions
npm install
npm run build

Development mode

Just like the app, if you'd like to actively work on Extensions, use npm run dev instead of npm run build.

4. Create a database

On your local server, create a new database to use with the API.

Boilerplate SQL

If you'd rather skip the installer (next step), you can simply import the boilerplate schema file from the included schema.sql file.

Demo SQL

This file comes with the boilerplate schema as well as some dummy collections, fields, data, and Settings. You can download a demo SQL schema to skip the API's installation process.

Credentials

If you are skipping the installer and adding the SQL directly to your database, the default login credentials are:

  • User: admin@example.com
  • Password: password

5. Config File Installer

The API uses a config file to know which database to connect to. Copy or rename the /config/api_sample.php file to /config/api.php (default project) and edit the settings as indicated.

Learn more about configuring the API

Last Updated: 11/16/2018, 3:32:03 PM