Skip to content

Application for collecting and analyzing developers activity on git based projects.

Notifications You must be signed in to change notification settings

BinaryStudioAcademy/bsa-2024-gitfit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitFit

Collect and analyze developers activity on projects.

1. Introduction

1.1 Useful Links

2. Domain

The application collects and analyzes developers' activity on different projects based on GIT commits.

3. Requirements

4. Database Schema

erDiagram
   users {
      int id PK
      dateTime created_at
      dateTime updated_at
      dateTime deleted_at
      citext email
      text password_hash
      text password_salt
      varchar name
      int avatar_file_id FK
   }

   user_groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar key UK
      varchar name UK
   }

   users_to_user_groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      int user_group_id FK
      int user_id FK
   }

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

   user_groups_to_permissions {
      int id PK
      dateTime created_at
      dateTime updated_at
      int user_group_id FK
      int permission_id FK
   }

   projects {
      int id PK
      dateTime created_at
      dateTime updated_at
      dateTime last_activity_date
      varchar name UK
      varchar description
   }

   user_groups_to_projects {
      int id PK
      dateTime created_at
      dateTime updated_at
      int user_group_id FK
      int project_id FK
   }

   project_groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar key UK
      varchar name UK
   }

   users_to_project_groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      int project_group_id FK
      int user_id FK
   }

   project_permissions {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar key UK
      varchar name UK
   }

   project_groups_to_project_permissions {
      int id PK
      dateTime created_at
      dateTime updated_at
      int project_group_id FK
      int project_permission_id FK
   }

   projects_to_project_groups {
      int id PK
      dateTime created_at
      dateTime updated_at
      int project_group_id FK
      int project_id FK
   }

   project_api_keys {
      int id PK
      dateTime created_at
      dateTime updated_at
      int project_id FK
      int created_by_user_id FK
      int updated_by_user_id FK
      varchar encrypted_key UK
   }

   contributors {
      int id PK
      dateTime created_at
      dateTime updated_at
      dateTime hidden_at
      varchar name
   }

   git_emails {
      int id PK
      dateTime created_at
      dateTime updated_at
      int contributor_id FK
      varchar email
   }

   files {
      int id PK
      dateTime created_at
      dateTime updated_at
      varchar url
      enum content_type
   }

   activity_logs {
      int id PK
      dateTime created_at
      dateTime updated_at
      dateTime date
      int git_email_id FK
      int project_id FK
      int created_by_user_id FK
      int commits_number
   }

   notifications {
      int id PK
      dateTime created_at
      dateTime updated_at
      int receiver_user_id FK
      enum status
      varchar payload
   }

   files }|--|o users : avatar_file_id

   user_groups ||--|{ user_groups_to_permissions : user_group_id
   permissions ||--|{ user_groups_to_permissions : permission_id

   user_groups ||--|{ user_groups_to_projects : user_group_id
   projects ||--|{ user_groups_to_projects : project_id

   users ||--|{ users_to_user_groups : user_id
   user_groups ||--|{ users_to_user_groups : user_group_id

   project_groups ||--|{ project_groups_to_project_permissions : project_group_id
   project_permissions ||--|{ project_groups_to_project_permissions : project_permission_id

   project_groups ||--|{ projects_to_project_groups : project_group_id
   projects ||--|{ projects_to_project_groups : project_id

   users ||--|{ users_to_project_groups : user_id
   project_groups ||--|{ users_to_project_groups : project_group_id

   project_api_keys }|--|| users : "created_by_user_id, updated_by_user_id"
   project_api_keys }|--|| projects : project_id

   contributors ||--|{ git_emails : contributor_id

   git_emails }|--|| activity_logs : git_email_id
   projects }|--|| activity_logs : project_id
   users }|--|| activity_logs : created_by_user_id

   users ||--|{ notifications : receiver_user_id
Loading

5. Architecture

TBD

5.1 Global

5.1.1 Technologies

  1. Typescript
  2. npm workspaces

5.2 Frontend

5.2.1 Technologies

  1. React — a frontend library
  2. Redux + Redux Toolkit — a state manager

5.2.2 Folder Structure

  1. assets - static assets (images, global styles)

  2. libs - shared libraries and utilities

    2.1 components - plain react components

    2.2 enums

    2.3 helpers

    2.4 hooks

    2.5 modules - separate features or functionalities

    2.6 types

  3. modules - separate app features or functionalities

  4. pages - app pages

5.3 Backend

5.3.1 Technologies

  1. Fastify — a backend framework
  2. Knex — a query builder
  3. Objection — an ORM

5.3.2 Folder Structure

  1. db - database data (migrations, seeds)

  2. libs - shared libraries and utilities

    2.1 enums

    2.2 exceptions

    2.3 helpers

    2.4 modules - separate features or functionalities

    2.5 types

  3. modules - separate app features or functionalities

5.4 Shared Package

5.4.1 Reason

As we are already using js on both frontend and backend it would be useful to share some contracts and code between them.

5.4.2 Technologies

  1. Zod — a schema validator

6. How to Run

6.1 Manually

  1. Create and fill all .env files. These files are:
  • apps/frontend/.env
  • apps/backend/.env

You should use .env.example files as a reference.

  1. Install dependencies: npm install.

  2. Install pre-commit hooks: npx simple-git-hooks. This hook is used to verify code style on commit.

  3. Build shared: npm run build:shared

  4. Run database. You can run it by installing postgres on your computer.

  5. Apply migrations: npm run migrate:dev -w apps/backend

  6. Run backend: npm run start:dev -w apps/backend

  7. Run frontend: npm run start:dev -w apps/frontend

7. Development Flow

7.1 Pull Request Flow

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

For the full list of types check Conventional Commits

Examples:

  • feat: add dashboard screen gf-123

7.2 Branch Flow

<issue-number>-<type>-<short-desc>

Examples:

  • 123-feat-add-dashboard
  • 12-feat-add-user-flow
  • 34-fix-user-flow

7.3 Commit Flow

We use Conventional Commits to handle commit messages

<type>: <description> <project-prefix>-<issue-number>

Examples:

  • feat: add dashboard component gf-45
  • fix: update dashboard card size gf-212

8. Deployment

CI/CD implemented using GitHub Actions

About

Application for collecting and analyzing developers activity on git based projects.

Resources

Stars

Watchers

Forks

Packages

No packages published