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. *
- Node.js
- Express
- EJS
- Express-session
- Cookie-parser
- Moment
- Nodemon
- SQLite3
한국어 (korean)
- 회원가입 및 로그인 기능
- 회원 별로 습관을 관리 해야 한다.
- 습관 목록을 조회할 수 있어야 하고, 습관을 추가할 수 있어야 한다
- 습관 별로 기록을 관리할 수 있어야 한다.
- 습관 기록에는 메모를 할 수 있는 기능이 필요하다.
- Implement user registration and login functionality.
- Users can manage their own habits.
- Users can view a list of their habits.
- Users can add new habits.
- Users can manage records for each habit.
- The habit tracking feature includes a memo functionality for each record.
korean
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
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
}
- Clone the repository
git clone https://github.com/est22/habit_web
- Navigate to the project directory:
cd habit-management-app
- Install dependencies:
npm i express ejs express-session cookie-parser moment nodemon
- Start the application:
npm run dev