Skip to content

BinaryStudioAcademy/bsa-2023-writorium

Repository files navigation

Writorium

ℹ️ General Info

This is the repository responsible for Writorium's apps.

🏭 Applications

  • Backend — Writorium's application backend.

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

  • Frontend — Writorium's application frontend.

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

  • Shared — Writorium's application common modules for reuse.

🖍 Requirements

  • NodeJS (18.x.x);
  • NPM (9.x.x);
  • PostgreSQL (15.4)
  • 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 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
  }
Loading

🌑 Backend

🌕 Frontend

🥊 Code quality

  • quality-criteria rules - rules that should be followed during application development.
  • simple-git-hooks — a tool that lets you easily manage git hooks.
  • lint-staged — run linters on git staged files.
  • dangerjs — automate common code review chores.
  • commitlint — helps your team adhere to a commit convention.
  • 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.

🧑‍💻 CI

🗞 Git

🏅 Pull Request flow

<project-prefix>-<issue-number>: <ticket-title>
Example
  • wr-5: Add Articles page

🌳 Branch flow

<type>/<project-prefix>-<issue-number>-<short-desc>
Types
  • task
  • fix
Examples
  • task/wr-5-add-articles-page
  • task/wr-12-add-create-article-flow
  • fix/wr-16-writer-articles-display

🗂 Commit flow

<project-prefix>-<issue-number>: <modifier> <description>
Modifiers
  • + (add)
  • * (edit)
  • - (remove)
Examples
  • wr-5: + articles feed page
  • wr-12: * create article form
  • wr-16: - other writers articles on my articles tab

📦 CD

Handled by GitHub Actions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages