# zenika/skillz architecture

> Architecture diagram of the GitHub repository zenika/skillz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zenika/skillz
- Repository: https://github.com/zenika/skillz

## Overview

##### Main Components

a. Frontend Layer:
- Next.js Web Application (main user interface)
- Key features: Profile management, Skills tracking, Certifications, Admin panels
- Authentication system (Auth0 integration)

b. Backend Services:
- Hasura GraphQL Engine (main API layer)
- PostgreSQL Database
- Slack Bot Service
- Achievement Service

c. External Services:
- Auth0 (authentication)
- Slack API
- Analytics Service (mentioned but separate)

##### Key Relationships to Highlight

a. Data Flow:
- User interactions through web app → GraphQL queries/mutations
- Hasura → PostgreSQL database operations
- Slack Bot → Hasura GraphQL interactions
- Achievement service → User achievements processing

b. Authentication Flow:
- Auth0 → Web Application
- JWT token validation → Hasura

##### Specific Architecture Elements

a. Database Structure:
- Main tables: Users, Skills, Categories, Certifications, Topics
- Views for aggregated data
- Relationships between entities

b. API Layer:
- GraphQL endpoints
- REST endpoints for specific services
- Hasura permissions and business rules

**[Client Layer]**
- ↓ ↑
**[Authentication Layer]**
- ↓ ↑
**[API Gateway/Hasura]**
- ↓ ↑
**[Service Layer]**
- ↓ ↑
**[Database Layer]**

##### Important Details

a. Infrastructure:
- Docker containers
- Development vs Production environments
- Migration system

b. Integration Points:
- Slack Bot integration
- Analytics service connection
- Auth0 authentication flow

##### Specific Implementation Notes

- Environment-specific configurations
- Monitoring and logging points

Remember to include the three main applications (Web App, Slack Bot, and Analytics) while showing how they interact through the shared Hasura/PostgreSQL backend. This will help developers understand both the overall system architecture and the specific components they need to work with.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        WA[Web Application]
        UI[UI Components]
        GC[GraphQL Client]
    end

    subgraph Auth
        A0[Auth0]
        AP[Auth Provider]
        LP[Login/Logout Pages]
    end

    subgraph API
        HGE[Hasura GraphQL Engine]
        AM[API Mutations]
        AQ[API Queries]
        AR[API Routes]
    end

    subgraph Services
        SB[Slack Bot]
        AS[Achievement Service]
        SC[Slack Commands]
        SA[Slack Actions]
    end

    subgraph Database
        PG[(PostgreSQL)]
        M[Migrations]
        MT[Metadata]
    end

    subgraph External
        SA0[Slack API]
        ANS[Analytics Service]
    end

    %% Relationships
    WA --> UI
    WA --> GC
    GC --> HGE
    UI --> AP
    AP --> A0
    LP --> A0
    A0 --> HGE
    HGE --> AM
    HGE --> AQ
    HGE --> AR
    HGE --> PG
    SB --> SC
    SB --> SA
    SB --> HGE
    AS --> HGE
    SB --> SA0
    M --> PG
    MT --> HGE

    %% Styling
    classDef frontend fill:#3498db
    classDef auth fill:#9b59b6
    classDef api fill:#2ecc71
    classDef service fill:#e67e22
    classDef database fill:#e74c3c
    classDef external fill:#f1c40f

    class WA,UI,GC frontend
    class A0,AP,LP auth
    class HGE,AM,AQ,AR api
    class SB,AS,SC,SA service
    class PG,M,MT database
    class SA0,ANS external

    %% Click events
    click WA "https://github.com/Zenika/skillZ/tree/main//src/pages"
    click UI "https://github.com/Zenika/skillZ/tree/main//src/components"
    click GC "https://github.com/Zenika/skillZ/tree/main//src/graphql"
    click AP "https://github.com/Zenika/skillZ/blob/main//src/providers/AuthProvider.tsx"
    click LP "https://github.com/Zenika/skillZ/blob/main//src/pages/login.tsx"
    click HGE "https://github.com/Zenika/skillZ/blob/main//hasura/config.yaml"
    click M "https://github.com/Zenika/skillZ/tree/main//hasura/migrations"
    click MT "https://github.com/Zenika/skillZ/tree/main//hasura/metadata"
    click SB "https://github.com/Zenika/skillZ/blob/main//bot-slack/app.js"
    click SC "https://github.com/Zenika/skillZ/tree/main//bot-slack/src/commands"
    click SA "https://github.com/Zenika/skillZ/tree/main//bot-slack/src/actions"
    click AS "https://github.com/Zenika/skillZ/blob/main//src/pages/api/achievement.ts"
    click AM "https://github.com/Zenika/skillZ/tree/main//src/graphql/mutations"
    click AQ "https://github.com/Zenika/skillZ/tree/main//src/graphql/queries"
    click AR "https://github.com/Zenika/skillZ/tree/main//src/pages/api"
```
