BinaryStudioAcademy / bsa-2023-writorium

5 stars 3 forks source link

Writorium

ℹ️ General Info

This is the repository responsible for Writorium's apps.

🏭 Applications

πŸ– Requirements

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

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

PS: If you're facing such kind of strange errors from eslint-plugin eslint-plugin-errors

Then you may fix it with such solution (for VS Code IDE):

  1. At projects root create .vscode folder
  2. Place there settings.json file
  3. Add eslint.workingDirectories rule in settings.json file
  {
    "eslint.workingDirectories": ["./", "./backend", "./frontend", "./shared"]
  }

vs-code-project-config

πŸ— Architecture

πŸ›– Application Schema

writorium drawio

πŸ’½ DB Schema


erDiagram

  users {
    int id PK
    dateTime created_at
    dateTime updated_at
    citext email "may have email constraint"
    text password_hash
    text password_salt
  }

  user_details ||--|| users : user_id
  user_details ||..|o files : avatar_id
  user_details {
    int id PK
    dateTime created_at
    dateTime updated_at
    int user_id FK
    varchar first_name
    varchar last_name
    int avatar_id FK "may be null if user has no avatar"
  }

  achievements {
    int id PK
    dateTime created_at
    dateTime updated_at
    varchar key "inner usage key value"
    varchar name "readable name value"
    text description "achievement description"
    int breakpoint FK
    text reference_table FK "referencing to table with records for achievements"
  }

  users_achievements ||--|| achievements : achievement_id
  users_achievements }o..|| users : user_id
  users_achievements {
    int id PK
    dateTime created_at
    dateTime updated_at
    int achievement_id FK
    int user_id FK
  }

  files {
    int id PK
    dateTime created_at
    dateTime update_at
    text url
  }

  articles }o--|| users : user_id
  articles ||..|o prompts : prompt_id
  articles ||--|| genres : genre_id
  articles ||..|o files : cover_id
  articles {
    int id PK
    dateTime created_at
    dateTime update_at
    text text "article text"
    int read_time "nullable"
    int user_id FK
    int genre_id FK
    int prompt_id FK "nullable"
    int cover_id FK "nullable"
    dateTime deleted_at "nullable"
  }

  comments }o..|| users : user_id
  comments ||--|| articles : article_id
  comments {
    int id PK
    dateTime created_at
    dateTime update_at
    text text "comment text"
    int user_id FK
    int article_id FK
  }

  article_reactions }o..|| users : user_id
  article_reactions ||--|| articles : article_id
  article_reactions {
    int id PK
    dateTime created_at
    dateTime update_at
    boolean is_like "in case if we'd have dislikes"
    int user_id FK
    int article_id FK
  }

  prompts ||..|o genres : genre_id
  prompts {
    int id PK
    dateTime created_at
    dateTime update_at
    text character "nullable"
    text setting "nullable"
    text situation "nullable"
    enum type "daily | manual"
    int genre_id FK "nullable"
  }

  genres {
    int id PK
    dateTime created_at
    dateTime update_at
    varchar key "inner usage key value"
    varchar name "readable name value"
  }

  articles_views }o..|| users : user_id
  articles_views ||--|| articles : article_id
  articles_views {
    int id PK
    dateTime created_at
    dateTime update_at
    int article_id FK
    int viewed_by_id FK
  }

  favoured_user_articles }o..|| users : user_id
  favoured_user_articles ||--|| articles : article_id
  favoured_user_articles {
    int article_id PK
    int user_id PK
    dateTime created_at
    dateTime update_at
  }

  user_following_authors }o--||  users : user_id
  user_following_authors {
    int id PK
    dateTime created_at
    dateTime update_at
    int user_id FK
    int author_id FK
  }

πŸŒ‘ Backend

πŸŒ• Frontend

πŸ₯Š Code quality

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

πŸ—ž Git

πŸ… Pull Request flow

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

🌳 Branch flow

<type>/<project-prefix>-<issue-number>-<short-desc>
Types
Examples

πŸ—‚ Commit flow

<project-prefix>-<issue-number>: <modifier> <description>
Modifiers
Examples

πŸ“¦ CD

Handled by GitHub Actions.