Sample TODO app, based on Vue3 https://basebox.io
Go to file
2023-04-04 18:34:26 +02:00
bbconf allow introspection 2023-04-03 12:19:20 +02:00
public WIP; Vue3 project tree 2023-02-28 13:57:31 +01:00
src updated bb compilation, various improvements 2023-03-27 20:30:37 +02:00
.gitignore WIP; Vue3 project tree 2023-02-28 13:57:31 +01:00
index.html WIP... 2023-03-15 17:57:12 +01:00
package-lock.json fixed request syntax 2023-03-16 07:44:05 +01:00
package.json WIP... 2023-03-15 17:57:12 +01:00
README.md README update 2023-04-04 18:34:26 +02:00
vite.config.js WIP; Vue3 project tree 2023-02-28 13:57:31 +01:00

basebox Sample: TODO App

This project implements the Hello World of API-driven apps: a simple TODO app, built with Vue 3.

The bbconf folder contains basebox config files, database schema, type maps etc. and scripts to run broker and dbproxy from within the bbconf directory.

These files assume that you extracted the basebox distribution next to this repository's root.

Example:
Let's assume you create a basebox folder in your home directory, change into it, extract the basebox distribution archive in that folder and then clone the contents of this repository into the same folder:

cd ~
mkdir basebox
cd basebox
tar xf basebox-version-arch.tgz  # adopt this command to the basebox distribution archive you downloaded
git clone --single-branch --depth 1 https://gitea.basebox.health/samples/vue-todo.git

If you follow these steps, the scripts in bbconf will work out of the box.

Installation

To install this app, you need

  • npm, node.js
  • A PostgreSQL server, preferably on the local host (simpler, but not suitable for production)
  • basebox components (broker, dbproxy, bbc)
  • Keycloak

PostgreSQL Preparation

The following guide assumes you are installing under Debian or Ubuntu Linux; if you are on a Mac, please see our PostgreSQL Primer for some hints.

You need to create a user and a database for the todo app.

Please note:

The recommended way to run basebox is to have a dedicated Unix user for dbproxy that authenticates to PostgreSQL using Peer authentication. This way, no password for the DB user has to be stored anywhere. The Unix user's name must match the name of the PostgreSQL user. For more info, see the basebox installation instructions and PostgreSQL documentation.

For simplicity's sake, we are using a normal PostgreSQL user that authenticates using md5 authentication, thus requires a password, which is set in the dbproxy configuration file.

# Under (Debian) Linux, switch to the postgres user first:
# sudo su postgres
createuser -DRP bb_todo  # default password: basebox
createdb -O bb_todo bb_todo

Tell PostgreSQL that the bb_todo user connects to the database using md5 authentication. To do so, edit /etc/postgresql/<PostgreSQL version>/main/pg_hba.conf (on Debian based Linux systems) to contain the following:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   bb_todo         bb_todo                                 md5

Make sure to add the line that starts with local bb_todo... under the commented header that starts with # TYPE.... PostgreSQL uses the first line that matches, so having the new line on top makes sure no other line overrides it.

Reload PostgreSQL config:

systemctl postgresql reload

Database Schema

This repository contains an already compiled SQL file that creates the database schema:

psql -U bb_todo bb_todo < bbconf/todo_datamodel.sql  # Enter password when prompted.

The database configuration and installation is now complete.