Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
fad2137
initial commit for the currently very hacky next.js frontend
mel1na Oct 12, 2025
019fdce
add amount to price calculation when creating purchase
mel1na Oct 14, 2025
687c734
drop sse clients when unreachable/disconnected
mel1na Oct 15, 2025
55fd79b
remove redundant error info
mel1na Oct 15, 2025
735dab7
update dependencies
mel1na Oct 15, 2025
fc0a7f7
clean up auth context
mel1na Oct 15, 2025
d73fd01
rename SearchInput to BarcodeSearchInput
mel1na Oct 15, 2025
2fd08be
add top padding to usercards
mel1na Oct 15, 2025
cf2d298
enable other payment dialog options in checkout button
mel1na Oct 15, 2025
d1db868
clean up unused imports
mel1na Oct 15, 2025
55e3259
fetch user info when logging in
mel1na Oct 15, 2025
fdd4031
add card/balance payment option and sse handler
mel1na Oct 15, 2025
7a1d826
terminate card payment when using cancel button
mel1na Oct 15, 2025
0de9380
disable balance button for restricted users
mel1na Oct 15, 2025
625ed04
enhance sse status widget
mel1na Oct 15, 2025
e173b33
containerization support for frontend, enable latest tags for be/fe
mel1na Oct 15, 2025
cc0ec69
refactor(backend): migrate auth handler from external library into co…
mel1na Oct 17, 2025
bd50c58
feat(backend): make items accept a barcode array instead of a single …
mel1na Oct 17, 2025
6e30f0c
feat(backend): limit usernames to 24 characters
mel1na Oct 17, 2025
f74b8fa
chore(backend): update vcs file
mel1na Oct 17, 2025
04ac6a9
refactor(backend): remove logging for sending heartbeats
mel1na Oct 17, 2025
8b5cbb0
chore(frontend): add a ton of new features
mel1na Oct 18, 2025
4f77720
feat(backend): add new item fields, notify sse clients on item change
mel1na Oct 19, 2025
ce3c2c5
feat(backend): add new admin endpoints
mel1na Oct 19, 2025
1b910d4
feat(backend): enable user update endpoint, notify sse clients on use…
mel1na Oct 19, 2025
75ee2ad
refactor(backend): items saved in purchases are now slimmer, add exce…
mel1na Oct 19, 2025
56e7a40
feat(frontend): add more features and enhance/improve existing ones
mel1na Oct 19, 2025
e67d520
refactor(backend): move auth library with improvements into project
mel1na Oct 19, 2025
8b09364
ci: prevent prs from generating latest tag
mel1na Oct 19, 2025
6d0f123
refactor(frontend): change folder structure to hopefully make ci work
mel1na Oct 19, 2025
21c0ec2
ci(frontend): use next.js template dockerfile
mel1na Oct 19, 2025
c75c599
chore(backend): add new env vars to example
mel1na Oct 19, 2025
84ca576
fix(backend): fix compatibility with environment variables, postgres …
mel1na Oct 19, 2025
3a64efb
fix(backend): rename postgres variables to fix connection issues
mel1na Oct 19, 2025
2f25522
fix(backend): add tzdata to backend docker image
mel1na Oct 19, 2025
65dc6ff
fix(frontend): make api url dynamic
mel1na Oct 19, 2025
6399983
refactor: move admin and payment into /api route
mel1na Oct 19, 2025
b19e464
fix(backend): adjust broken imports
mel1na Oct 19, 2025
e6301be
fix(frontend): improve handling of transaction updates
mel1na Oct 19, 2025
a79d8c5
refactor(frontend): swap purchase id for user id
mel1na Oct 19, 2025
bca6a48
fix(backend): return client_transaction_id instead of transaction_id …
mel1na Oct 19, 2025
2deddbf
fix(frontend): add item variant to admin purchase view
mel1na Oct 19, 2025
295e026
feat(frontend): resolve userid for all entries once clicked
mel1na Oct 19, 2025
ad6d36a
fix(backend): better user filtering, send sse message when deleting item
mel1na Oct 19, 2025
1d442fe
fix(backend): use bool pointers instead of bools, fixes #16
mel1na Oct 20, 2025
11a5f72
feat(backend): add settings support
mel1na Oct 20, 2025
9bd1232
fix(backend): add deleted_at to item to fix error
mel1na Oct 20, 2025
286499d
feat(backend): add default reader id field to settings
mel1na Oct 20, 2025
964ab07
fix(backend): remove trailing slash when finding readers
mel1na Oct 20, 2025
9cb6160
fix(backend): fix find items sql query to show active items
mel1na Oct 21, 2025
cc89292
fix(backend): make settings accept null/empty values for default read…
mel1na Oct 21, 2025
68059c6
fix(backend): send sse notification when linking new reader
mel1na Oct 21, 2025
ecaf9c1
feat(backend): add new reader delete by id endpoint
mel1na Oct 21, 2025
edf50d5
feat(backend): rework init readers logic to update the existing linke…
mel1na Oct 21, 2025
6e24c30
feat(frontend): add admin reader management page. closes #8
mel1na Oct 21, 2025
2e8fea6
feat(frontend): add reader type and reader link dialog
mel1na Oct 21, 2025
7d26689
feat(frontend): add support for settings to sse
mel1na Oct 21, 2025
7f62cfd
style(frontend): remove "is" from column names in admin user view
mel1na Oct 21, 2025
86c22c4
feat(frontend): add settings context
mel1na Oct 21, 2025
835e8bd
feat(frontend): add delete reader dialog
mel1na Oct 21, 2025
40d7f31
feat(frontend): add settings dialog
mel1na Oct 21, 2025
3ac7665
feat(frontend): add button for deleting items
mel1na Oct 21, 2025
18f3e6a
feat(frontend): add additional checks for balance and card readers to…
mel1na Oct 21, 2025
29767b8
feat(backend): add merchant info to settings, create new endpoint to …
mel1na Oct 22, 2025
c2152f8
feat(frontend): add merchant info support to readers page/settings
mel1na Oct 22, 2025
505d5e8
fix(frontend): prevent double submissions/requests to backend
mel1na Oct 22, 2025
2631787
feat(frontend): add maintenance page and settings, closes #14
mel1na Oct 22, 2025
9ea9f12
feat(frontend): add reader checks inside the payment dialog
mel1na Oct 22, 2025
af51537
refactor(backend): only send sse notifications for required reader up…
mel1na Oct 22, 2025
ddbfbb5
ci: update backend dockerfile + add new example envs/docker-compose (…
mel1na Oct 22, 2025
99e936e
fix(frontend): fix ci build errors
mel1na Oct 22, 2025
50db2d6
refactor(backend): move user balance functions to helper lib file
mel1na Oct 23, 2025
272f10a
fix(backend): add additional checks for balance top-up purchases (#4)
mel1na Oct 23, 2025
c7073af
feat(backend): automatically create admin user when there is none pre…
mel1na Oct 23, 2025
567cdc3
refactor(backend): improve reader checkout termination, only increase…
mel1na Oct 23, 2025
a192764
style(frontend): increase button sizes for better usability on touch …
mel1na Oct 23, 2025
ea41336
feat(frontend): create add balance dialog (#4)
mel1na Oct 23, 2025
92b7667
refactor(frontend): add ability to trigger settings dialog from other…
mel1na Oct 23, 2025
707cae0
refactor(frontend): replace settings cog in header with dropdown
mel1na Oct 23, 2025
2b3dfd8
feat(frontend): add balance top-up support to payment dialog
mel1na Oct 23, 2025
aa68161
style(frontend): increase sidebar size to 22rem
mel1na Oct 23, 2025
2d71e34
style(frontend): show currently active item on header
mel1na Oct 23, 2025
5730751
fix(frontend): stop enter key from propagating in password dialog. fi…
mel1na Oct 23, 2025
60c0a3e
chore(frontend): optimize imports and remove unused code
mel1na Oct 23, 2025
a13f852
chore(frontend): update to nextjs 16
mel1na Oct 23, 2025
f16897b
fix(backend): fix db error when initializing readers
mel1na Oct 23, 2025
97ffc13
docs: pin postgres version in docker-compose, update README
mel1na Oct 24, 2025
a72ddab
fix(backend): fix logic for removing readers that are not in the api …
mel1na Oct 24, 2025
dc02ebb
fix(frontend): disable autofocus for add balance dialog
mel1na Oct 24, 2025
c42d1a0
fix(backend): sort items not item by creation date ASC
mel1na Oct 24, 2025
5d040f7
feat(frontend): add barcode checksum validation when creating item
mel1na Oct 24, 2025
07d05ea
feat(frontend): show notifications when barcode is not found
mel1na Oct 24, 2025
15f08f9
fix(frontend): hide barcode search on items screen
mel1na Oct 25, 2025
61c05af
feat: allow logging in with barcode, separate user and admin user upd…
mel1na Nov 10, 2025
eb806d4
fix(frontend): check if user is admin when determining if header is t…
mel1na Nov 10, 2025
42edeb6
fix(backend): check if user is restricted when updating user (closes …
mel1na Nov 10, 2025
8aefe09
fix(backend): remove check for password to allow login for users with…
mel1na Nov 10, 2025
f0b4f2a
fix(frontend): show errors when logging in with barcode or as guest
mel1na Nov 10, 2025
17003b0
feature: visibility for disabled items in admin menu, better disabled…
mel1na Nov 29, 2025
4d6cc86
chore(frontend): update nextjs (CVE-2025-66478)
mel1na Dec 5, 2025
7ca8912
feat(frontend): automatically start payment when selecting card
mel1na Jan 8, 2026
4a415d7
feat(frontend): add ability to check out using login barcode (closes …
mel1na Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .env.backend.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SUMUP_API_KEY=sup_sk_xxxxx #https://me.sumup.com/settings/developer
SUMUP_RETURN_URL=https://fqdn.tld/api/payment/v1/callback #make sure this endpoint is reachable!
JWT_SECRET=changeme #generate a random alphanumeric 64-char string here at least. please.

GIN_TRUSTED_PROXIES=localhost #change this to your reverse proxy ip if applicable
CORS_ALLOWED_ORIGINS=http://localhost:8080 #all allowed frontend origins, comma separated

DB_HOST=localhost
POSTGRES_USER=drinks
POSTGRES_PASSWORD=xxx
POSTGRES_DATABASE=drinks
DB_PORT=5432
DB_TIMEZONE=Europe/Vienna
2 changes: 2 additions & 0 deletions .env.frontend.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# In production, change this to your actual URL
NEXT_PUBLIC_API_URL=https://drinks.example.com
1 change: 1 addition & 0 deletions .github/workflows/docker-publish-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,prefix=backend-,value=latest,enable=${{ github.event_name != 'pull_request' }}
type=ref,prefix=backend-,event=branch
type=ref,prefix=backend-,event=tag
type=ref,prefix=backend-pr-,event=pr
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-publish-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,prefix=frontend-,value=latest,enable=${{ github.event_name != 'pull_request' }}
type=ref,prefix=frontend-,event=branch
type=ref,prefix=frontend-,event=tag
type=ref,prefix=frontend-pr-,event=pr
Expand Down
142 changes: 2 additions & 140 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,140 +1,2 @@
.env

### GoLand ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### GoLand Patch ###
*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud
.env.*
!.env.*.example
51 changes: 6 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,14 @@
This project contains the backend and frontend code for the Metadrinks project.

## Setting up
Copy the contents of `.env.example` to `.env` and replace the values accordingly.
Copy `docker-compose.yml`, `.env.backend.example` and `.env.frontend.example` to your project root directory. Replace the values in the example files accordingly and remove the `.example` suffix.

### docker-compose.yml

```
---
services:
postgres:
image: postgres:17-alpine
container_name: metadrinks-postgres
environment:
- TZ=Europe/Vienna
- POSTGRES_USER=<DB_USER>
- POSTGRES_PASSWORD=<DB_PASSWORD>
- POSTGRES_DB=<DB_DATABASE>
volumes:
- ./pg_data:/var/lib/postgresql/data
networks:
- backend
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U <DB_USER> -d <DB_DATABASE>"]
interval: 1s
retries: 10
start_period: 10s
timeout: 30s

backend:
image: ghcr.io/metalab/Metadrinks-backend:main
container_name: metadrinks-backend
networks:
- backend
ports:
- 8080:8080
depends_on:
postgres:
condition: service_healthy
restart: true
restart: unless-stopped

networks:
backend:
```

Using this example, your `DB_HOST` would be `metadrinks-postgres`, your `DB_PORT` would be `5432` and everything else would be what you replace the placeholder values with.
To start, execute `docker compose up -d`. If required or wanted, you can change the ports (in the format `host-port:container-port`, only change the host-port) or the version to ensure no unwanted upgrades happen.

## Usage
On first start, a default guest and admin user are generated. The admin password will be printed to your console ONCE (visible by either running `docker compose up` when starting or `docker compose logs` after start).

After the first start, it is recommended to change the admin password via the admin interface under `/admin`. From this page, all management of items, users, readers and purchases takes place.

### API Docs
coming soon (when the api is semi-stable and tested)
Currently, the API docs are served by the backend under /docs/index.html with the file "../swapper.json".
12 changes: 0 additions & 12 deletions backend/.env.example

This file was deleted.

142 changes: 142 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
.env

### GoLand ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/dataSources.xml
.idea/**/data_source_mapping.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### GoLand Patch ###
*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud
Loading