Skip to content

est22/habit_web

Repository files navigation

Habit Management App

Overview

A web application that allows users to manage and track their habits effectively, providing functionality to create habits, record progress, and add notes for each entry.

*This project is for practicing database creation with Node.js. *

 

Used Modules

  • Node.js
  • Express
  • EJS
  • Express-session
  • Cookie-parser
  • Moment
  • Nodemon
  • SQLite3

   

Project Requirements

한국어 (korean)
- 회원가입 및 로그인 기능 - 회원 별로 습관을 관리 해야 한다. - 습관 목록을 조회할 수 있어야 하고, 습관을 추가할 수 있어야 한다 - 습관 별로 기록을 관리할 수 있어야 한다. - 습관 기록에는 메모를 할 수 있는 기능이 필요하다.

1. User Authentication

  • Implement user registration and login functionality.

2. Habit Management

  • Users can manage their own habits.
  • Users can view a list of their habits.
  • Users can add new habits.

3. Habit Tracking

  • Users can manage records for each habit.
  • The habit tracking feature includes a memo functionality for each record.

 

 

UI Design & Prototype

korean
 

alt text

 

Sequence Diagram

sequenceDiagram
    actor User
    participant Client
    participant Express
    participant SQLite
    
    %% Authentication Flow
    rect rgb(240, 240, 240)
        Note over User,SQLite: Authentication Flow
        User->>Client: Access /register
        Client->>Express: GET /register
        Express->>Client: Render register form
        User->>Client: Submit registration
        Client->>Express: POST /register
        Express->>SQLite: Check email existence
        SQLite-->>Express: Return result
        alt Email exists
            Express-->>Client: Show error
        else Email doesn't exist
            Express->>SQLite: Insert new user
            Express->>Client: Redirect to login
        end

        User->>Client: Access /login
        Client->>Express: GET /login
        Express->>Client: Render login form
        User->>Client: Submit credentials
        Client->>Express: POST /login
        Express->>SQLite: Verify credentials
        SQLite-->>Express: Return user data
        alt Valid credentials
            Express->>Express: Create session
            Express->>Client: Redirect to habit list
        else Invalid credentials
            Express->>Client: Redirect to login
        end
    end

    %% Habit Management Flow
    rect rgb(230, 240, 230)
        Note over User,SQLite: Habit Management Flow
        User->>Client: Access habit list
        Client->>Express: GET /habit_list
        Express->>SQLite: Query user's habits
        SQLite-->>Express: Return habits
        Express->>Client: Render habit list

        User->>Client: Add new habit
        Client->>Express: POST /habit/add
        Express->>SQLite: Insert new habit
        SQLite-->>Express: Confirm insertion
        Express->>Client: Redirect to habit list

        User->>Client: View habit details
        Client->>Express: GET /habit_list/:id
        Express->>SQLite: Query habit & records
        SQLite-->>Express: Return habit data
        Express->>Client: Render habit details

        User->>Client: Add habit record
        Client->>Express: POST /habit_record_add
        Express->>SQLite: Insert record
        SQLite-->>Express: Confirm insertion
        Express->>Client: Redirect to habit details
    end
Loading

 

Entity-Relationship Diagram

draw.io

erDiagram
    USERS ||--o{ HABITS : has
    HABITS ||--o{ RECORDS : contains

    USERS {
        integer id PK
        varchar name
        varchar email UK
        varchar password
        datetime createdAt
    }

    HABITS {
        integer id PK
        varchar habit_name
        datetime start_date
        datetime end_date
        datetime createdAt
        integer user_id FK
    }

    RECORDS {
        integer id PK
        varchar memo
        datetime createdAt
        integer habit_id FK
    }
Loading

Installation

  1. Clone the repository
git clone https://github.com/est22/habit_web
  1. Navigate to the project directory:
cd habit-management-app
  1. Install dependencies:
npm i express ejs express-session cookie-parser moment nodemon
  1. Start the application:
npm run dev

   

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published