# twisisa258/twisisa architecture

> Architecture diagram of the GitHub repository twisisa258/twisisa, 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/twisisa258/twisisa
- Repository: https://github.com/twisisa258/twisisa

## Overview

Twisisa is a Portuguese-language study platform. Students sign in, choose a study path, and use the dashboard to reach learning materials, simulator sessions, progress, and community features; administrators manage educational content. The graph also includes authentication, subscriptions, AI chat, and editorial content. Several routes and domain modules were not sampled, so those branches are represented at their existing directory paths; their internal wiring is left unspecified where evidence is unavailable.

Main entry points: [`lib/auth.ts`](https://github.com/twisisa258/twisisa/blob/master/lib/auth.ts) (Authentication), [`app/aluno/(painel)/page.tsx`](https://github.com/twisisa258/twisisa/blob/master/app/aluno/(painel)/page.tsx) (Student dashboard), [`app/api/checkout/route.ts`](https://github.com/twisisa258/twisisa/blob/master/app/api/checkout/route.ts) (Checkout endpoint), [`app/biblioteca`](https://github.com/twisisa258/twisisa/tree/master/app/biblioteca) (Library browsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Student learning"]
  node_dashboard["Student dashboard<br/>[page.tsx]"]
  node_studydata["Progress overview<br/>[aluno-overview.ts]"]
  node_pathchoice["Study path<br/>[percurso.ts]"]
  node_library["Study library<br/>[library.ts]"]
  node_librarypages["Library browsing"]
  node_simulator["Exam simulator"]
  node_quiz["Quiz engine<br/>[quiz-engine.ts]"]
end

subgraph group_operations["Content operations"]
  node_admin["Admin content"]
  node_questiontemplate["Question template<br/>[route.ts]"]
  node_questiondata["Question catalog<br/>[questions.ts]"]
end

subgraph group_platform["Platform services"]
  node_authpages["Sign-in and signup<br/>[auth-form.tsx]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_database[("PostgreSQL data<br/>[schema.ts]")]
  node_checkout["Checkout endpoint<br/>[route.ts]"]
  node_subscription["Subscriptions<br/>[subscription.ts]"]
  node_stripe["Stripe integration<br/>[stripe.ts]"]
end

subgraph group_engagement["Engagement and publishing"]
  node_community["Community feed<br/>[community-feed.tsx]"]
  node_communitypage["Community page<br/>[page.tsx]"]
  node_jonas["Jonas assistant<br/>[jonas-chat.tsx]"]
  node_blog["Editorial content<br/>[blog.ts]"]
  node_homepage["Home page<br/>[home-page.tsx]"]
end

node_student(("Student"))

node_student -->|"opens"| node_dashboard
node_dashboard -->|"checks session"| node_auth
node_dashboard -->|"loads overview"| node_studydata
node_dashboard -->|"validates path"| node_pathchoice
node_dashboard -->|"links to"| node_librarypages
node_dashboard -->|"links to"| node_simulator
node_dashboard -->|"queries profile"| node_database
node_librarypages -->|"loads materials"| node_library
node_librarypages -->|"checks access"| node_auth
node_communitypage -->|"checks access"| node_auth
node_communitypage -->|"renders feed"| node_community
node_community -->|"uses actions"| node_communitypage
node_questiontemplate -->|"checks admin"| node_admin
node_questiontemplate -->|"builds template"| node_questiondata
node_authpages -->|"uses client auth"| node_auth
node_auth -->|"uses database"| node_database
node_auth -->|"guards admin access"| node_admin
node_auth -->|"connects pool"| node_database
node_checkout -->|"checks session"| node_auth
node_checkout -->|"checks current plan"| node_subscription
node_checkout -->|"creates checkout"| node_stripe
node_homepage -->|"loads articles"| node_blog
node_jonas -->|"checks access"| node_auth
node_homepage -.->|"serves entry page"| node_student

click node_dashboard "https://github.com/twisisa258/twisisa/blob/master/app/aluno/(painel)/page.tsx"
click node_studydata "https://github.com/twisisa258/twisisa/blob/master/lib/aluno-overview.ts"
click node_pathchoice "https://github.com/twisisa258/twisisa/blob/master/lib/percurso.ts"
click node_library "https://github.com/twisisa258/twisisa/blob/master/lib/library.ts"
click node_librarypages "https://github.com/twisisa258/twisisa/tree/master/app/biblioteca"
click node_simulator "https://github.com/twisisa258/twisisa/tree/master/app/aluno/simulador"
click node_quiz "https://github.com/twisisa258/twisisa/blob/master/lib/quiz-engine.ts"
click node_admin "https://github.com/twisisa258/twisisa/tree/master/app/admin"
click node_questiontemplate "https://github.com/twisisa258/twisisa/blob/master/app/admin/questoes/modelo/route.ts"
click node_questiondata "https://github.com/twisisa258/twisisa/blob/master/lib/questions.ts"
click node_authpages "https://github.com/twisisa258/twisisa/blob/master/components/auth-form.tsx"
click node_auth "https://github.com/twisisa258/twisisa/blob/master/lib/auth.ts"
click node_database "https://github.com/twisisa258/twisisa/blob/master/lib/db/schema.ts"
click node_checkout "https://github.com/twisisa258/twisisa/blob/master/app/api/checkout/route.ts"
click node_subscription "https://github.com/twisisa258/twisisa/blob/master/lib/subscription.ts"
click node_stripe "https://github.com/twisisa258/twisisa/blob/master/lib/stripe.ts"
click node_community "https://github.com/twisisa258/twisisa/blob/master/components/community-feed.tsx"
click node_communitypage "https://github.com/twisisa258/twisisa/blob/master/app/comunidade/page.tsx"
click node_jonas "https://github.com/twisisa258/twisisa/blob/master/components/jonas-chat.tsx"
click node_blog "https://github.com/twisisa258/twisisa/blob/master/lib/blog.ts"
click node_homepage "https://github.com/twisisa258/twisisa/blob/master/components/home-page.tsx"

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_dashboard,node_studydata,node_pathchoice,node_library,node_librarypages,node_simulator,node_quiz toneBlue
class node_admin,node_questiontemplate,node_questiondata toneAmber
class node_authpages,node_auth,node_database,node_checkout,node_subscription,node_stripe toneMint
class node_community,node_communitypage,node_jonas,node_blog,node_homepage toneRose
class node_student toneIndigo
```

## Components

### Student learning

- [Student dashboard](https://github.com/twisisa258/twisisa/blob/master/app/aluno/(painel)/page.tsx): `app/aluno/(painel)/page.tsx`
- [Progress overview](https://github.com/twisisa258/twisisa/blob/master/lib/aluno-overview.ts): `lib/aluno-overview.ts`
- [Study path](https://github.com/twisisa258/twisisa/blob/master/lib/percurso.ts): `lib/percurso.ts`
- [Study library](https://github.com/twisisa258/twisisa/blob/master/lib/library.ts): `lib/library.ts`
- [Library browsing](https://github.com/twisisa258/twisisa/tree/master/app/biblioteca): `app/biblioteca`
- [Exam simulator](https://github.com/twisisa258/twisisa/tree/master/app/aluno/simulador): `app/aluno/simulador`
- [Quiz engine](https://github.com/twisisa258/twisisa/blob/master/lib/quiz-engine.ts): `lib/quiz-engine.ts`

### Content operations

- [Admin content](https://github.com/twisisa258/twisisa/tree/master/app/admin): `app/admin`
- [Question template](https://github.com/twisisa258/twisisa/blob/master/app/admin/questoes/modelo/route.ts): `app/admin/questoes/modelo/route.ts`
- [Question catalog](https://github.com/twisisa258/twisisa/blob/master/lib/questions.ts): `lib/questions.ts`

### Platform services

- [Sign-in and signup](https://github.com/twisisa258/twisisa/blob/master/components/auth-form.tsx): `components/auth-form.tsx`
- [Authentication](https://github.com/twisisa258/twisisa/blob/master/lib/auth.ts): `lib/auth.ts`
- [PostgreSQL data](https://github.com/twisisa258/twisisa/blob/master/lib/db/schema.ts): `lib/db/schema.ts`
- [Checkout endpoint](https://github.com/twisisa258/twisisa/blob/master/app/api/checkout/route.ts): `app/api/checkout/route.ts`
- [Subscriptions](https://github.com/twisisa258/twisisa/blob/master/lib/subscription.ts): `lib/subscription.ts`
- [Stripe integration](https://github.com/twisisa258/twisisa/blob/master/lib/stripe.ts): `lib/stripe.ts`

### Engagement and publishing

- [Community feed](https://github.com/twisisa258/twisisa/blob/master/components/community-feed.tsx): `components/community-feed.tsx`
- [Community page](https://github.com/twisisa258/twisisa/blob/master/app/comunidade/page.tsx): `app/comunidade/page.tsx`
- [Jonas assistant](https://github.com/twisisa258/twisisa/blob/master/components/jonas-chat.tsx): `components/jonas-chat.tsx`
- [Editorial content](https://github.com/twisisa258/twisisa/blob/master/lib/blog.ts): `lib/blog.ts`
- [Home page](https://github.com/twisisa258/twisisa/blob/master/components/home-page.tsx): `components/home-page.tsx`

### Other components

- **Student**

## Connections

- Student → Student dashboard: opens (evidence: `app/aluno/(painel)/page.tsx`)
- Student dashboard → Authentication: checks session (evidence: `app/aluno/(painel)/page.tsx`)
- Student dashboard → Progress overview: loads overview (evidence: `app/aluno/(painel)/page.tsx`)
- Student dashboard → Study path: validates path (evidence: `app/aluno/(painel)/page.tsx`)
- Student dashboard → Library browsing: links to (evidence: `app/aluno/(painel)/page.tsx`)
- Student dashboard → Exam simulator: links to (evidence: `app/aluno/(painel)/page.tsx`)
- Student dashboard → PostgreSQL data: queries profile (evidence: `app/aluno/(painel)/page.tsx`)
- Library browsing → Study library: loads materials (evidence: `app/biblioteca/explorar/page.tsx`)
- Library browsing → Authentication: checks access (evidence: `app/biblioteca/explorar/page.tsx`)
- Community page → Authentication: checks access (evidence: `app/comunidade/page.tsx`)
- Community page → Community feed: renders feed (evidence: `app/comunidade/page.tsx`)
- Community feed → Community page: uses actions (evidence: `components/community-feed.tsx`)
- Question template → Admin content: checks admin (evidence: `app/admin/questoes/modelo/route.ts`)
- Question template → Question catalog: builds template (evidence: `app/admin/questoes/modelo/route.ts`)
- Sign-in and signup → Authentication: uses client auth (evidence: `components/auth-form.tsx`)
- Authentication → PostgreSQL data: uses database (evidence: `lib/auth.ts`)
- Authentication → Admin content: guards admin access
- Authentication → PostgreSQL data: connects pool
- Checkout endpoint → Authentication: checks session (evidence: `app/api/checkout/route.ts`)
- Checkout endpoint → Subscriptions: checks current plan (evidence: `app/api/checkout/route.ts`)
- Checkout endpoint → Stripe integration: creates checkout (evidence: `app/api/checkout/route.ts`)
- Home page → Editorial content: loads articles (evidence: `components/home-page.tsx`)
- Jonas assistant → Authentication: checks access (evidence: `app/jonas/page.tsx`)
- Home page → Student: serves entry page
