initial commit of some ideas, with original tutorial data, to be replaced

This commit is contained in:
Dave Lane 2023-11-27 22:25:36 +13:00
parent 035737c993
commit f4340a5b8c
5 changed files with 129 additions and 0 deletions

6
.env Normal file
View file

@ -0,0 +1,6 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
DB_ANON_ROLE=anon
DB_SCHEMA=public

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.backup

41
RoadMap Normal file
View file

@ -0,0 +1,41 @@
# Roadmap
## Functionality
For a given Mastodon user, periodically request the list of followed and
followers including number of each and the user
## Authentication
A Mastodon user uses the app to specify a Mastodon handle and server. On
request, the user authorises the app, returning the user to app which then
starts to process data, creating the starting point.
## Data Objects for a user
* Followers: a record of each follower including address (@handle@server), full name, and date of follow
(addition?) and unfollow (if any).
* Posts: a record of each post including id, timestamp, and (sanitised?) content
* Boosts: a record of each boost, user, post id, number users followers
* Likes: a record of each like, user, post id
* Mentions: a record of each mention including post ID
### Derived Data
* current number of followers
* servers with followers
* new followers in past period (hour, day, week)
* lost followers in past period (hour, day, week)
* most boosted post
* most liked post
* post seen by most people (boosts * number of followers of each booster)
## Development Technologies
My goal with this app is to exercise some technologies I've long wanted to get
experience with:
- Svelte
- SvelteKit
- PostgREST (PostgreSQL + a REST framework)

View file

@ -0,0 +1,15 @@
version: '3'
services:
##############
# swagger-ui #
##############
swagger-ui:
container_name: swagger-ui
image: swaggerapi/swagger-ui:latest
ports:
- "127.0.0.1:8085:8080"
environment:
- API_URL=http://localhost:3000/
restart: unless-stopped

66
docker-compose.yml Normal file
View file

@ -0,0 +1,66 @@
version: '3'
services:
################
# postgrest-db #
################
postgrest-db:
container_name: postgrest-db
image: postgres:alpine
ports:
- "127.0.0.1:5432:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- DB_ANON_ROLE=${DB_ANON_ROLE}
- DB_SCHEMA=${DB_SCHEMA}
volumes:
# anything in initdb directory is created in the database
# see "How to extend this image" section at https://hub.docker.com/r/_/postgres/
- ".config/initdb:/docker-entrypoint-initdb.d"
networks:
- postgrest-backend
restart: unless-stopped
##################
# postgrest-demo #
##################
postgrest-demo:
container_name: postgrest-demo
image: nginx:mainline-alpine
ports:
- "127.0.0.1:8084:80"
volumes:
# anything in html directory is hosted via nginx
- ".demo/html:/usr/share/nginx/html"
restart: unless-stopped
#############
# postgrest #
#############
postgrest:
container_name: postgrest
image: postgrest/postgrest:latest
ports:
- "127.0.0.1:3000:3000"
# Available environment variables documented here:
# https://postgrest.org/en/latest/configuration.html#environment-variables
environment:
# The standard connection URI format, documented at
# https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING
- PGRST_DB_URI=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgrest-db:5432/${POSTGRES_DB}
# The name of which database schema to expose to REST clients
- PGRST_DB_SCHEMA=${DB_SCHEMA}
# The database role to use when no client authentication is provided
- PGRST_DB_ANON_ROLE=${DB_ANON_ROLE}
# Overrides the base URL used within the OpenAPI self-documentation hosted at the API root path
- PGRST_OPENAPI_SERVER_PROXY_URI=http://localhost:3000
networks:
- postgrest-backend
restart: unless-stopped
networks:
postgrest-backend:
driver: bridge