# sway-developer/psycho-prisma architecture

> Architecture diagram of the GitHub repository sway-developer/psycho-prisma, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sway-developer/psycho-prisma
- Repository: https://github.com/sway-developer/psycho-prisma

## Overview

This is a Russian-language personnel assessment and questionnaire platform. Users register or sign in, browse forms and tests, submit responses, and staff review user records, submissions, calculated test summaries, and archived summaries. The graph preserves these distinct workflows and the documented calculation layer. Source excerpts show authentication, form discovery, submission persistence, and summary calculations; several dashboard and runner modules are unsampled, so their internal calls are not inferred.

Main entry points: [`src/utils/database.ts`](https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/database.ts) (Prisma database), [`src/app/dashboard/summary/[userId]/page.tsx`](https://github.com/sway-developer/psycho-prisma/blob/master/src/app/dashboard/summary/%5BuserId%5D/page.tsx) (User test summary), [`src/actions/form-submission`](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/form-submission) (Form submissions), [`src/actions/test-submission`](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/test-submission) (Test submissions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_sign_in_ui["Sign-in form<br/>[sign-in-form.tsx]"]
  node_sign_up_ui["Registration form<br/>[sign-up-form.tsx]"]
  node_auth_actions["Authentication actions"]
  node_auth_service["Session authentication<br/>[authentication.ts]"]
end

subgraph group_assessment["Assessments"]
  node_form_catalog["Form catalog<br/>[page.tsx]"]
  node_form_actions["Form actions"]
  node_form_runner["Form runner"]
  node_form_submission_actions["Form submissions"]
  node_test_runner["Test runner"]
  node_test_submission_actions["Test submissions"]
end

subgraph group_review["Review and administration"]
  node_dashboard["Dashboard overview"]
  node_user_admin["User administration"]
  node_submission_review["Submission review"]
  node_test_summary["User test summary<br/>[page.tsx]"]
  node_archive["Summary archive"]
  node_user_actions["User actions"]
end

subgraph group_storage["Persistence and calculation"]
  node_grade_strategy["Grade strategy<br/>[grade-strategy.ts]"]
  node_prisma[("Prisma database<br/>[database.ts]")]
end

node_user(("User"))

node_user -->|"signs in"| node_sign_in_ui
node_user -->|"registers"| node_sign_up_ui
node_sign_in_ui -->|"submits credentials"| node_auth_actions
node_auth_actions -->|"checks user"| node_prisma
node_auth_actions -->|"creates session"| node_auth_service
node_auth_service -->|"validates user"| node_prisma
node_user -->|"browses forms"| node_form_catalog
node_form_catalog -->|"loads forms"| node_form_actions
node_form_actions -->|"reads forms"| node_prisma
node_form_runner -.->|"uploads response"| node_form_submission_actions
node_form_submission_actions -->|"stores response"| node_prisma
node_form_submission_actions -->|"checks session"| node_auth_service
node_test_runner -.->|"uploads results"| node_test_submission_actions
node_test_submission_actions -->|"stores submission"| node_prisma
node_test_submission_actions -->|"checks session"| node_auth_service
node_test_summary -->|"loads user"| node_user_actions
node_test_summary -->|"loads submissions"| node_test_submission_actions
node_test_summary -->|"calculates summary"| node_grade_strategy
node_user_actions -->|"reads user"| node_prisma
node_archive -.->|"manages entries"| node_prisma
node_user_admin -.->|"manages users"| node_user_actions
node_submission_review -.->|"reviews responses"| node_form_submission_actions
node_dashboard -.->|"offers summaries"| node_test_summary

click node_sign_in_ui "https://github.com/sway-developer/psycho-prisma/blob/master/src/app/auth/sign-in/components/sign-in-form.tsx"
click node_sign_up_ui "https://github.com/sway-developer/psycho-prisma/blob/master/src/app/auth/sign-up/components/sign-up-form.tsx"
click node_auth_actions "https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/auth"
click node_auth_service "https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/authentication.ts"
click node_form_catalog "https://github.com/sway-developer/psycho-prisma/blob/master/src/app/forms/page.tsx"
click node_form_actions "https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/form"
click node_form_runner "https://github.com/sway-developer/psycho-prisma/tree/master/src/app/forms/%5BformId%5D"
click node_form_submission_actions "https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/form-submission"
click node_test_runner "https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard/forms/%5BformId%5D/run"
click node_test_submission_actions "https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/test-submission"
click node_dashboard "https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard"
click node_user_admin "https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard/users"
click node_submission_review "https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard/forms/%5BformId%5D/results"
click node_test_summary "https://github.com/sway-developer/psycho-prisma/blob/master/src/app/dashboard/summary/%5BuserId%5D/page.tsx"
click node_archive "https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/summary"
click node_user_actions "https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/user"
click node_grade_strategy "https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/strategies/grade-strategy.ts"
click node_prisma "https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/database.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sign_in_ui,node_sign_up_ui,node_auth_actions,node_auth_service,node_user toneBlue
class node_form_catalog,node_form_actions,node_form_runner,node_form_submission_actions,node_test_runner,node_test_submission_actions toneAmber
class node_dashboard,node_user_admin,node_submission_review,node_test_summary,node_archive,node_user_actions toneMint
class node_grade_strategy,node_prisma toneRose
```

## Components

### Identity

- [Sign-in form](https://github.com/sway-developer/psycho-prisma/blob/master/src/app/auth/sign-in/components/sign-in-form.tsx): `src/app/auth/sign-in/components/sign-in-form.tsx`
- [Registration form](https://github.com/sway-developer/psycho-prisma/blob/master/src/app/auth/sign-up/components/sign-up-form.tsx): `src/app/auth/sign-up/components/sign-up-form.tsx`
- [Authentication actions](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/auth): `src/actions/auth`
- [Session authentication](https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/authentication.ts): `src/utils/authentication.ts`

### Assessments

- [Form catalog](https://github.com/sway-developer/psycho-prisma/blob/master/src/app/forms/page.tsx): `src/app/forms/page.tsx`
- [Form actions](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/form): `src/actions/form`
- [Form runner](https://github.com/sway-developer/psycho-prisma/tree/master/src/app/forms/%5BformId%5D): `src/app/forms/[formId]`
- [Form submissions](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/form-submission): `src/actions/form-submission`
- [Test runner](https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard/forms/%5BformId%5D/run): `src/app/dashboard/forms/[formId]/run`
- [Test submissions](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/test-submission): `src/actions/test-submission`

### Review and administration

- [Dashboard overview](https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard): `src/app/dashboard`
- [User administration](https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard/users): `src/app/dashboard/users`
- [Submission review](https://github.com/sway-developer/psycho-prisma/tree/master/src/app/dashboard/forms/%5BformId%5D/results): `src/app/dashboard/forms/[formId]/results`
- [User test summary](https://github.com/sway-developer/psycho-prisma/blob/master/src/app/dashboard/summary/%5BuserId%5D/page.tsx): `src/app/dashboard/summary/[userId]/page.tsx`
- [Summary archive](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/summary): `src/actions/summary`
- [User actions](https://github.com/sway-developer/psycho-prisma/tree/master/src/actions/user): `src/actions/user`

### Persistence and calculation

- [Grade strategy](https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/strategies/grade-strategy.ts): `src/utils/strategies/grade-strategy.ts`
- [Prisma database](https://github.com/sway-developer/psycho-prisma/blob/master/src/utils/database.ts): `src/utils/database.ts`

### Other components

- **User**

## Connections

- User → Sign-in form: signs in
- User → Registration form: registers
- Sign-in form → Authentication actions: submits credentials (evidence: `src/app/auth/sign-in/components/sign-in-form.tsx`)
- Authentication actions → Prisma database: checks user (evidence: `src/actions/auth/sign-in-action.ts`)
- Authentication actions → Session authentication: creates session (evidence: `src/actions/auth/sign-in-action.ts`)
- Session authentication → Prisma database: validates user (evidence: `src/utils/authentication.ts`)
- User → Form catalog: browses forms (evidence: `src/app/forms/page.tsx`)
- Form catalog → Form actions: loads forms (evidence: `src/app/forms/page.tsx`)
- Form actions → Prisma database: reads forms (evidence: `src/actions/form/find-all-forms-action.ts`)
- Form runner → Form submissions: uploads response
- Form submissions → Prisma database: stores response (evidence: `src/actions/form-submission/upload-form-submission-action.ts`)
- Form submissions → Session authentication: checks session (evidence: `src/actions/form-submission/upload-form-submission-action.ts`)
- Test runner → Test submissions: uploads results
- Test submissions → Prisma database: stores submission (evidence: `src/actions/test-submission/upload-test-submission-action.ts`)
- Test submissions → Session authentication: checks session (evidence: `src/actions/test-submission/upload-test-submission-action.ts`)
- User test summary → User actions: loads user (evidence: `src/app/dashboard/summary/[userId]/page.tsx`)
- User test summary → Test submissions: loads submissions (evidence: `src/app/dashboard/summary/[userId]/page.tsx`)
- User test summary → Grade strategy: calculates summary (evidence: `src/app/dashboard/summary/[userId]/page.tsx`)
- User actions → Prisma database: reads user (evidence: `src/actions/user/find-user-by-id-action.ts`)
- Summary archive → Prisma database: manages entries
- User administration → User actions: manages users (evidence: `src/app/dashboard/users/[userId]/page.tsx`)
- Submission review → Form submissions: reviews responses
- Dashboard overview → User test summary: offers summaries (evidence: `src/app/dashboard/summary/[userId]/page.tsx`)
