Skip to content

BinaryStudioAcademy/bsa-2022-guruhub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BSA-2022 | GuruHub

ℹ️ General Info

This is the repository responsible for GuruHub's apps.

🏭 Applications

  • Backend β€” GuruHub's application backend.

    To work properly, fill in the .env file. Use the .env.example file as an example.

  • Frontend β€” GuruHub's application frontend.

    To work properly, fill in the .env file. Use the .env.example file as an example.

  • Shared β€” GuruHub's application common modules for reuse.

πŸ– Requirements

  • NodeJS (16.x.x);
  • NPM (8.x.x);
  • PostgreSQL (14.2)
  • run npx simple-git-hooks at the root of the project, before the start (it will set the pre-commit hook for any commits).

πŸƒβ€β™‚οΈ Simple Start

  1. npm run install:all at the root
  2. Fill ENVs
  3. npx simple-git-hooks at the root
  4. cd frontend && npm run start then cd backend && npm run start:dev
  5. Enjoy <3

Architecture

πŸ— Application Schema

App schema

πŸ’½ DB Schema

erDiagram

    users {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar email
      text password_hash
      text password_salt
      int group_id FK
  }

  groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar name
      varchar key
  }

  users_to_groups }|--|| groups : group_id
  users_to_groups }|--|| users : user_id
  users_to_groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      int group_id FK "unique (group_id user_id)"
      int user_id FK "unique (group_id user_id)"
  }

  permissions {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar name
      varchar key
  }

  groups_to_permissions }|--|| permissions : permission_id
  groups_to_permissions }|--|| groups : group_id
  groups_to_permissions {
      int id PK
      dateTime created_at
      dateTime updated_at
      int permission_id FK "unique (permission_id group_id)"
      int group_id FK "unique (permission_id group_id)"
  }

  user_details ||--|| users : user_id
  user_details ||--|| files : avatar_file_id
  user_details {
      int id PK
      dateTime created_at
      dateTime updated_at
      int user_id FK
      varchar first_name
      varchar last_name
      varchar gender
      int avatar_file_id FK
      date date_of_birth
      float money_balance
  }

  courses ||--|| vendors : vendor_id
  courses }|--|| course_categories : course_category_id
  courses {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar title
      text description
      varchar url
      int vendor_id FK
      int course_category_id FK
  }

  course_modules }|--|| courses : course_id
  course_modules {
      int id PK
      dateTime created_at
      dateTime updated_at
      int course_id FK
      int module_index
      varchar title
      text description
  }

  course_categories {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar name
      varchar key
  }

  vendors {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar name
      varchar key
  }

  mentees_to_mentors }|--|| courses : course_id
  mentees_to_mentors }|--|| users : mentor_id
  mentees_to_mentors }|--|| users : mentee_id
  mentees_to_mentors {
      int id PK
      dateTime created_at
      dateTime updated_at
      int course_id FK
      int mentor_id FK
      int mentee_id FK
      enum status
  }

  tasks }|--|| mentees_to_mentors : mentees_to_mentors_id
  tasks }|--|| course_modules : module_id
  tasks {
    int id PK
    dateTime created_at
    dateTime updated_at
    int mentees_to_mentors_id FK
    int module_id FK
    enum status
  }

  interviews }|--o| users : interviewer_user_id
  interviews }|--|| users : interviewee_user_id
  interviews }|--|| course_categories : course_categories_id
  interviews {
    int id PK
    dateTime created_at
    dateTime updated_at
    dateTime interview_date
    int interviewer_user_id FK
    int interviewee_user_id FK
    int category_id FK
    enum status
  }

  interview_notes }|--|| interviews : interview_id
  interview_notes }|--|| users : author_id
  interview_notes {
    int id PK
    dateTime created_at
    dateTime updated_at
    int interview_id FK
    int author_id FK
    text note
  }

  files ||--|| user_details : avatar_url
  files {
    int id PK
    dateTime created_at
    dateTime updated_at
    varchar url
    varchar content_type
  }

  courses_to_mentors }|--|| courses : course_id
  courses_to_mentors }|--|| users : user_id
  courses_to_mentors {
    int id PK
    dateTime created_at
    dateTime updated_at
    int students_count
    int user_id FK
    int course_id FK
  }

  chat_messages }|--|| users : sender_id
  chat_messages }|--|| users : receiver_id
  chat_messages {
    int id PK
    dateTime created_at
    dateTime updated_at
    int sender_id FK
    int receiver_id FK
    text message
    uuid chat_id
  }

  task_notes }|--|| tasks : task_id
  task_notes }|--|| users : author_id
  task_notes {
    int id PK
    dateTime created_at
    dateTime updated_at
    int task_id FK
    int author_id FK
    enum status
  }

  course_categories_prices ||--|| course_categories : category_id
  course_categories_prices {
    int id PK
    dateTime created_at
    dateTime updated_at
    int category_id FK
    float price
  }

  transactions }|--|| users : sender_id
  transactions }|--|| users : receiver_id
  transactions {
    int id PK
    dateTime created_at
    dateTime updated_at
    int sender_id FK
    int receiver_id FK
    float amount
    enum status
}
Loading

πŸ§‘β€πŸ’» CI

πŸ—œ Tools

πŸŒ‘ Backend

πŸŒ• Frontend

πŸ₯Š Code quality

  • simple-git-hooks β€” a tool that lets you easily manage git hooks.
  • lint-staged β€” run linters on git staged files.
  • editorconfig β€” helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
  • prettier β€” an opinionated code formatter.
  • ls-lint β€” file and directory name linter.
  • eslint – find problems in your JS code
  • stylelint – Find and fix problems in your CSS code

πŸ—ž Git

πŸ“Š Branches

  • production - production source code.
  • development - staging source code.

πŸ‘πŸ‘Ž Pull Request flow

<project-prefix>-<ticket-number>: <ticket-title>
Example:

blog-5: Add form component

🌳 Branch flow

<type>/<project-prefix><ticket-number>-<short-desc>
Types:
  • task
  • fix
Examples:
  • task/design5-add-signin-page
  • task/blog12-add-filters
  • fix/design16-fix-signup-validation

πŸ—‚ Commit flow

<project-prefix>-<ticket-number>: <modifier> <desc>
Modifiers:
  • + (add)
  • * (edit)
  • - (remove)
Examples:
  • blog-5: + form component
  • design-12: * filter markup
  • blog-16: - require prop for nickname field

AWS

πŸ“ Simple Storage Service (S3):

  • Bucket for files should have public access policy

πŸ“¦ CD

Handled by GitHub Actions.