Compare commits
8
Commits
v0.1
...
7247a78809
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7247a78809 | ||
|
|
9ecae324a3 | ||
|
|
4a73c43f80 | ||
|
|
8ebdbc14d6 | ||
|
|
1928068499 | ||
|
|
ea18228299 | ||
|
|
6aa00da60b | ||
|
|
0315aa4a40 |
@@ -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. -->
|
||||
@@ -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. -->
|
||||
@@ -43,6 +43,7 @@ Temporary Items
|
||||
.apdisk
|
||||
|
||||
ToDo.txt
|
||||
.idea
|
||||
|
||||
.env
|
||||
.docker/volumes
|
||||
|
||||
@@ -43,19 +43,19 @@ exit
|
||||
|
||||
### 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**
|
||||
|
||||
**_Recommended because it is easier to update then:_**
|
||||
|
||||
If you want to be always up to date, you can clone this repository by running:
|
||||
Clone this repository by running:
|
||||
|
||||
```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
|
||||
|
||||
@@ -69,7 +69,7 @@ BACKEND_HOST=localhost
|
||||
|
||||
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.
|
||||
|
||||
@@ -96,16 +96,30 @@ Password: admin
|
||||
|
||||
_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
|
||||
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
@@ -114,7 +128,7 @@ docker compose up -d --build
|
||||
### Prerequisites
|
||||
|
||||
- Docker
|
||||
- Visual Studio Code
|
||||
- Visual Studio Code (or any other IDE)
|
||||
- Cloned the repository
|
||||
|
||||
### Start backend and database
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"version": "0.0.0-dev",
|
||||
"description": "",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js"
|
||||
"start": "node server.js",
|
||||
"dev": "node --watch server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ const runStartup = async (port) => {
|
||||
}
|
||||
|
||||
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 () => {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import bodyParser from "body-parser";
|
||||
import { SignJWT, jwtVerify } from "jose";
|
||||
import {jwtVerify, SignJWT} from "jose";
|
||||
import env from "dotenv";
|
||||
|
||||
env.config();
|
||||
const secret = new TextEncoder().encode(process.env.SECRET_KEY);
|
||||
|
||||
export async function generateToken(payload) {
|
||||
const newToken = await new SignJWT(payload)
|
||||
.setProtectedHeader({ alg: "HS256" })
|
||||
.setIssuedAt()
|
||||
.setExpirationTime("24h") // Token valid for 24 hours
|
||||
.sign(secret);
|
||||
return newToken;
|
||||
return await new SignJWT(payload)
|
||||
.setProtectedHeader({alg: "HS256"})
|
||||
.setIssuedAt()
|
||||
.setExpirationTime("24h") // Token valid for 24 hours
|
||||
.sign(secret);
|
||||
}
|
||||
|
||||
export async function authenticate(req, res, next) {
|
||||
|
||||
+2
-21
@@ -3,7 +3,7 @@ services:
|
||||
container_name: stockhome-mysql
|
||||
image: mysql:8.0
|
||||
ports:
|
||||
- "3312:3306"
|
||||
- "3306:3306"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
@@ -16,23 +16,4 @@ services:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
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
|
||||
retries: 10
|
||||
@@ -42,7 +42,6 @@ services:
|
||||
build: ./frontend
|
||||
environment:
|
||||
BACKEND_HOST: ${BACKEND_HOST}
|
||||
VITE_BACKEND_URL: /backend
|
||||
depends_on:
|
||||
- backend
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -13,9 +13,6 @@ FROM nginx:alpine AS runner
|
||||
WORKDIR /usr/share/nginx/html
|
||||
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
|
||||
|
||||
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
|
||||
@@ -8,7 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/env.js"></script>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-dev",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
type WindowWithEnv = Window & {
|
||||
__ENV?: {
|
||||
VITE_BACKEND_URL?: string;
|
||||
};
|
||||
};
|
||||
|
||||
const runtimeEnv = (globalThis as unknown as WindowWithEnv).__ENV;
|
||||
|
||||
export const API_BASE =
|
||||
runtimeEnv?.VITE_BACKEND_URL ||
|
||||
(import.meta as any).env?.VITE_BACKEND_URL ||
|
||||
import.meta.env.VITE_BACKEND_URL ||
|
||||
"http://localhost:8004";
|
||||
"/backend";
|
||||
|
||||
Generated
+6426
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "stockhome",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"backend",
|
||||
"frontend"
|
||||
],
|
||||
"version": "0.1.0-dev",
|
||||
"description": "       [](#)     ",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user