Urchin 🐚

Urchin is a headless CMS (Content Management System) written in Golang, designed to be fast, efficient, and easily extensible. It allows you to create a website or blog, with any template you like, in only a few commands.

Perhaps the best feature of Urchin is its ability to run on very low powered machines. The example website is hosted on the cheapest VM on cloud providers, costing me about 7 dollars a month for the full stack!

Really no head?

Features 🚀

Configuration

Urchin is composed by two different apps:

The entire configuration of Urchin is in a single toml file, which you can pass to both applications with --config.

The example config provided in urchin_config.toml can be used as the primary source of documentation, but the sections below explain their purpose.

Database Configuration

Configurations Related to the database connection, which are used to construct the database connection string. These must be provided to properly run both apps.

Core Configurations

These are configurations for the core running of the application. These must be provided to run Urchin smoothly.

Optional Configurations

Recaptcha Configurations

Urchin supports reCaptcha for the contact form. If these configurations are provided, recaptcha will be enabled for form submission.

You can customise the navbar with links and dropdowns. Refer to the [navbar] sections in the urchin_config.toml file for references. But you can currently:

You can create custom ggallery information from images stored in images_dir. These must have accompanying .json metadata files, which you can find examples of in images directory of this repo.

For how to set this up, please refer to urchin_config.toml.

Running Urchin

Urchin is developed with Golang, so make sure you have a recent enough version of the compiler and you also follow the instructions in the following sections.

Build Requirements

If you’re runnig Urchin locally, you should install all the requirements needed to build the application. Here’s a non-exhaustive list of the important build dependencies:

Ensure that you have the binaries in the $GOBIN directory somewhere in your path, so you can call these tools from the terminal.

Alternatively, if your platform supports make, run the following command from the project repo:

make install-tools

Database

Go uses a MySql / MariaDB database to keep the posts, pages, and cards. Make sure you have it installed locally if you want to debug the project. Alternatively you can use the docker compose setup provided!

Database Migrations

Once the requirements are installed, make sure you run the Goose migrations for the database. We recommend creating a database called urchin and running the following command:

cd migrations
GOOSE_DRIVER="mysql" GOOSE_DBSTRING="root:root@/urchin" goose up

Replace the database connection string with the appropriate string dependending on where your database is.

After you’ve replaced the default template files with your prefered template, simply build and start the app with the following commands.

Building and Running Urchin

If your platform has support for Makefiles, simply call make:

make build
./tmp/urchin --config urchin_config.toml

This will start Urchin on http://localhost:8080. You can change the configuration by editing the urchin_config.toml file.

For more information, see the configuration settings.

Running with Docker Compose

To run with docker-compose, use the following command:

docker-compose -f docker/docker-compose.yml up

This will start two containers: one containing the urchin app, serving on port 8080, and another one serving the mariadb database internally. This will also run the migrations automatically to setup the database!

Development

If you want to debug the application, you can use docker compose to startup just the mariadb container, then hook Urchin to your favourite debugger (e.g. Vscode).

To startup the mariadb database, run the following command from the project root:

docker compose -f docker/mariadb.yml up

Wait a little bit for the database container to start, then run the migration steps:

cd migrations
GOOSE_DRIVER="mysql" GOOSE_DBSTRING="root:root@/urchin" goose up

Once the database is up and migrated, you can run Urchin with your favourite debugger setup. For the Vscode and delve setup, we have provided the file .vscode/launch.json so you should just be able to select the (admin) app from the Vscode debugging dropdown.

Architecture

Currently, the architecture of urchin is still in its early days. The plan is to have two main applications: the public facing application to serve the content through a website, and the admin application that can be hidden, where users can modify the settings, add posts, pages, etc.

diagram of urchin’s architecture

In the above image, you can see the two applications running alongside, and they share a database connection where the data is actually stored. The list below explains some of the data intended to be stored in the database:


Other Posts

My Very First Post

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sed auctor neque, in interdum nisi. Duis pulvinar risus eu placerat feugiat. Morbi blandit bibendum molestie.

Read More

Urchin Guide!

This is Urchin! This is a short guide on how you can build, configure, and run Urchin.

Read More