# solvro/web-eventownik-v2 architecture

> Architecture diagram of the GitHub repository solvro/web-eventownik-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/solvro/web-eventownik-v2
- Repository: https://github.com/solvro/web-eventownik-v2

## Overview

##### Project type and purpose
- From the file tree and README, this is a full‑stack web application called **Eventownik** built with **Next.js 13** (App Router), **React**, **TypeScript** and **Tailwind CSS**.
- Purpose: to support event organization (creating events, forms, participants, emails, triggers).

##### File structure
- **src/app/**: Next.js App Router pages and server/client components, with nested dynamic routes for events, forms, users.
- **components/** & **atoms/**: shared UI components and state atoms.
- **hooks/**: custom React hooks (e.g. use-toast).
- **lib/**: data‑access functions (api.ts, dal.ts), session management, email logic.
- **middleware.ts**: global request handling (auth, redirects).
- **types/**: domain models (events, forms, participants, emails).
- Root config: Next.js config, ESLint, Husky, GitHub workflows, env example.

##### README for additional insights
- Tech stack calls out Next.js, React, Tailwind, TypeScript, and deployment via Coolify.
- No explicit backend microservice; likely Next.js serverless functions handle both front and back logic.
- Features include personalized trigger emails (implies integration with an email service).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client (Browser UI)"
        direction TB
        Pages["src/app/page.tsx"]:::frontend
        Components["src/components/"]:::frontend
        UIPrimitives["src/components/ui/"]:::frontend
        Atoms["src/atoms/"]:::frontend
        ToastHook["src/hooks/use-toast.ts"]:::frontend
    end

    subgraph "Next.js Server (SSR & API Routes)"
        direction TB
        LayoutRoot["src/app/layout.tsx"]:::backend
        LayoutDashboard["src/app/dashboard/layout.tsx"]:::backend
        AuthActions["src/app/auth/actions.ts"]:::backend
        EventActions["src/app/[eventSlug]/actions.ts"]:::backend
        FormUserActions["src/app/[eventSlug]/[formSlug]/[userId]/actions.ts"]:::backend
        CreateEventActions["src/app/dashboard/(create-event)/actions.ts"]:::backend
        EventsEmailsActions["src/app/dashboard/events/[id]/emails/actions.ts"]:::backend
        EventsFormsActions["src/app/dashboard/events/[id]/forms/actions.ts"]:::backend
        EventsParticipantsActions["src/app/dashboard/events/[id]/participants/actions.ts"]:::backend
        EventsSettingsActions["src/app/dashboard/events/[id]/settings/actions.ts"]:::backend
        Middleware["src/middleware.ts"]:::backend
    end

    subgraph "Data Access Layer (DAL)"
        direction TB
        DAL["src/lib/dal.ts"]:::data
    end

    subgraph "API Layer (Client-Server Bridge)"
        direction TB
        API["src/lib/api.ts"]:::api
    end

    subgraph "Email Service Integration"
        direction TB
        EmailsLib["src/lib/emails.ts"]:::service
    end

    subgraph "Authentication & Session Management"
        direction TB
        SessionLib["src/lib/session.ts"]:::auth
        AuthRoutes["src/app/auth/"]:::auth
        MiddlewareAuth["src/middleware.ts"]:::auth
    end

    subgraph "Domain Types"
        direction TB
        EventType["src/types/event.ts"]:::data
        FormType["src/types/form.ts"]:::data
        ParticipantType["src/types/participant.ts"]:::data
        EmailType["src/types/emails.ts"]:::data
        AuthType["src/types/auth.ts"]:::data
        CoOrganizerType["src/types/co-organizer.ts"]:::data
        AttributesType["src/types/attributes.ts"]:::data
        SchemasType["src/types/schemas.ts"]:::data
    end

    subgraph "Database"
        direction TB
        DB[(Database)]:::database
    end

    subgraph "External Services"
        direction TB
        EmailService[/"Email Service"/]:::external
    end

    %% Connections
    Pages -->|HTTP Requests| LayoutRoot
    Components --> LayoutRoot
    UIPrimitives --> LayoutRoot
    Atoms --> LayoutRoot
    ToastHook --> LayoutRoot

    LayoutRoot -->|SSR & API Calls| AuthActions
    LayoutRoot --> EventActions
    LayoutRoot --> FormUserActions
    LayoutDashboard --> CreateEventActions
    LayoutDashboard --> EventsEmailsActions
    LayoutDashboard --> EventsFormsActions
    LayoutDashboard --> EventsParticipantsActions
    LayoutDashboard --> EventsSettingsActions
    AuthActions --> SessionLib
    EventActions --> DAL
    FormUserActions --> DAL
    CreateEventActions --> DAL
    EventsEmailsActions --> DAL
    EventsFormsActions --> DAL
    EventsParticipantsActions --> DAL
    EventsSettingsActions --> DAL
    Middleware -->|Auth Guard| AuthActions
    MiddlewareAuth -->|Auth Guard| EventActions

    DAL -->|CRUD| DB
    API -->|Client API| LayoutRoot
    API -->|Server API| DAL
    EmailsLib -->|SMTP/HTTP| EmailService
    LayoutRoot -->|Invoke Emails| EmailsLib

    %% Click Events
    click Pages "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/page.tsx"
    click Components "https://github.com/solvro/web-eventownik-v2/tree/main/src/components/"
    click UIPrimitives "https://github.com/solvro/web-eventownik-v2/tree/main/src/components/ui/"
    click Atoms "https://github.com/solvro/web-eventownik-v2/tree/main/src/atoms/"
    click ToastHook "https://github.com/solvro/web-eventownik-v2/blob/main/src/hooks/use-toast.ts"
    click LayoutRoot "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/layout.tsx"
    click LayoutDashboard "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/dashboard/layout.tsx"
    click AuthActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/auth/actions.ts"
    click EventActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/[eventSlug]/actions.ts"
    click FormUserActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/[eventSlug]/[formSlug]/[userId]/actions.ts"
    click CreateEventActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/dashboard/(create-event)/actions.ts"
    click EventsEmailsActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/dashboard/events/[id]/emails/actions.ts"
    click EventsFormsActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/dashboard/events/[id]/forms/actions.ts"
    click EventsParticipantsActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/dashboard/events/[id]/participants/actions.ts"
    click EventsSettingsActions "https://github.com/solvro/web-eventownik-v2/blob/main/src/app/dashboard/events/[id]/settings/actions.ts"
    click Middleware "https://github.com/solvro/web-eventownik-v2/blob/main/src/middleware.ts"
    click DAL "https://github.com/solvro/web-eventownik-v2/blob/main/src/lib/dal.ts"
    click API "https://github.com/solvro/web-eventownik-v2/blob/main/src/lib/api.ts"
    click EmailsLib "https://github.com/solvro/web-eventownik-v2/blob/main/src/lib/emails.ts"
    click SessionLib "https://github.com/solvro/web-eventownik-v2/blob/main/src/lib/session.ts"
    click AuthRoutes "https://github.com/solvro/web-eventownik-v2/tree/main/src/app/auth/"
    click MiddlewareAuth "https://github.com/solvro/web-eventownik-v2/blob/main/src/middleware.ts"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#000,stroke-width:1px
    classDef backend fill:#DFFFD0,stroke:#000,stroke-width:1px
    classDef data fill:#FFE0B2,stroke:#000,stroke-width:1px
    classDef api fill:#E1BEE7,stroke:#000,stroke-width:1px
    classDef service fill:#EDE7F6,stroke:#000,stroke-width:1px
    classDef auth fill:#FFCDD2,stroke:#000,stroke-width:1px
    classDef database fill:#FFECB3,stroke:#000,stroke-width:1px
    classDef external fill:#C8E6C9,stroke:#000,stroke-width:1px
```
