Skip to content

cbgaindia/budget-basic-strapi

Repository files navigation

Budget Basics Strapi

Part of the Open Budgets India Project


Budget Basics Logo

MIT License

Budget Basics aims to demystify concepts and processes of Government budgets in India. Built as a documentation platform, it provides the content in easily digestible form. This is the back end of the platform built using Strapi CMS. Front end available here.

Visit Budget Basics

Features

  • Fully functional Strapi CMS to be used for documentation/blogging site.
  • Comes preinstalled with all the required content fields.
  • MeiliSearch to make search fast, easy and auto-update using webhooks.
  • Using Enhanced build of CKEditor 5 as the WYSIWYG editor.

For Developers

  • This project uses PostgreSQL as a database but you have multiple options.
  • Front end paradise. Add content fields and create APIs without touching the backend code.
  • Exhaustive documentation provided by Strapi for all of their features and use-cases.

Getting Started

Make sure to have a recent version of Node. You'll need Node 12.x or later. You can find a detailed guide here

Before starting Strapi, you will need to start a PostgreSQL instance.

Postgres

Start by installing Postgres

  sudo apt-get install postgresql 

Start Postgres

  sudo service postgresql start
  sudo -u postgres -i
  psql postgres

Create database

  CREATE DATABASE strapi;

Create user

  CREATE ROLE strapi_user WITH LOGIN PASSWORD 'strapi_pass' CREATEDB;

Grant database access to user

  GRANT ALL PRIVILEGES ON DATABASE strapi TO strapi_user;

Start Strapi

Clone the project

  git clone https://github.com/cbgaindia/budget-basic-strapi.git

Go to the project directory

  cd budget-basic-strapi

Install dependencies

  npm install

Environmental Variables

Create .env file and paste:

HOST=0.0.0.0
PORT=8001
STRAPI_DASHBOARD=/dashboard
STRAPI_JWT_SECRET=supersecurejwtkey
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DATABASE_NAME=strapi
DATABASE_USERNAME=strapi_user
DATABASE_PASSWORD=strapi_pass
DATABASE_SSL=false
💥 Please use more secure keys

Build and start the server in development

  npm run build && npm run develop

or start production mode

  npm run build && npm run start

This will start the server at http://localhost:8001 and Strapi dashboard at http://localhost:8001/dashboard

Meilisearch

We are using Meilisearch to handle search functionality in our project. It is open-source and awesome.

Meilisearch Instance

There are lots of ways to install Meilisearch. I'll go with the fastest one here.

Install MeiliSearch

  curl -L https://install.meilisearch.com | sh

Launch MeiliSearch

  ./meilisearch --http-addr '127.0.0.1:8000' --master-key="mysuperawesomesearchkey"
💥 Please use more secure keys

Now, your Meilisearch instance is running at 127.0.0.1:8000.

Meilisearch on Strapi

This repo already contains the Meilisearch plugin installed. All you need to do is set up your host, api key and select the content type.

  • Go to the Strapi Dashboard http://localhost:8001/dashboard and select Meilisearch under plugins.

  • Add 127.0.0.1:8000 as the Host, mysuperawesomesearchkey as the API Key.

  • Select the topic under the list and click "Reload Server" to set up a webhook.

Now if you go to 127.0.0.1:8000, you will find all the topics (sections) you have created ready to be searched.

Contributing

For any new feature or fixes, please request it in issues or create a new pull request.