# keirrysonmatheus/nexa architecture

> Architecture diagram of the GitHub repository keirrysonmatheus/nexa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keirrysonmatheus/nexa
- Repository: https://github.com/keirrysonmatheus/nexa

## Overview

Nexa is a social application where users authenticate, browse a feed, publish posts, and interact through likes, comments, and follows; profiles and search support discovery. The visible server routes and actions mediate profile and post changes, while Prisma provides database access and OneSignal handles documented web-push delivery. The README also documents login and registration, Google sign-in, image uploads, and notifications. Some post-interaction and notification implementation details are unsampled, so their links are marked unverified rather than treated as inspected.

Main entry points: [`app/client.ts`](https://github.com/keirrysonmatheus/nexa/blob/main/app/client.ts) (Prisma client), [`app/api/posts/route.ts`](https://github.com/keirrysonmatheus/nexa/blob/main/app/api/posts/route.ts) (Post API), [`actions/users.ts`](https://github.com/keirrysonmatheus/nexa/blob/main/actions/users.ts) (User actions), [`app/api/profile/route.ts`](https://github.com/keirrysonmatheus/nexa/blob/main/app/api/profile/route.ts) (Profile API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_signup["Sign-up form<br/>[signup-form.tsx]"]
  node_google["Google sign-in"]
  node_authclient["Auth client<br/>[auth-client.ts]"]
  node_authservice["Auth service<br/>[auth.ts]"]
  node_authroute["Auth route<br/>[route.ts]"]
end

subgraph group_social["Social content"]
  node_dashboard["Feed page<br/>[page.tsx]"]
  node_postsview["Posts view<br/>[posts.tsx]"]
  node_postactions["Post actions<br/>[posts.ts]"]
  node_postapi["Post API<br/>[route.ts]"]
  node_profilepage["User profile page<br/>[page.tsx]"]
  node_profileview["Profile view<br/>[user-profile.tsx]"]
  node_useractions["User actions<br/>[users.ts]"]
  node_profileapi["Profile API<br/>[route.ts]"]
end

subgraph group_discovery["Discovery"]
  node_searchpage["Search page<br/>[page.tsx]"]
  node_searchaction["Search action<br/>[search.ts]"]
end

subgraph group_platform["App services"]
  node_prisma["Prisma client<br/>[client.ts]"]
  node_postgres[("PostgreSQL")]
  node_uploads["Image storage<br/>[upload.ts]"]
end

subgraph group_delivery["Notifications"]
  node_onesignalinit["Push setup<br/>[OneSignalInit.tsx]"]
  node_onesignal["Push sender<br/>[onesignal.ts]"]
  node_onesignalservice["OneSignal"]
  node_notificationsapi["Notifications API<br/>[route.ts]"]
end

node_visitor(("User"))

node_visitor -->|"registers"| node_signup
node_signup -->|"submits to"| node_authclient
node_google -->|"signs in via"| node_authclient
node_authroute -->|"dispatches to"| node_authservice
node_authservice -->|"uses adapter"| node_prisma
node_prisma -->|"connects to"| node_postgres
node_dashboard -->|"renders"| node_postsview
node_postsview -->|"loads posts"| node_postactions
node_visitor -.->|"creates post"| node_postapi
node_postapi -->|"writes post"| node_prisma
node_postapi -->|"saves image"| node_uploads
node_profilepage -->|"loads profile"| node_useractions
node_profilepage -->|"renders"| node_profileview
node_profileview -->|"manages follows"| node_useractions
node_visitor -.->|"updates profile"| node_profileapi
node_profileapi -->|"updates user"| node_prisma
node_profileapi -->|"saves image"| node_uploads
node_searchpage -->|"searches via"| node_searchaction
node_useractions -->|"queries users"| node_prisma
node_useractions -->|"sends follow push"| node_onesignal
node_postapi -->|"sends post push"| node_onesignal
node_onesignalinit -.->|"initializes"| node_onesignalservice
node_onesignal -.->|"delivers push"| node_onesignalservice
node_visitor -.->|"likes and comments"| node_postactions
node_visitor -.->|"views notifications"| node_notificationsapi

click node_signup "https://github.com/keirrysonmatheus/nexa/blob/main/components/signup-form.tsx"
click node_google "https://github.com/keirrysonmatheus/nexa/blob/main/components/google-auth-button.tsx"
click node_authclient "https://github.com/keirrysonmatheus/nexa/blob/main/lib/auth-client.ts"
click node_authservice "https://github.com/keirrysonmatheus/nexa/blob/main/lib/auth.ts"
click node_authroute "https://github.com/keirrysonmatheus/nexa/blob/main/app/api/auth/%5B...all%5D/route.ts"
click node_dashboard "https://github.com/keirrysonmatheus/nexa/blob/main/app/dashboard/page.tsx"
click node_postsview "https://github.com/keirrysonmatheus/nexa/blob/main/components/posts.tsx"
click node_postactions "https://github.com/keirrysonmatheus/nexa/blob/main/actions/posts.ts"
click node_postapi "https://github.com/keirrysonmatheus/nexa/blob/main/app/api/posts/route.ts"
click node_profilepage "https://github.com/keirrysonmatheus/nexa/blob/main/app/users/%5Buser_apelido%5D/page.tsx"
click node_profileview "https://github.com/keirrysonmatheus/nexa/blob/main/components/user-profile.tsx"
click node_useractions "https://github.com/keirrysonmatheus/nexa/blob/main/actions/users.ts"
click node_profileapi "https://github.com/keirrysonmatheus/nexa/blob/main/app/api/profile/route.ts"
click node_searchpage "https://github.com/keirrysonmatheus/nexa/blob/main/app/busca/page.tsx"
click node_searchaction "https://github.com/keirrysonmatheus/nexa/blob/main/actions/search.ts"
click node_prisma "https://github.com/keirrysonmatheus/nexa/blob/main/app/client.ts"
click node_uploads "https://github.com/keirrysonmatheus/nexa/blob/main/lib/upload.ts"
click node_onesignalinit "https://github.com/keirrysonmatheus/nexa/blob/main/components/OneSignalInit.tsx"
click node_onesignal "https://github.com/keirrysonmatheus/nexa/blob/main/lib/onesignal.ts"
click node_notificationsapi "https://github.com/keirrysonmatheus/nexa/blob/main/app/api/notifications/route.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_signup,node_google,node_authclient,node_authservice,node_authroute,node_visitor toneBlue
class node_dashboard,node_postsview,node_postactions,node_postapi,node_profilepage,node_profileview,node_useractions,node_profileapi toneAmber
class node_searchpage,node_searchaction toneMint
class node_prisma,node_postgres,node_uploads toneRose
class node_onesignalinit,node_onesignal,node_onesignalservice,node_notificationsapi toneIndigo
```

## Components

### Identity

- [Sign-up form](https://github.com/keirrysonmatheus/nexa/blob/main/components/signup-form.tsx): `components/signup-form.tsx`
- [Google sign-in](https://github.com/keirrysonmatheus/nexa/blob/main/components/google-auth-button.tsx): `components/google-auth-button.tsx`
- [Auth client](https://github.com/keirrysonmatheus/nexa/blob/main/lib/auth-client.ts): `lib/auth-client.ts`
- [Auth service](https://github.com/keirrysonmatheus/nexa/blob/main/lib/auth.ts): `lib/auth.ts`
- [Auth route](https://github.com/keirrysonmatheus/nexa/blob/main/app/api/auth/%5B...all%5D/route.ts): `app/api/auth/[...all]/route.ts`

### Social content

- [Feed page](https://github.com/keirrysonmatheus/nexa/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Posts view](https://github.com/keirrysonmatheus/nexa/blob/main/components/posts.tsx): `components/posts.tsx`
- [Post actions](https://github.com/keirrysonmatheus/nexa/blob/main/actions/posts.ts): `actions/posts.ts`
- [Post API](https://github.com/keirrysonmatheus/nexa/blob/main/app/api/posts/route.ts): `app/api/posts/route.ts`
- [User profile page](https://github.com/keirrysonmatheus/nexa/blob/main/app/users/%5Buser_apelido%5D/page.tsx): `app/users/[user_apelido]/page.tsx`
- [Profile view](https://github.com/keirrysonmatheus/nexa/blob/main/components/user-profile.tsx): `components/user-profile.tsx`
- [User actions](https://github.com/keirrysonmatheus/nexa/blob/main/actions/users.ts): `actions/users.ts`
- [Profile API](https://github.com/keirrysonmatheus/nexa/blob/main/app/api/profile/route.ts): `app/api/profile/route.ts`

### Discovery

- [Search page](https://github.com/keirrysonmatheus/nexa/blob/main/app/busca/page.tsx): `app/busca/page.tsx`
- [Search action](https://github.com/keirrysonmatheus/nexa/blob/main/actions/search.ts): `actions/search.ts`

### App services

- [Prisma client](https://github.com/keirrysonmatheus/nexa/blob/main/app/client.ts): `app/client.ts`
- **PostgreSQL**
- [Image storage](https://github.com/keirrysonmatheus/nexa/blob/main/lib/upload.ts): `lib/upload.ts`

### Notifications

- [Push setup](https://github.com/keirrysonmatheus/nexa/blob/main/components/OneSignalInit.tsx): `components/OneSignalInit.tsx`
- [Push sender](https://github.com/keirrysonmatheus/nexa/blob/main/lib/onesignal.ts): `lib/onesignal.ts`
- **OneSignal**
- [Notifications API](https://github.com/keirrysonmatheus/nexa/blob/main/app/api/notifications/route.ts): `app/api/notifications/route.ts`

### Other components

- **User**

## Connections

- User → Sign-up form: registers (evidence: `components/signup-form.tsx`)
- Sign-up form → Auth client: submits to (evidence: `components/signup-form.tsx`)
- Google sign-in → Auth client: signs in via (evidence: `components/google-auth-button.tsx`)
- Auth route → Auth service: dispatches to (evidence: `app/api/auth/[...all]/route.ts`)
- Auth service → Prisma client: uses adapter (evidence: `lib/auth.ts`)
- Prisma client → PostgreSQL: connects to (evidence: `app/client.ts`)
- Feed page → Posts view: renders (evidence: `app/dashboard/page.tsx`)
- Posts view → Post actions: loads posts (evidence: `components/posts.tsx`)
- User → Post API: creates post
- Post API → Prisma client: writes post (evidence: `app/api/posts/route.ts`)
- Post API → Image storage: saves image (evidence: `app/api/posts/route.ts`)
- User profile page → User actions: loads profile (evidence: `app/users/[user_apelido]/page.tsx`)
- User profile page → Profile view: renders (evidence: `app/users/[user_apelido]/page.tsx`)
- Profile view → User actions: manages follows (evidence: `components/user-profile.tsx`)
- User → Profile API: updates profile
- Profile API → Prisma client: updates user (evidence: `app/api/profile/route.ts`)
- Profile API → Image storage: saves image (evidence: `app/api/profile/route.ts`)
- Search page → Search action: searches via (evidence: `actions/search.ts`)
- User actions → Prisma client: queries users (evidence: `actions/users.ts`)
- User actions → Push sender: sends follow push (evidence: `actions/users.ts`)
- Post API → Push sender: sends post push (evidence: `app/api/posts/route.ts`)
- Push setup → OneSignal: initializes
- Push sender → OneSignal: delivers push
- User → Post actions: likes and comments
- User → Notifications API: views notifications
