Coder Social home page Coder Social logo

contentjet / contentjet-api Goto Github PK

View Code? Open in Web Editor NEW
96.0 6.0 6.0 2.06 MB

Headless API-first content management system

Home Page: https://contentjet.github.io/

License: MIT License

TypeScript 98.92% Shell 0.86% Dockerfile 0.22%
headless headless-cms cms api-first-cms rest-api node koa2 objectionjs api

contentjet-api's Introduction

contentjet-api

license

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.

Contentjet

Development

Requirements

  • Node 8+
  • NPM 5+
  • PostgreSQL 9.5+

1. Installation

npm install

2. Configuration

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

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

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

URLs

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

Mail

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

3. Database migration

Run the following command to create the required tables in your database.

npm run migrate

4. Create application administrator

You must create at least one administrator user.

npm run create-admin-user

5. Run

Start the server.

npm run dev

contentjet-api's People

Contributors

contentjet avatar mikeralphson avatar will-fgmnt avatar willdady avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

contentjet-api's Issues

Fetch all entries ( Including Fields ) by entryTypeId

Really like how streamlined this is for a headless API so I started playing around with it.

I'm not sure if this is possible though...

I've been trying to fetch all entries by entryTypeId to then look at their respective fields etc. without hitting the API up numerous times on a single entry call for each respective entryId

I tried /project/1/entry/?entryType=2

To fetch all of entryTypeId === 2, And it returns entries, but those entry blobs do not have the fields that I associated with them when creating entry types.

Right now I am looking at the possibility of pushing all the matching entry ids from that request to /project/1/entry/x Where x is each id I pulled from the previous request, but this would lead to a large amount of API calls on any large scale platform.

Am I missing something?

Endpoint Authentication Configuration

Been playing around for a few hours (you may recall from reddit the guy with the odd docker issue).

Looking at the swagger, I see most of the endpoints require authentication and I cannot see any configuration for this, and while some most certainly should be authenticated, things like Entry and Media at the very least should be auth configurable. In it's current setup this makes it very unsecured to use on a public facing site if I were to want to use this as a replacement for something like a wordpress blog, I would need to hardcode authentication in order to fetch back content.

I would actually be quite happy to help on the UI implementation side of this, when I get my new machine next week will see about setting everything up locally, but great work so far. Definitely the best implementation of a headless CMS I have seen so far.

Make storage engines pluggable

Currently contentjet-api comes with a single storage engine which writes files to disk. This is fine for simple setups but limits the app from scaling horizontally. Need to provide a way to load and configure storage engines for writing to different storage providers such as AWS S3 etc.

Some thoughts which are by no means final:

  • Storage engines should be installable via NPM and adhere to a defined API.
  • Considering the app is distributed via Docker images users would have to npm install inside their container or extend the base image. Is that too hard?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.