2.4 KiB
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.
Recommended IDE Setup
VSCode + Volar (and disable Vetur)
Installation
To install this app, you need
- npm, node.js
- A PostgreSQL server, preferably on the local host (simpler)
- basebox components (broker, dbproxy, bbc)
- Keycloak
PostgreSQL Preparation
You need to create a user and a database for the todo app. 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.
´´´sh
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:
```conf
# TYPE DATABASE USER ADDRESS METHOD
local bb_todo bb_todo md5
Reload PostgreSQL config:
systemctl postgresql reload
If PostgreSQL is older than version 13, you need to enable the crypto extension explicitly:
# Under (Debian) Linux, switch to the postgres user first:
# sudo su postgres
psql bb_todo
# At the # bb_todo prompt:
SELECT gen_random_uuid();
# If this prints a UUID, you're ok. If you get an error, do this:
CREATE EXTENSION pgcrypto;
# Might try the SELECT call again.
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