# informatyzacja/parliamentary-system architecture

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

- Interactive diagram: https://gitdiagram.com/informatyzacja/parliamentary-system
- Repository: https://github.com/informatyzacja/parliamentary-system

## Overview

##### Main Components

a. Frontend Layer (Next.js Application):
- Client-side components (React)
- Server-side rendering capabilities
- Authentication system (NextAuth)
- Internationalization system
- GraphQL client

b. Backend Layer (Strapi):
- REST/GraphQL API
- Content Management System
- Authentication/Authorization
- File management system
- Database models/content types

c. External Services:
- USOS Integration (University System)
- Google OAuth
- Translation service (Crowdin)

**[Client Layer]**
- ↓ ↑
**[API Gateway/CDN]**
- ↓ ↑
**[Frontend Server (Next.js)]**
- ↓ ↑
**[Backend Server (Strapi)]**
- ↓ ↑
**[Database Layer]**

##### Key Elements to Highlight

a. Data Flow:
- Authentication flow (USOS, Google OAuth)
- Document management flow
- Content delivery flow
- API communication patterns

b. Main Features:
- Meeting management
- Resolution handling
- Student management
- Term of office tracking
- Multilingual support

##### Important Architectural Patterns

a. Frontend Architecture:
- Pages structure (/meetings, /resolutions, /structure)
- Component hierarchy
- State management (atoms)
- API integration layer

b. Backend Architecture:
- Content type models
- Controller-Service pattern
- Authentication middleware
- File upload system

##### Infrastructure Components
- Docker containers
- Database storage
- File storage system
- CI/CD pipeline

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph "Frontend Server"
        NextJS["Next.js Server"]:::frontend
        Auth["Authentication System"]:::security
        I18N["Internationalization"]:::frontend
        GQLClient["GraphQL Client"]:::frontend
        Pages["Main Pages"]:::frontend
        Components["Frontend Components"]:::frontend
        
        NextJS --> Auth
        NextJS --> I18N
        NextJS --> GQLClient
        NextJS --> Pages
        NextJS --> Components
    end

    subgraph "Backend Server"
        Strapi["Strapi CMS"]:::backend
        ContentTypes["Content Types"]:::backend
        FileSystem["File Management"]:::backend
        APIConfig["API Configuration"]:::backend
        
        Strapi --> ContentTypes
        Strapi --> FileSystem
        Strapi --> APIConfig
    end

    subgraph "Feature Modules"
        Meetings["Meetings Module"]:::module
        Resolutions["Resolutions Module"]:::module
        Students["Students Module"]:::module
        TermOffice["Term of Office Module"]:::module
    end

    subgraph "External Services"
        USOS["USOS Integration"]:::external
        Google["Google OAuth"]:::external
        Crowdin["Translation Service"]:::external
    end

    subgraph "Infrastructure"
        Docker["Docker Containers"]:::infra
        Database[(Database)]:::storage
        FileStore[(File Storage)]:::storage
        CICD["CI/CD Pipeline"]:::infra
    end

    Browser --> NextJS
    NextJS <--> Strapi
    Strapi --> Database
    Strapi --> FileStore
    NextJS <--> USOS
    Auth <--> Google
    I18N <--> Crowdin

    %% Component Mappings
    click NextJS "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/web"
    click Auth "https://github.com/informatyzacja/parliamentary-system/blob/main/apps/web/src/pages/api/auth/[...nextauth].js"
    click GQLClient "https://github.com/informatyzacja/parliamentary-system/blob/main/apps/web/src/api/graphql.ts"
    click I18N "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/web/src/components/i18n"
    click Pages "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/web/src/pages"
    click Strapi "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/api"
    click ContentTypes "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/api/src/api"
    click FileSystem "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/api/public/uploads"
    click APIConfig "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/api/config"
    click Meetings "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/api/src/api/meeting"
    click Resolutions "https://github.com/informatyzacja/parliamentary-system/tree/main/apps/api/src/api/resolution"
    click Students "https://github.com/informatyzacja/parliamentary-system/blob/main/apps/api/src/api/queries/students.graphql"
    click TermOffice "https://github.com/informatyzacja/parliamentary-system/blob/main/apps/web/src/atoms/termOfOffice.atom.ts"
    click USOS "https://github.com/informatyzacja/parliamentary-system/blob/main/apps/web/src/providers/UsosProvider.ts"
    click Docker "https://github.com/informatyzacja/parliamentary-system/blob/main/docker-compose.yml"
    click CICD "https://github.com/informatyzacja/parliamentary-system/tree/main/.github/workflows"

    %% Styling
    classDef frontend fill:#3498db
    classDef backend fill:#2ecc71
    classDef external fill:#f1c40f
    classDef security fill:#e74c3c
    classDef storage fill:#95a5a6
    classDef infra fill:#7f8c8d
    classDef module fill:#9b59b6

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        External["External Service"]:::external
        Security["Security Component"]:::security
        Storage["Storage"]:::storage
        Infrastructure["Infrastructure"]:::infra
        Module["Feature Module"]:::module
    end
```
