# josephkingsleyy/survey-geek-backend architecture

> Architecture diagram of the GitHub repository josephkingsleyy/survey-geek-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/josephkingsleyy/survey-geek-backend
- Repository: https://github.com/josephkingsleyy/survey-geek-backend

## Overview

This appears to be a survey platform backend: authenticated users can create and publish surveys, answer questions, and use wallet/payment features; the repository also exposes account, support, notification, media, and interest-category APIs. The sampled controllers establish the API-to-service calls shown below. The README is only a NestJS starter template, and most services and cron implementations were not sampled, so their internal calls and persistence wiring are intentionally omitted.

Main entry points: [`src/auth/auth.service.ts`](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/auth/auth.service.ts) (Auth service), [`src/main.ts`](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/main.ts) (HTTP bootstrap), [`src/survey/survey.controller.ts`](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey/survey.controller.ts) (Survey API), [`src/question/question.controller.ts`](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/question/question.controller.ts) (Question API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_bootstrap["HTTP bootstrap<br/>[main.ts]"]
  node_app["App module<br/>[app.module.ts]"]
  node_database[("Prisma data access<br/>[prisma.service.ts]")]
end

subgraph group_survey["Survey workflow"]
  node_surveyapi["Survey API"]
  node_surveyservice["Survey service<br/>[survey.service.ts]"]
  node_questionapi["Question API"]
  node_questionservice["Question service"]
  node_responseapi["Response API"]
  node_responseservice["Response service"]
  node_interestapi["Interest API"]
  node_interestservice["Interest service"]
end

subgraph group_account["Accounts and engagement"]
  node_auth["Authentication<br/>[auth.controller.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_ticketapi["Ticket API"]
  node_ticketservice["Ticket service<br/>[ticket.service.ts]"]
  node_notificationapi["Notification API"]
  node_notificationservice["Notification service"]
  node_gateway["Notification socket"]
end

subgraph group_money["Payments and payouts"]
  node_paymentapi["Payment API"]
  node_paymentservice["Payment service<br/>[payment.service.ts]"]
  node_withdrawalapi["Withdrawal API"]
  node_withdrawalservice["Withdrawal service"]
  node_billing["Billing jobs"]
end

subgraph group_integrations["External integrations"]
  node_mediaapi["Media API"]
  node_mediaservice["Media service"]
  node_cloudinary["Cloudinary"]
  node_mailer["Email delivery<br/>[mail-service.ts]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_bootstrap
node_bootstrap -->|"starts application"| node_app
node_client -->|"authenticates"| node_auth
node_client -->|"manages surveys"| node_surveyapi
node_client -->|"manages questions"| node_questionapi
node_client -->|"submits answers"| node_responseapi
node_client -->|"chooses interests"| node_interestapi
node_client -->|"manages wallet"| node_paymentapi
node_client -->|"requests payout"| node_withdrawalapi
node_client -->|"opens tickets"| node_ticketapi
node_client -->|"views notifications"| node_notificationapi
node_client -->|"uploads media"| node_mediaapi
node_auth -->|"delegates auth"| node_authservice
node_authservice -->|"reads and writes users"| node_database
node_authservice -->|"sends verification mail"| node_mailer
node_surveyapi -->|"delegates survey operations"| node_surveyservice
node_questionapi -->|"delegates question operations"| node_questionservice
node_responseapi -->|"submits responses"| node_responseservice
node_interestapi -->|"manages interests"| node_interestservice
node_paymentapi -->|"delegates wallet operations"| node_paymentservice
node_withdrawalapi -->|"handles payout action"| node_withdrawalservice
node_ticketapi -->|"delegates ticket operations"| node_ticketservice
node_notificationapi -->|"delegates notification actions"| node_notificationservice
node_mediaapi -->|"uploads and manages media"| node_mediaservice
node_mediaservice -.->|"uploads media"| node_cloudinary

click node_bootstrap "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/main.ts"
click node_app "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/app.module.ts"
click node_auth "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/auth/auth.controller.ts"
click node_authservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/auth/auth.service.ts"
click node_surveyapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey/survey.controller.ts"
click node_surveyservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey/survey.service.ts"
click node_questionapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/question/question.controller.ts"
click node_questionservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/question/question.service.ts"
click node_responseapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/response/response.controller.ts"
click node_responseservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/response/response.service.ts"
click node_interestapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey-interest/survey-interest.controller.ts"
click node_interestservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey-interest/survey-interest.service.ts"
click node_paymentapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/payment/payment.controller.ts"
click node_paymentservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/payment/payment.service.ts"
click node_withdrawalapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/withdrawal/withdrawal.controller.ts"
click node_withdrawalservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/withdrawal/withdrawal.service.ts"
click node_billing "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/crons/billing-cron.service.ts"
click node_ticketapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/ticket/ticket.controller.ts"
click node_ticketservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/ticket/ticket.service.ts"
click node_notificationapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/notification/notification.controller.ts"
click node_notificationservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/notification/notification.service.ts"
click node_gateway "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/notification/notification.gateway.ts"
click node_mediaapi "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/cloudinary/cloudinary.controller.ts"
click node_mediaservice "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/cloudinary/cloudinary.service.ts"
click node_database "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/prisma/prisma.service.ts"
click node_mailer "https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/common/utils/mail-service.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_bootstrap,node_app,node_database,node_client toneBlue
class node_surveyapi,node_surveyservice,node_questionapi,node_questionservice,node_responseapi,node_responseservice,node_interestapi,node_interestservice toneAmber
class node_auth,node_authservice,node_ticketapi,node_ticketservice,node_notificationapi,node_notificationservice,node_gateway toneMint
class node_paymentapi,node_paymentservice,node_withdrawalapi,node_withdrawalservice,node_billing toneRose
class node_mediaapi,node_mediaservice,node_cloudinary,node_mailer toneIndigo
```

## Components

### Application runtime

- [HTTP bootstrap](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/main.ts): `src/main.ts`
- [App module](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/app.module.ts): `src/app.module.ts`
- [Prisma data access](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/prisma/prisma.service.ts): `src/prisma/prisma.service.ts`

### Survey workflow

- [Survey API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey/survey.controller.ts): `src/survey/survey.controller.ts`
- [Survey service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey/survey.service.ts): `src/survey/survey.service.ts`
- [Question API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/question/question.controller.ts): `src/question/question.controller.ts`
- [Question service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/question/question.service.ts): `src/question/question.service.ts`
- [Response API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/response/response.controller.ts): `src/response/response.controller.ts`
- [Response service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/response/response.service.ts): `src/response/response.service.ts`
- [Interest API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey-interest/survey-interest.controller.ts): `src/survey-interest/survey-interest.controller.ts`
- [Interest service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/survey-interest/survey-interest.service.ts): `src/survey-interest/survey-interest.service.ts`

### Accounts and engagement

- [Authentication](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Auth service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [Ticket API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/ticket/ticket.controller.ts): `src/ticket/ticket.controller.ts`
- [Ticket service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/ticket/ticket.service.ts): `src/ticket/ticket.service.ts`
- [Notification API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/notification/notification.controller.ts): `src/notification/notification.controller.ts`
- [Notification service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/notification/notification.service.ts): `src/notification/notification.service.ts`
- [Notification socket](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/notification/notification.gateway.ts): `src/notification/notification.gateway.ts`

### Payments and payouts

- [Payment API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/payment/payment.controller.ts): `src/payment/payment.controller.ts`
- [Payment service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/payment/payment.service.ts): `src/payment/payment.service.ts`
- [Withdrawal API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/withdrawal/withdrawal.controller.ts): `src/withdrawal/withdrawal.controller.ts`
- [Withdrawal service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/withdrawal/withdrawal.service.ts): `src/withdrawal/withdrawal.service.ts`
- [Billing jobs](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/crons/billing-cron.service.ts): `src/crons/billing-cron.service.ts`

### External integrations

- [Media API](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/cloudinary/cloudinary.controller.ts): `src/cloudinary/cloudinary.controller.ts`
- [Media service](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/cloudinary/cloudinary.service.ts): `src/cloudinary/cloudinary.service.ts`
- **Cloudinary**
- [Email delivery](https://github.com/josephkingsleyy/survey-geek-backend/blob/dev/src/common/utils/mail-service.ts): `src/common/utils/mail-service.ts`

### Other components

- **API client**

## Connections

- API client → HTTP bootstrap: sends requests
- HTTP bootstrap → App module: starts application
- API client → Authentication: authenticates
- API client → Survey API: manages surveys
- API client → Question API: manages questions
- API client → Response API: submits answers
- API client → Interest API: chooses interests
- API client → Payment API: manages wallet
- API client → Withdrawal API: requests payout
- API client → Ticket API: opens tickets
- API client → Notification API: views notifications
- API client → Media API: uploads media
- Authentication → Auth service: delegates auth
- Auth service → Prisma data access: reads and writes users
- Auth service → Email delivery: sends verification mail
- Survey API → Survey service: delegates survey operations
- Question API → Question service: delegates question operations
- Response API → Response service: submits responses
- Interest API → Interest service: manages interests
- Payment API → Payment service: delegates wallet operations
- Withdrawal API → Withdrawal service: handles payout action
- Ticket API → Ticket service: delegates ticket operations
- Notification API → Notification service: delegates notification actions
- Media API → Media service: uploads and manages media
- Media service → Cloudinary: uploads media
