Skip to content

Sixtey7/FJ-Backend

Repository files navigation

FJ-Backend

About

Playing with the Helidon MicroProfile framework in order to create a backend for the FinanceJournal frontend that I'll eventually rewrite for the 100th time.

High-Level Design

Java Backend that interfaces with a PostgreSQL database through EclipseLink. Uses the JSONB datatype to store the objects in JSON for the ease of the UI that will eventually exist.

Eventually plan to leverage k8s to deploy several docker containers (Backend, Frontend, Database, whatever else)

Related Projects

FJ-Frontend

Getting Started

Create the Database

  • From the command line, run the command
    • sudo -u postgres createdb fjdb
  • Then create the user by running the command
    • sudo -u postgres createuser -P fjuser
  • Then login as postgres to psql
    • sudo -u postgres psql postgres
  • Run the command
    • GRANT ALL PRIVILEGES ON DATABASE fjdb TO fjuser;
  • Exit the database and log in as fjuser
    • psql -U fjuser fjdb
  • Create the Accounts table
    • CREATE TABLE Accounts (id VARCHAR PRIMARY KEY, name text, amount real, notes text, dynamic boolean);
  • Create the Transactions table
    • CREATE TABLE Transactions (id VARCHAR PRIMARY KEY, account_id VARCHAR, name text, date date, amount real, type text, notes text);
  • Profit!

Build the Service

  • From the command line, run the command
    • gradle build

Build the Service for the pi

  • From the command line, run the command
    • gradle build -Dquarkus.profile=pi

Run the Service

  • From the command line, run the command
    • java -jar build/fj-service-1.0.0-SNAPSHOT-runner.jar

Sample REST Requests

Accounts

Transactions

Docker

Starting postgres

  • docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432 -v /data/postgres:/var/lib/postgresql/data postgres

Build the Container

  • docker build -t fj-backend:latest .

Run the Container

  • docker run --name fj-backend -p 8081:8081 -d fj-backend:latest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors