Skip to content

jfols/actio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

218 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actio

Action is everything.

Dependencies

brew install orbstack; # i.e. docker
brew install n;
n latest; # or whatever...?
npm i -g pnpm; # pnpm is the 🐐
cargo install surrealdb-migrations@2.0.0; # TODO: work this into package.json

Get Started

pnpm i
pnpm docker
pnpm dev

Deploy to production

pnpm shipit

Deploy database migration to production

pnpm migrate:production

Python Setup (for embeddings)

To generate embeddings for semantic search:

  1. Install Python 3
brew install python3
  1. Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Run embeddings generation
pnpm py:embed

This will use the SentenceBERT model to generate embeddings for all books and verses, which enables semantic search functionality.

export/import

The seed script is run on pnpm docker and will look for export.surql to use as the initial db. If export.surql is not found, then the seed database is generated with a default user:

{
    email: 'foely.justinj@gmail.com'
    password: 'asdf'
}

Migration

Initial Scaffold

surrealdb-migrations scaffold template empty

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

Initial Fly Setup (Surreal)

mkdir deploy-surreal && cd deploy-surreal

Create Dockerfile (code Dockerfile):

# Dockerfile
FROM surrealdb/surrealdb:latest
EXPOSE 8080
CMD ["start", "--bind", "0.0.0.0:8080", "file://data/srdb.db"]

fly launch --no-deploy

You'll see a message like this. Say less Fly, y.

❯ fly launch --no-deploy
Scanning source code
Detected a Dockerfile app
Creating app in /Users/jfols/repos/actio/deploy-surreal
We're about to launch your app on Fly.io. Here's what you're getting:

Organization: Justin                 (fly launch defaults to the personal org)
Name:         deploy-surreal         (derived from your directory name)
Region:       Ashburn, Virginia (US) (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres:     <none>                 (not requested)
Redis:        <none>                 (not requested)
Sentry:       false                  (not requested)

? Do you want to tweak these settings before proceeding? (y/N)

Accept the defaults on fly.io page that's opened (no Postgres or other add ons).

  • Choose an app name: Choose what you like. It will end up as name.fly.dev, so it must be a unique name.
  • Choose a region: Choose what you like, usually a region close to your users.
  • Setup postgres database?: No, we will persist storage through a volume.
  • Setup upstash redis database?: No, we will persist storage through a volume.
  • Would you like to deploy now?: No, we need to finalize our configuration first.

fly volumes create data --region --size 1

Get the region from the generated fly.toml,(e.g. primary_region = 'iad').

Add [mounts] seciton to fly.toml with the volume name. data is the default volume name, (e.g. Name: data output from creating the volume), change as appropriate if you set a custom name.

[mounts]
  source="data"
  destination="/data"

Set secrets:

fly secrets set SURREAL_USER="root"
fly secrets set SURREAL_PASS="..."
fly secrets set SURREAL_CAPS_ALLOW_ALL="true"

3, 2, 1, 🚀

fly deploy

TODO

Infrastructure

  • CD

Core Features

  • Verse Actions
    • Notes
    • Concepts
    • People (including genealogy)
    • Geography
    • Bible AI Generated:
      • Semantic relationships to concepts and people
      • Semantic groupings of verses by theme
      • Semantic relationships between people and places

Technical Improvements

  • XState Inspector
  • Persisted state with snapshot using Actor.getPersistedSnapshot() (https://stately.ai/docs/persistence)
  • SurrealDB token
    • Better signing management
    • Improved security attributes (SameSite, Secure, HttpOnly)
  • Two-finger scroll by chapter

Testing

  • Unit tests: book machine
  • E2E Tests
    • Account creation/login/logout/password reset
    • Book reading/verse actions
    • Progress tracking on table of contents

About

A Bible reading app. Fuel Your Faith, One Tap at a Time.

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors