njmaeff / minventory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minventory

Minventory is a simple application enabling users to create, edit, and remove inventory items. Users can revert edits, deletions, and the creation of items on the history page.

Usage

Inventory Tab

  • Add a new item by clicking the Add button.
  • Edit an existing item by clicking the Edit button under Actions.
  • Delete an item by clicking the Remove button under Actions.

History Tab

  • Revert a deleted item by clicking the Revert button under Actions

Features

  • CRUD (create, read, update, delete) functionality for inventory items.
  • Ability to add comments to a deleted item and revert the deletion.

Stack

This app is a full-stack application, so we need a database and intermediate API for the front-end to speak to the database.

Database

The production database for this application is the Replit Database which is a primitive key-value store.

We can use a local db.json file that functionally acts like a key-value store for development. We have a unique client for using this database located here pages/api/lib/dbLocal.ts.

Back-End

We use NextJS API Routes for our API layer and translate a post request body into instructions for operating on the database. A response is crafted and sent back to the front end. Our database API is here pages/api/db.api.ts

Front-End

For the front end, the app uses NextJS. NextJS is a full-stack framework that offers pre-configured React and Typescript support. The framework allows us to write our front-end and back-end code using the same programming language. The most significant benefit of creating an app using NextJS is the ability to share library code and type declarations between front-end and back-end code. Another advantage is rendering our data into the front-end page if we desire on the server.

Running on Replit

Press the Start button.

OR

Run manually

yarn start
# runs yarn build, yarn seed, next start

Local Development

Clone the git repository

git clone https://github.com/njmaeff/minventory

Install dependencies.

yarn install

Add the seed data.

yarn seed-dev

Start the application.

yarn dev

Maintenance

There are two scripts you can use for maintenance:

Backup the database

yarn backup backup.json

Restore the database

yarn restore backup.json

About


Languages

Language:CSS 89.7%Language:TypeScript 5.3%Language:Less 4.9%Language:JavaScript 0.0%