Namek / Fundshare

💰 Web-hosted app for sharing expenses - my playground for Elm and F#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fundshare

App for sharing expenses to keep up with the current balance between people.

Fundshare

How to: Build and host

A) Run application with a database using Docker Compose:

  1. Copy Backend/AppConfig.fs__prod to Backend/AppConfig.fs
  2. (optional) Copy Frontend/src/elm/I18n/I18n.elm.template to Frontend/src/elm/I18n/I18n.elm. Edit "import" in copied file to choose localization. Default is EUR.
  3. (optional) you may want to change ports in docker-compose.yml
  4. docker-compose build
  5. docker-compose up -d
  6. http://127.0.0.1:5000 should be available then.

OR

B) Run only the application (no Docker containers):

  1. Copy AppConfig.fs__prod to AppConfig.fs (for security, change Auth.tokenEncryptionKey and Auth.passwordSalt)
  2. (optional) Copy Frontend/src/elm/I18n/I18n.elm.template to Frontend/src/elm/I18n/I18n.elm. Edit "import" in copied file to choose localization. Default is EUR.
  3. Set DB.host = 'host.docker.internal' inside AppConfig.fs
  4. docker build -t fundshare-app
  5. docker run -it -p 127.0.0.1:8080:5000 fundshare-app
  6. http://127.0.0.1:8080 should be available then.

Database

Import

To run .sql file on database docker:

cat dump.sql | docker exec -i fundshare_db_1 psql -U postgres -d fundshare_prod

Create backup

docker exec -t -u postgres fundshare_db_1 pg_dump fundshare_prod -c > /fundshare_backup_dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

How to: Development

Frontend

npm i -g npx
npm i -g @dillonkearns/elm-graphql
dotnet tool install -g dotnet-script

Now you can pick some options:

  • build frontend
  • watch for changes to rebuild
  • rebuild frontend api, i.e. generate Elm code for GraphQL API based on graphql_schema.json (which is generated by backend on start if specific flag is configured in AppConfig.fs)
  • debug to provide Elm's messaging debugger

Usually it goes: dotnet script build.csx -- build debug watch. When GraphQL API is changed in the backend code then run dotnet script build.csx -- api build.

Backend

Ensure the .NET Core 2.1 SDK is installed.

  • To build and publish an executable:

    cd Backend && dotnet publish

  • While developing, you can simply open Backend.sln with Visual Studio 2017 and run in debug mode.

About

💰 Web-hosted app for sharing expenses - my playground for Elm and F#


Languages

Language:Elm 75.6%Language:F# 19.9%Language:C# 2.3%Language:CSS 0.7%Language:JavaScript 0.7%Language:Dockerfile 0.4%Language:HTML 0.3%Language:Batchfile 0.1%