Sample TODO app, based on Vue3 https://basebox.io
Go to file
2023-04-04 20:02:06 +02:00
bbconf updated shell scripts to use binaries 2023-04-04 20:02:06 +02:00
public WIP; Vue3 project tree 2023-02-28 13:57:31 +01:00
src basebox.tech -> basebox.io 2023-04-04 19:41: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 updated shell scripts to use binaries 2023-04-04 20:02:06 +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, GraphQL schema, precompiled 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 xzf 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

You need a PostgreSQL database to run this app. You can read detailed instructions on how to install PostgreSQL and create a test database at our PostgreSQL Primer page.

The recommended way to run basebox is to have a dedicated Unix user for basebox that authenticates to PostgreSQL using Peer authentication. This way, no password for the DB user has to be stored anywhere.
However, to keep things simple for the test app, we create a local user that authenticates to the database server via password (md5).

Let's create a PostgreSQL user and database for the TODO app:

# 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.

If you're curious, you can recompile the GraphQL schema like so:

bin/bbconf --prefix=bb_todo -f todo_schema.graphql -o bbconf