Skip to content

Commit

Permalink
add initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
gXkch committed Nov 7, 2024
0 parents commit 00dcafb
Show file tree
Hide file tree
Showing 15 changed files with 1,524 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM golang:alpine as builder-base
LABEL builder=true multistage_tag="witb"
RUN apk add --no-cache upx ca-certificates tzdata gcc g++

FROM builder-base as builder-modules
LABEL builder=true multistage_tag="witb"
ARG TARGETARCH
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go mod verify

FROM builder-modules as builder
LABEL builder=true multistage_tag="witb"
ARG TARGETARCH
WORKDIR /build
ADD ./templates ./templates
COPY *.go .
RUN ls -l /build
RUN go env -w CGO_ENABLED=1
#CGO_ENALBED=1 GOOS=linux GOARCH=${TARGETARCH} -ldflags '-s -w -extldflags="-static"'
RUN GOARCH=${TARGETARCH} go build -o witb
RUN upx --best --lzma witb

FROM alpine:3.17
WORKDIR /app

COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /build/templates /app/templates
COPY --from=builder /build/witb /app/
CMD ["/app/witb"]
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# What's in the Box (WITB)

__What's in the Box__ is a simple storage organization solution aimed to help you identify stuff that you've stored in physical locations such as boxes or containers.

It was made because I have not found any such solution myself to keep track of what items are stored where.

## How does it work

__What's in the Box__ is a web app written in Golang which communicates with a SQLite database to store boxes and the boxes' contents. You add boxes and contents to your liking. Each box also shows you a QR-Code which you can print out and attach to your boxes. Upon scanning the code, it will open the box in the browser and show you the contents.

### What can it do

Currently __What's in the Box__ supports the following operations:

- Create a box with a name and a label
- Show you a QR-Code that when scanned opens the related box in the web app.
- Edit names and labels of boxes
- Delete boxes and all items associated to the box
- Search for boxes by name or label
- Add items to boxes (with quanitites)
- Edit items in boxes (Change name and quantities)
- Move items to another box
- Delete items from boxes

### What it can't do (yet)

As of yet, it does not have a fully fleshed-out REST API to support scipted/automated operations, although this is planned for future releases. Most of the tasks still need to be executed in the web interface.

### Out-of-scope

- There are no plans to add authentication to the app since it is designed to be run at home in your own network. If you want to expose it to the internet, make sure to add at least a authentication proxy in front of it or access it via a VPN.
- There is no plans for this app to handle TLS on its own. If you wanna secure the connection you must run this behind a reverse proxy where TLS will be terminated.

### Planned

- Full REST API to support all operations available in the web interface
- Add more attributes to items such as expiration dates for foods.
- Prometheus Metrics (Track Total Items, Total Boxes, other potential metrics)

## Setup

The app is designed to run inside a container although building and running it on your own is also possible.

### Environment variables

| Variable | Description | Default |
|---------- |--------------------------------------------------------------- |--------------- |
| PORT | Port for the web interface | 8088 |
| DB | Path to the database (will be generated if it does not exist) | /tmp/boxes.db |
| HTTP_SECURE_SCHEMA | Used to correctly set http schema [http / https] for the QR code generation | 0 |



## Screenshots

Home screen
![home](screenshots/home.png)

Edit a box
![edit-box](screenshots/editbox.png)

Add content to a box
![add-item](screenshots/additem.png)

Search for boxes by name or label
![search-boxes](screenshots/search.png)

Show qr code for box
![qr](screenshots/qr.png)
Loading

0 comments on commit 00dcafb

Please sign in to comment.