Compare commits

...
8 Commits
Author SHA1 Message Date
theis.gaedigk 7247a78809 edit package.json versions 2026-07-07 11:46:51 +02:00
theis.gaedigk 9ecae324a3 add shared node modules 2026-07-07 11:36:45 +02:00
theis.gaedigk 4a73c43f80 add shared node modules 2026-07-07 11:32:55 +02:00
theis.gaedigk 8ebdbc14d6 edited docs 2026-06-09 18:56:32 +02:00
theis.gaedigk 1928068499 removed sh script 2026-06-08 19:46:50 +02:00
theis.gaedigk ea18228299 edited README 2026-06-06 17:19:49 +02:00
theis.gaedigk 6aa00da60b updated README 2026-06-06 17:13:59 +02:00
theis.gaedigk 0315aa4a40 Added gh templates 2026-06-06 16:58:04 +02:00
16 changed files with 6592 additions and 72 deletions
+52
View File
@@ -0,0 +1,52 @@
---
name: Bug Report
about: Report something that isn't working correctly in Stockhome
title: "[BUG] "
labels: bug
assignees: ""
---
## 🐛 Bug Description
<!-- A clear and concise description of what the bug is. -->
## Steps to Reproduce
<!-- How can we reliably reproduce the issue? -->
1. Go to '...'
2. Click on '...'
3. See error
## Expected Behavior
<!-- What did you expect to happen? -->
## Actual Behavior
<!-- What actually happened instead? -->
## Screenshots / Logs
<!-- If applicable, add screenshots or paste relevant logs (e.g. from `docker compose logs`). -->
## Environment
| Field | Value |
|--------------------|-------------------------------|
| Stockhome version | <!-- e.g. v1.0.0 or commit hash --> |
| Deployment | <!-- Docker / docker-compose / manual --> |
| Browser | <!-- e.g. Chrome 125, Firefox 126 --> |
| OS (host) | <!-- e.g. Ubuntu 24.04, Raspberry Pi OS --> |
| `BACKEND_HOST` | <!-- localhost / IP / domain --> |
## Docker Logs
<!-- Run `docker compose logs` and paste any relevant output here. -->
<details>
<summary>docker compose logs</summary>
```
paste logs here
```
</details>
## Additional Context
<!-- Anything else that might help us understand the issue. -->
+41
View File
@@ -0,0 +1,41 @@
---
name: Feature Request
about: Suggest a new feature or improvement for Stockhome
title: "[FEATURE] "
labels: enhancement
assignees: ""
---
## 💡 Feature Description
<!-- A clear and concise description of the feature you'd like to see. -->
## Problem / Motivation
<!-- Is your feature request related to a problem? Describe it.
e.g. "I always have to manually check expiry dates because..." -->
## Proposed Solution
<!-- Describe how you imagine this feature working. Be as specific as you like. -->
## Alternatives Considered
<!-- Have you thought of other approaches or workarounds? Why are they not ideal? -->
## Affected Area
<!-- Which part of Stockhome does this relate to? Check all that apply. -->
- [ ] Inventory / Product management
- [ ] Storage locations
- [ ] Expiry / Bottling date tracking
- [ ] QR code generation / scanning
- [ ] Costs tracking
- [ ] Settings (app name, currency, …)
- [ ] Authentication / User management
- [ ] API / Backend
- [ ] Frontend / UI
- [ ] Docker / Deployment
- [ ] Other: <!-- describe -->
## Additional Context / Mockups
<!-- Add any other context, screenshots, or mockups that help illustrate the idea. -->
+1
View File
@@ -43,6 +43,7 @@ Temporary Items
.apdisk .apdisk
ToDo.txt ToDo.txt
.idea
.env .env
.docker/volumes .docker/volumes
+28 -14
View File
@@ -43,19 +43,19 @@ exit
### 2. Clone repository ### 2. Clone repository
If you haven't installed git, download the source code from this repository from the release page and unpack the `.zip` file. **_Recommended because it is easy to update_**
**OR** Clone this repository by running:
**_Recommended because it is easier to update then:_**
If you want to be always up to date, you can clone this repository by running:
```shell ```shell
git clone https://git.the1s.de/theis.gaedigk/stockhome.git git clone --branch v0.1 --single-branch https://github.com/theis-js/stockhome.git
``` ```
> **NOTE:** To do this, you must have git installed. [How to install git?](https://git-scm.com/install/) You can replace `v0.1` with the latest release tag to get the latest version of the stack. You can also use `dev` to get the latest development version, but keep in mind that it may contain bugs and errors.
View the available version tags here: [Releases](https://github.com/theis-js/stockhome/tags)
> **Note** To do this, you must have git installed. [How to install git?](https://git-scm.com/install/)
### 3. Create `.env` file ### 3. Create `.env` file
@@ -69,7 +69,7 @@ BACKEND_HOST=localhost
Make sure that you have set an secure root password and a secure signature. Make sure that you have set an secure root password and a secure signature.
> **NOTE:** These three values cannot contain special characters. > **Note** These three values cannot contain special characters.
The `BACKEND_HOST` can be set to the IP address of your server or to `localhost` if you are running the app on your local machine. The `BACKEND_HOST` can be set to the IP address of your server or to `localhost` if you are running the app on your local machine.
@@ -96,16 +96,30 @@ Password: admin
_Keep in mind that you should change the password later in the settings page._ _Keep in mind that you should change the password later in the settings page._
> **NOTE:** If errors occur get yourself some help in the [error code page](./.github/docs/error/README.md). > **Note** If errors occur get yourself some help in the [error code page](./.github/docs/error/README.md).
> _I'd be grateful if you could report any bugs as issues here in the repository!_ ## Feedback and bug reports - Troubleshooting
I'd be grateful if you could report any bugs as issues here in the repository! [Report a bug](https://github.com/theis-js/stockhome/issues/new/choose)
## Update ## Update
To update the stack, navigate into the root directory of this repository and run: To update stockhome to the latest version, navigate into the root directory of this repository and run:
```shell ```shell
docker compose pull git pull
latesttag=$(git describe --tags)
git checkout ${latesttag}
docker compose up -d --build
```
To update to a specific version, replace `latesttag` with the version tag you want to update to. You can view the available version tags here: [Releases](https://github.com/theis-js/stockhome/tags)
**Example to downgrade/update to version `v0.1`:**
```shell
git pull
git checkout v0.1
docker compose up -d --build docker compose up -d --build
``` ```
@@ -114,7 +128,7 @@ docker compose up -d --build
### Prerequisites ### Prerequisites
- Docker - Docker
- Visual Studio Code - Visual Studio Code (or any other IDE)
- Cloned the repository - Cloned the repository
### Start backend and database ### Start backend and database
+3 -2
View File
@@ -1,11 +1,12 @@
{ {
"name": "backend", "name": "backend",
"version": "1.0.0", "version": "0.0.0-dev",
"description": "", "description": "",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js" "start": "node server.js",
"dev": "node --watch server.js"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
+1 -1
View File
@@ -94,7 +94,7 @@ const runStartup = async (port) => {
} }
console.log("Everything is settet up successfully!"); console.log("Everything is settet up successfully!");
console.log(`Server is running on http://localhost:${port}`); console.log(`Backend is running on http://localhost:${port}`);
}; };
const insertFirstData = async () => { const insertFirstData = async () => {
+7 -8
View File
@@ -1,16 +1,15 @@
import bodyParser from "body-parser"; import {jwtVerify, SignJWT} from "jose";
import { SignJWT, jwtVerify } from "jose";
import env from "dotenv"; import env from "dotenv";
env.config(); env.config();
const secret = new TextEncoder().encode(process.env.SECRET_KEY); const secret = new TextEncoder().encode(process.env.SECRET_KEY);
export async function generateToken(payload) { export async function generateToken(payload) {
const newToken = await new SignJWT(payload) return await new SignJWT(payload)
.setProtectedHeader({ alg: "HS256" }) .setProtectedHeader({alg: "HS256"})
.setIssuedAt() .setIssuedAt()
.setExpirationTime("24h") // Token valid for 24 hours .setExpirationTime("24h") // Token valid for 24 hours
.sign(secret); .sign(secret);
return newToken;
} }
export async function authenticate(req, res, next) { export async function authenticate(req, res, next) {
+2 -21
View File
@@ -3,7 +3,7 @@ services:
container_name: stockhome-mysql container_name: stockhome-mysql
image: mysql:8.0 image: mysql:8.0
ports: ports:
- "3312:3306" - "3306:3306"
restart: unless-stopped restart: unless-stopped
environment: environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
@@ -16,23 +16,4 @@ services:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 5s interval: 5s
timeout: 3s timeout: 3s
retries: 20 retries: 10
backend:
container_name: stockhome-backend
ports:
- "8004:8004"
build:
context: ./backend
dockerfile: Dockerfile
environment:
DB_HOST: stockhome-mysql
DB_USER: root
DB_NAME: stockhome
DB_PASSWORD: ${MYSQL_ROOT_PASSWORD}
SECRET_KEY: ${AUTH_SIGNATURE}
NODE_ENV: production
depends_on:
database:
condition: service_healthy
restart: unless-stopped
-1
View File
@@ -42,7 +42,6 @@ services:
build: ./frontend build: ./frontend
environment: environment:
BACKEND_HOST: ${BACKEND_HOST} BACKEND_HOST: ${BACKEND_HOST}
VITE_BACKEND_URL: /backend
depends_on: depends_on:
- backend - backend
restart: unless-stopped restart: unless-stopped
-3
View File
@@ -13,9 +13,6 @@ FROM nginx:alpine AS runner
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
COPY --from=builder /app/dist . COPY --from=builder /app/dist .
COPY docker-entrypoint.d/10-runtime-env.sh /docker-entrypoint.d/10-runtime-env.sh
RUN chmod +x /docker-entrypoint.d/10-runtime-env.sh
COPY nginx.conf /etc/nginx/templates/default.conf.template COPY nginx.conf /etc/nginx/templates/default.conf.template
EXPOSE 80 EXPOSE 80
@@ -1,10 +0,0 @@
#!/bin/sh
set -eu
VITE_BACKEND_URL_VALUE="${VITE_BACKEND_URL:-/backend}"
cat > /usr/share/nginx/html/env.js <<EOF
window.__ENV = {
VITE_BACKEND_URL: "${VITE_BACKEND_URL_VALUE}"
};
EOF
-1
View File
@@ -8,7 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/env.js"></script>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx"></script>
</body> </body>
</html> </html>
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "frontend", "name": "frontend",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0-dev",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+1 -10
View File
@@ -1,13 +1,4 @@
type WindowWithEnv = Window & {
__ENV?: {
VITE_BACKEND_URL?: string;
};
};
const runtimeEnv = (globalThis as unknown as WindowWithEnv).__ENV;
export const API_BASE = export const API_BASE =
runtimeEnv?.VITE_BACKEND_URL ||
(import.meta as any).env?.VITE_BACKEND_URL || (import.meta as any).env?.VITE_BACKEND_URL ||
import.meta.env.VITE_BACKEND_URL || import.meta.env.VITE_BACKEND_URL ||
"http://localhost:8004"; "/backend";
+6426
View File
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
{
"name": "stockhome",
"private": true,
"workspaces": [
"backend",
"frontend"
],
"version": "0.1.0-dev",
"description": "![React](https://img.shields.io/badge/React-61DAFB?logo=react&logoColor=000&style=flat) ![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=fff&style=flat) ![Vite](https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=fff&style=flat) ![Tailwind%20CSS](https://img.shields.io/badge/Tailwind%20CSS-38B2AC?logo=tailwindcss&logoColor=fff&style=flat) ![MUI](https://img.shields.io/badge/MUI-007FFF?logo=mui&logoColor=fff&style=flat) ![TanStack%20Query](https://img.shields.io/badge/TanStack%20Query-FF4154?logo=reactquery&logoColor=fff&style=flat) ![React%20Router](https://img.shields.io/badge/React%20Router-CA4245?logo=reactrouter&logoColor=fff&style=flat) [![TanStack%20Form](https://img.shields.io/badge/TanStack%20Form-EC5990?logo=reacthookform&logoColor=fff)](#) ![Node.js](https://img.shields.io/badge/Node.js-339933?logo=nodedotjs&logoColor=fff&style=flat) ![Express](https://img.shields.io/badge/Express-000000?logo=express&logoColor=fff&style=flat) ![MySQL](https://img.shields.io/badge/MySQL-4479A1?logo=mysql&logoColor=fff&style=flat) ![Docker](https://img.shields.io/badge/Docker-2496ED?logo=docker&logoColor=fff&style=flat) ![Nginx](https://img.shields.io/badge/Nginx-009639?logo=nginx&logoColor=fff&style=flat)",
"main": "index.js",
"scripts": {
"dev:frontend": "npm run dev --workspace=frontend",
"dev:backend": "npm run dev --workspace=backend",
"dev:docker": "docker compose -f docker-compose.dev.yml up -d --wait",
"dev": "npm run dev:docker && concurrently --kill-others \"npm:dev:frontend\" \"npm:dev:backend\"",
"dev:stop": "docker compose -f docker-compose.dev.yml down"
},
"repository": {
"type": "git",
"url": "https://git.the1s.de/theis.gaedigk/stockhome.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"devDependencies": {
"concurrently": "^10.0.3"
}
}