Skip to content

0xAliRaza/wid-blog-backend

Repository files navigation

Write It Down (Backend)

Quick Install (docker) | About | Features | Authors

Docker Build Status Docker Build Automation Status

Also, check out the wid-blog-frontend.

Write It Down - Backend is a free-to-use headless blogging CMS built with Laravel 7.x. It uses JWT for authentication and can be consumed by any frontend. This project was coded for the sole purpose of supporting wid-blog-frontend.

wid-blog-backend preview

About

Write It Down - Backend is a headless blogging CMS which can be used by any kind of frontend be it a SPA, PWA, and just a simple jQuery project that utilizes AJAX. The purpose of its existence is to act as an API for WID-Blog-Frontend.

This project was inspired by Ghost and Medium but it only includes the minimal and most necessary features.

Features

  • Uses tymon\jwt-auth for user Authentication utilizing JSON Web Tokens.

  • Role based authorization based on these three roles:

    • superadmin: Can do all actions such as creating a post (article), a page, adding tags, adding new users or editing existing users and changing blog settings.

    • admin: Can do all the things a superadmin can do but can't create or modify existing superadmins and their posts.

    • editor: Can only show their content, edit their own profile but can't modify or show or modify content of superadmins or admins.

  • All the basic CRUD features of a headless blog including posts, pages, tags, meta-data, users, and images.

Getting Started

These instructions will get you a copy of this project running on your local machine in dev mode.

Using Docker (recommended)

This is the easiest and recommended way because you shall only be required to install the below prerequisites and nothing else.

Prerequisites:

Cloning repository:

Start by cloning the repository on your local machine using git:

git clone https://github.com/0xaliraza/wid-blog-backend

Change directory to the project folder:

cd wid-blog-backend

Setting up Laravel:

Create .env file by running:

cp .env.example .env

Now edit .env file and change DB_ related environment variables by replacing them with following:

DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=wid_blog_backend
DB_USERNAME=<ANY_CUSTOM_USERNAME_HERE>
DB_PASSWORD=<ANY_CUSTOM_PASSWORD_HERE>

Install Composer dependencies:

docker-compose exec app composer install

Generate Laravel application key:

docker-compose exec app php artisan key:generate

Running the laravel migrations:

docker-compose exec app php artisan migrate

Setting up Docker:

Pull all the required docker images:

docker-compose pull

Run Docker Compose:

docker-compose up --d

By now, you should have a running Laravel instance at http://localhost:8000 without any errors.

Also, to your surprise, you'll also get a phpmyadmin instance running at http://localhost:8080 😉 so you can inspect the database and stuff, how cool is that?

Run docker ps to check running docker containers.

Using Laravel Artisan

Prerequisites:

  • Basic knowledge of laravel.

You can use this easy guide to setup this project locally on your machine using Artisan.

Authors

Ali Raza (me) 🙃

Find Me Online

Feel free to contact me for any kind of help or information. Let's get connected! :)

To Do

  • Testing
  • Searching feature
  • CI/CD