Skip to content

Commit ba29b4b

Browse files
authored
Merge pull request #71 from pgulb/19-improve-readme
19 improve readme
2 parents 1cccaed + 14f606d commit ba29b4b

File tree

1 file changed

+85
-5
lines changed

1 file changed

+85
-5
lines changed

README.md

Lines changed: 85 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,95 @@
1-
# flush-log
1+
# Flush Log
2+
Flush Log is Progressive Web App that can be used to track your bowel movements
3+
it is available at https://pgulb.github.io/flush-log/
24

5+
## Why
6+
You can improve your toilet habits, for example reduce time mindlessly scrolling through
7+
Social Media if you see how much time it takes
8+
FL allows you to track stats like time, number/% of times with phone, mean time, mean rating etc
9+
10+
## What is Progressive Web App
11+
In short it's a web app that allows itself to be 'installed' both on desktop and mobile devices
12+
as an app, option to install appears usually at the right side of searchbar, and on mobile
13+
in the three dot menu
14+
15+
PWAs aim to look more like native application than a regular website, they also cache themselves on
16+
user's device to load faster and notify user when an app can be updated
17+
18+
### Initial diagram for how it should work (now slightly modified)
319
<img src="./systems.png" alt="app diagram" align="center"/>
420

5-
## development
21+
## development info
22+
23+
flush-log uses Taskfile (https://taskfile.dev/) to automate commands used to
24+
develop and test its components
25+
Components are:
26+
- PWA (Go + go-app https://go-app.dev/)
27+
- REST API (Python + FastAPI https://fastapi.tiangolo.com/)
28+
- MongoDB (At production it's MongoDB Atlas free tier https://www.mongodb.com/docs/atlas/reference/free-shared-limitations/)
29+
30+
### App server vs static website
31+
Go-app can be compiled to executable to run as a server, or compiled to static content
32+
In production I compile it to static and deploy to Github Pages
33+
Tests and local development is done with server version (pipeline tests with Docker)
34+
35+
---
36+
### List all available tasks
37+
```sh
38+
task
39+
```
40+
---
41+
### Prepare venv
42+
I use uv https://github.com/astral-sh/uv to create venv and install dependencies while developing
43+
Tests are run using venv
44+
```sh
45+
task init-uv-venv
46+
```
47+
---
48+
### Spin up whole stack in Docker locally and watch logs
49+
650
```sh
7-
docker compose up --build
51+
task dev
852
```
953
And go to http://localhost:8080 for hot-reloading app
54+
API is located at http://localhost:6789
55+
and Mongo at mongodb://localhost:27017
1056

1157
---
12-
Run only FastAPI by using:
58+
### Remove containers
59+
```sh
60+
task cleanup
61+
```
62+
---
63+
### API tests
64+
unit
65+
```sh
66+
task test-api-unit
67+
```
68+
mocked
69+
```sh
70+
task test-api-mock
71+
```
72+
with local mongo
73+
```sh
74+
task test-api-integration
75+
```
76+
---
77+
### PWA tests
78+
unit
79+
```sh
80+
task test-pwa-unit
81+
```
82+
integration (with go-rod https://go-rod.github.io/#/)
83+
```sh
84+
task test-pwa-integration
85+
```
86+
integration with visible browser window
1387
```sh
14-
docker compose up flush-api --build
88+
task test-pwa-integration-show-window
1589
```
90+
## Github Workflows
91+
- test-api.yml - run tests for API on each push
92+
- test-pwa.yml - build docker image and run tests for PWA on each push
93+
- publish-api-image.yml - build and publish API docker image after tests complete (on main branch)
94+
- deploy-api.yml - deploy API image after build (currently to VPS through ssh) (on main branch)
95+
- deploy-pwa.yml - build static content and deploy to Github Pages after tests complete (on main branch)

0 commit comments

Comments
 (0)