/journal

Journaling app based on Hasura & Ionic5

Primary LanguageJavaScript

hasura-demo

This project demonstrates how to build a todo list app using a backend-less setup with Hasura Engine.

If you are eager to see it in action for free, just click the following button:

Open in GitPod

And while you wait for the system to initialize, watch this gif-video to figure out what to expect (roughly):

GitPod Hasura Demo


👉 You can read a more detailed story about the experience of building this here: https://marcopeg.com/2020/hasura-in-gitpod


⭐️ If you enjoy this repo, give me a star!


Quick Start with GitPod

When you click on the "Open in GitPod" button, a new workspace is being created (you may need to grant access via GitHub) and this repository is automatically cloned into it and executed.

It may take a few minutes for the system to correctly start and initialize.

👉 Once ready, you will be prompted with a popup that asks you to open the browser or the preview, go with the preview option and enjoy a new todo list app!

todo

This is NOT just a simple TodoList project, it has to run not one, not two, ... but 6 services in order to give you the ability to create a new todo:

It is so complicated on purpose just to prove the point that it is possible to achieve a "one click startup" environment thanks to GitPod and similar Cloud IDE.

On top of it, this repository is also a personal starting point for other fast-prototyping projects, check out the release versions to try out older (and likely simpler) setups.

Quick Start with Docker

If you prefer to run the application locally, you should clone the repo and then simply run docker-compose up in order to gain:

Running Webpack in Docker is quite a hassle, I strongly suggest to run make start in order to run the entire backend in Docker, but let the host's NodeJS run Webpack and the client app

A Word on Security

This repository is a work in progress meant to provide a starting point to play with Hasura and its data lifecycle best-practices.

The Hasura instance is secured with an admin secret to exploit the possibility of the anonymous role in describing how to access data via GraphQL.

The backend service uses a custom JWT token generated on jwt.io (that expires in a few hundreds years) to perform the data transformation activities.

Enjoy, Marco

Notes

-- before "humble up migrations" drop schema public cascade; create schema public; truncate hdb_catalog.schema_migrations;

-- before restore from production db TRUNCATE public.app_settings RESTART IDENTITY CASCADE; TRUNCATE public.journal_logs RESTART IDENTITY CASCADE; TRUNCATE public.journal_notes RESTART IDENTITY CASCADE; TRUNCATE public.journal_questions RESTART IDENTITY CASCADE; TRUNCATE public.users RESTART IDENTITY CASCADE; TRUNCATE public.users_settings RESTART IDENTITY CASCADE;

-- after restore from production db BEGIN; LOCK TABLE public.journal_notes IN EXCLUSIVE MODE; LOCK TABLE public.journal_questions IN EXCLUSIVE MODE; LOCK TABLE public.users IN EXCLUSIVE MODE; SELECT setval('public.journal_notes_id_seq', COALESCE((SELECT MAX(id)+1 FROM public.journal_notes), 1), false); SELECT setval('public.journal_questions_id_seq', COALESCE((SELECT MAX(id)+1 FROM public.journal_questions), 1), false); SELECT setval('public.users_id_seq', COALESCE((SELECT MAX(id)+1 FROM public.users), 1), false); COMMIT;