ketchuphq / ketchup

A simple CMS :tomato:
https://ketchuphq.com
Apache License 2.0
394 stars 32 forks source link
cms go react typescript

Ketchup

Go Report Card Coverage Status CircleCI

Ketchup is a developer-first CMS.

Table of contents

Usage

This readme will focus on how to build and develop Ketchup.

Development

1. Getting started

These instructions assume you're using OS X, but they should work on Linux as well. The only exception to this is that Homebrew is used to install protoc on OS X. You won't need protoc unless you're planning to modify the API (see the Protobuf section below).

To get started, you’ll first need to install the following dependencies, which are used to compile the backend and frontend respectively.

Then, run the following to download frontend and backend dependencies:

make prepare

2. Compiling

Now you should be able to compile the ketchup binary:

make

This will first run the frontend compilation (a Gulp task), then embed the frontend assets into admin/bindata.go, and finally run go build. The result will be a ketchup binary in the top-level.

If you want to modify the API, see below for instructions for how to update the proto files and regenerate the corresponding Go structs and Typescript classes.

Watching

For ongoing development, it can be a hassle to keep recompiling. There's a gulp watch task which you can run in the admin folder to recompile Typescript and SASS and output bindata.go on changes to frontend code. See admin/README.md for more details.

For backend code, there's ./scripts/dev-watch.sh, which will start a Ketchup server and recompile+restart it on changes to .go files.

3. Development

Protobuf API

Protobufs are used to describe the API as well as being the serialization for data stored in BoltDB.

To change the API, you’ll need to install the protobuf compiler, protoc. If you have Homebrew, running make prepare-protos will install it using brew, as well as a custom plugin for generating Go output.

You should never edit *.pb.go and ./admin/src/js/lib/api.ts directly. Instead, you should edit the relevant .proto protobuf file, and then regenerate those files:

make protos

After regenerating, you can recompile the frontend and backend to view your changes.

4. Releasing new versions

This section is for completeness; you probably won't have to do this.

make release-nr # dry run, only outputs to ./dist

# tag a release, goreleaser uses the latest tag
git tag -a v0.3.0 && git push origin v0.3.0
make release

Ketchup uses goreleaser to create and release new builds. The goreleaser.yml config file is dynamically generated in order to interpolate $GOPATH into the config, which is used to remove the $GOPATH that would otherwise appear in stack traces.

The version of the release is read from the latest git tag.

Extending Ketchup

This is a work in progress. The long-term goal is to make it easy to swap out, configure, or add modules, using a custom main.go file. The following features are intended to be pluggable:

The module system is documented here.

Architectural decisions

A brief run through of the things without which this project would not exist:

Changelog

0.3.0 - Relaxed React

0.2.0 - Tranquil Themes

Major changes

0.1.0 - Initial Release!

License

ASLv2