A Node based back end for contentjet, a powerful headless API-first CMS. Built with Koa, Objection and PostgreSQL.
Contentjet is composed of 2 discrete applications, the backend API contentjet-api (this repository) and the frontend HTML user interface contentjet-ui.
For more information and hosting documentation please visit contentjet.github.io.
- Node 8+
- NPM 5+
- PostgreSQL 9.5+
npm install
The app is configurable through the use of environment variables. Environment variables can either be exported directly or you may optionally create a .env
file in the root of the repository and specify them there. Note any exported variables will take precedence over those defined in .env
. See dotenv for more details.
For a complete list of all options refer to src/config/index.ts
. While most options have default fallbacks you will need to provide values for the following:
Secret key is used in the hashing of passwords and tokens. You must supply a random string to this value and be sure to keep it secret!
SECRET_KEY=yoursupersecretkey
Database connection settings. Note only PostgreSQL 9.5+ is supported.
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=contentjet-api
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
The application needs to know where it's hosted.
FRONTEND_URL is the url hosting contentjet-ui.
FRONTEND_URL=https://example.com
BACKEND_URL is the url hosting this application (contentjet-api).
BACKEND_URL=https://api.example.com
You MUST provide the following SMTP settings for email sending.
[email protected]
SMTP_HOST=your-smtp-host
SMTP_PORT=your-smtp-host-port
SMTP_USER=your-smtp-user
SMTP_PASSWORD=your-smtp-password
Run the following command to create the required tables in your database.
npm run migrate
You must create at least one administrator user.
npm run create-admin-user
Start the server.
npm run dev