A small node project to keep track of tabs like in cafés, bistro, etc.
Note
This project is still in progress, some features may be missing or unstable.
This project aims to:
- Showcase a minimal full-stack capability: front-end, middleware, and database.
- Showcase CRUD database operations from a web application.
- Make sure you have Node.js installed
- Open a terminal in the cloned repo
- type
npm install
, this will install all dependncies - Once done, type
npm start
. This runs the application - Either click on the link in the terminal OR go to 'http://localhost:4000' on your browser
- You are now using minmalistTabTracker!
With SQLite, it is possible to setup a portable (serverless) relational database. This makes it easier to showcase the project as no additional setup/connection is required. While still allowing the ability to show how the database is setup and how queries are handled.
- SQLite database location: src/db/mySQLiteDB.db
- To see database setup in detail, see src/db/db_init.js
Rules:
- One person may have multiple tabs
- One tab may belong to multiple people
We have a many-to-many relationship and this must be broken down into multiple one to many relationship to abide by the rules of relational database system by making use of a junction table:
To further help visualisation, below are table creation queries:
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY,
name TEXT);
CREATE TABLE IF NOT EXISTS tabs (
tab_id INTEGER PRIMARY KEY,
amount INTEGER,
description TEXT);
CREATE TABLE IF NOT EXISTS usertabs (
usertabs_id INTEGER PRIMARY KEY,
userID INTEGER,
tabID INTEGER,
tabStatus BOOLEAN DEFAULT 0,
FOREIGN KEY (userID) REFERENCES users(user_id),
FOREIGN KEY (tabID) REFERENCES tabss(tab_id));
- Initialise Node project
- Setup portable database
- Create tables: users, tabs, & usertabs
- Functionality: display tabs based on its status: unpaid, paid, & all
- Functionality: create new tab
- Functionality: update tab
- Functionality: Set tab to paid
- Functionality: remove tab
- Add CSS (to make it bearable to look at) (optional)
Author: Muhammad Naufal Al Ghifari