AI-powered Mental Health app.
- Pay attention, that we have certain quality criteria, which we should follow during application development.
CalmPal is an AI-powered Mental Health app designed to be a trusted companion on the path to inner peace. The app offers a comprehensive approach to mental well-being, combining AI-driven therapy through a highly responsive chatbot and personalized mindfulness practices (meditation, mood tracking, and journaling).
The CalmPal goal is to be the best tool for people who have mental health problems and want to manage stress and keep their emotions balanced.
- NodeJS (18.x.x);
- npm (9.x.x);
- PostgreSQL (15.4)
- EsLint plugin is not supported - we use additional rules to check the code quality, some of which are not supported by the plugin
erDiagram
users {
int id PK
dateTime created_at
dateTime updated_at
citext email "unique constraint"
text password_hash
text password_salt
int role_id FK
}
user_roles {
int id PK
dateTime created_at
dateTime updated_at
varchar name
varchar key "chatbot and user"
}
user_details {
int id PK
dateTime created_at
dateTime updated_at
int user_id FK
varchar full_name
int avatar_id FK "may be null if user has no avatar"
boolean is_survey_completed
}
files {
int id PK
dateTime created_at
dateTime updated_at
varchar url
varchar content_type
}
user_preferences {
int id PK
int user_id FK
dateTime created_at
dateTime updated_at
boolean is_notification_allowed "may be altered later"
boolean is_meditation_reminder_enabled "may be altered later"
boolean are_mood_notifications_emabled "may be altered later"
boolean are_notes_reminder_enabled "may be altered later"
}
chat_topics {
int id PK
dateTime created_at
dateTime updated_at
varchar name
int image_id FK
}
chats {
int id PK
dateTime created_at
dateTime updated_at
varchar name
int topic_id FK
}
users_to_chats {
int id PK
dateTime created_at
dateTime updated_at
int user_id FK
int chat_id FK
}
chat_messages {
int id PK
varchar name
int chat_id FK
int sender_id FK "create a user"
dateTime created_at
dateTime updated_at
text message
}
meditation_topics {
int id PK
dateTime created_at
dateTime updated_at
varchar name
int image_id FK
}
meditation_entries {
int id PK
dateTime created_at
dateTime updated_at
int topic_id FK
varchar name
varchar media_url
varchar content_type
}
journal_entries {
int id PK
int user_id FK
dateTime created_at
dateTime updated_at
varchar title
text text
}
surveys {
int id PK
int user_id FK
dateTime created_at
dateTime updated_at
array preferences
}
user_roles ||--|{ users : user_role_id
user_details ||--|| users : user_id
user_preferences ||--|| users : user_id
user_details ||..|o files : avatar_id
chat_topics ||--|{ chats : chat_topic_id
chat_topics ||..|o files : chat_topic_image_id
chats ||--|{ chat_messages : chat_id
chats ||--|| users_to_chats : chat_id
users ||--|| users_to_chats : user_id
users ||--|{ chat_messages : user_id
users ||--|{ journal_entries : user_id
meditation_topics ||..|o files : meditation_topic_image_id
meditation_topics ||--|{ meditation_entries : meditation_topic_id
user_details |o--o| surveys : user_id
- React — a frontend library
- Redux + Redux Toolkit — a state manager
-
assets - static assets (images, global styles)
-
libs - shared libraries and utilities
2.1 components - plain react components
2.2 enums
2.3 helpers
2.4 hooks
2.5 packages - separate features or functionalities
2.6 types
-
packages - separate app features or functionalities
-
pages - app pages
-
slices - redux slices
-
db - database data (migrations, seeds)
-
libs - shared libraries and utilities
2.1 enums
2.2 exceptions
2.3 helpers
2.4 packages - separate features or functionalities
2.5 types
-
packages - separate app features or functionalities
This project is mainly focused on Android platform.
- React Native — a mobile library
- Redux + Redux Toolkit — a state manager
-
assets - static assets (images)
-
libs - shared libraries and utilities
2.1 components - plain react components
2.2 enums
2.3 helpers
2.4 hooks
2.5 packages - separate features or functionalities
2.6 types
-
navigations - app navigators
-
packages - separate app features or functionalities
-
screens - app screens
-
slices - redux slices
As we are already using js on both frontend and backend it would be useful to share some contracts and code between them.
- Joi — a schema validator
- Create and fill all .env files. These files are:
- frontend/.env
- backend/.env
- mobile/.env
You should use .env.example folder as a reference.
-
Install dependencies:
npm install
. -
Install pre-commit hooks:
npx simple-git-hooks
. This hook is used to verify code style on commit. -
Run database. You can either run it in docker using command
docker-compose --env-file ./backend/.env -f docker-compose.services.yml up --build
or by installing postgres on your computer. Docker variant is preferred. -
Apply migrations:
npm run migrate:dev -w backend
-
Run backend:
npm run start:dev -w backend
-
Run frontend:
npm run start:dev -w frontend
-
Run mobile:
npm run start:dev -w mobile
<project-prefix>-<issue-number>: <ticket-title>
Examples:
cp-5: Add User Dashboard
<type>/<project-prefix>-<issue-number>-<short-desc>
Types:
- task
- fix
Examples:
task/cp-5-add-user-dashboard
task/cp-12-add-user-flow
fix/cp-16-fix-user-flow
<project-prefix>-<issue-number>: <modifier> <description>
Modifiers:
+
(add)*
(edit)-
(remove)
Examples:
cp-5: + title for dashboard
cp-12: * dashboard title
cp-16: - dashboard title
CI/CD implemented using GitHub Actions