91 lines
2.4 KiB
Markdown
91 lines
2.4 KiB
Markdown
# storage-manager
|
|
|
|
## purpose
|
|
This project is supposed to make finding objects inside boxes easier. Translucent storage boxes are ugly. Over time and with the addition of new items, labels become irrelevant to the items they are meant to describe. They are inflexible. Distinctions between which box an item belongs can be arbitrary and confusing. e.g. Scissors belonging to 'Tools' or 'Crafts'.
|
|
|
|
## features:
|
|
- Record physical location, quantity, description, etc of items
|
|
- Search by item/box name, description
|
|
- Move items to and from boxes
|
|
|
|
## Stack
|
|
- mongodb
|
|
- node.js
|
|
- Vite
|
|
- Typescript
|
|
- TailwindCSS
|
|
|
|
## Dev Environment
|
|
### Dev Container
|
|
This repo includes a VS Code dev container, modeled after the setup in `plant-man`.
|
|
|
|
- Prerequisite: Docker Desktop with the Docker CLI available.
|
|
- In VS Code, run `Dev Containers: Reopen in Container`.
|
|
- The container installs dependencies in both `server/` and `client/`.
|
|
- MongoDB starts as a sidecar service using the default dev credentials below:
|
|
|
|
```env
|
|
DB_HOST=mongo
|
|
DB_PORT=27017
|
|
DB_USERNAME=devroot
|
|
DB_PASSWORD=devroot
|
|
PORT=5000
|
|
CORS_ORIGIN=http://localhost:5174
|
|
```
|
|
|
|
Start the app from two terminals inside the container:
|
|
|
|
```sh
|
|
cd server
|
|
npm run start
|
|
```
|
|
|
|
```sh
|
|
cd client
|
|
npm run dev
|
|
```
|
|
|
|
Forwarded services:
|
|
- Client: http://localhost:5174
|
|
- API: http://localhost:5000
|
|
- Mongo Express: http://localhost:8999
|
|
- MongoDB: localhost:27017
|
|
|
|
### Database
|
|
Located in `database` directory. Configured to use Mongo DB Docker container `mongo-db`. Included is a `docker-compose.yml` file that will host a Mongo DB on port `27017` using credentials configured with environment variables, e.g:
|
|
|
|
```env
|
|
MONGO_INITDB_ROOT_USERNAME=<root username>
|
|
MONGO_INITDB_ROOT_PASSWORD=<root password>
|
|
ME_CONFIG_MONGODB_ADMINUSERNAME=<mongodb username>
|
|
ME_CONFIG_MONGODB_ADMINPASSWORD=<mongodb admin password>
|
|
```
|
|
Also includes Mongo Express container `mongo-express`.
|
|
|
|
---
|
|
|
|
### Server
|
|
Located in `server` directory.
|
|
- Edit `.env` file with credentials for database, e.g:
|
|
|
|
```env
|
|
DB_USERNAME=<username>
|
|
DB_PASSWORD=<password>
|
|
DB_HOST=<hostname> //server
|
|
DB_PORT=<db port> //27017
|
|
PORT=<server port> //5000
|
|
CORS_ORIGIN=<allowed client origin> //http://localhost:5174
|
|
```
|
|
|
|
- Run `npm i` to install required node packages
|
|
- Run `npm run start` to start server, uses `nodemon` to watch for server changes and restart server automatically.
|
|
|
|
---
|
|
|
|
### Client
|
|
Located in `client/` directory.
|
|
- `npm i`
|
|
- Uses `vite` build and dev server, `npm run dev`
|
|
|
|
---
|