# 8bit-parth/atlas-go architecture

> Architecture diagram of the GitHub repository 8bit-parth/atlas-go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/8bit-parth/atlas-go
- Repository: https://github.com/8bit-parth/atlas-go

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with Next.js (v13+ App Router).
- It delivers a dynamic property‐listing site: users can browse, create, favorite, and reserve listings on an interactive map.
- It uses Prisma (via `app/lib/db.ts`) to access a Postgres database (defined in `prisma/schema.prisma`), Supabase (via `app/lib/supabase.ts`) for storage/auth extensions, and KindeAuth (via API routes) for authentication.

##### File Structure Analysis
- Top‐Level
- Dockerfile & docker-compose.yml: containerization of Next.js server and Postgres.
- next.config.mjs, tsconfig.json, tailwind.config.ts, postcss.config.js: build and styling configs.
- prisma/: database schema.
- public/: static assets.
- “app/” (Next.js App Router)
- app/page.tsx, app/layout.tsx: root page and layout.
- app/components/: React UI components for map, listing cards, filters, nav.
- app/api/: serverless routes for auth (KindeAuth) and user‐creation flows.
- app/create/, app/home/, app/favorites/, app/my-homes/, app/reservations/: segmented pages for different user flows.
- app/lib/: wrappers for DB (Prisma), Supabase, utility functions (countries, categories).
- “components/ui/”: reusable design‐system primitives (buttons, inputs, cards) likely built with Tailwind.
- package.json: Next.js, React, Prisma, Supabase, KindeAuth, Tailwind, map‐related libs.

##### Key Architectural Patterns
- Hybrid CSR/SSR with React Server Components (Next.js App Router).
- Router-based code splitting: each route (e.g., /create/[id]/address) is its own server component + client components.
- API layer inside Next.js (`app/api/*`) acting as microservice‐style endpoints.
- ORM (Prisma) abstracts Postgres.
- External services: KindeAuth for authentication, Supabase for storage/real-time features, Map API for geospatial.

a. Main Components
- Browser (User) – renders React UI, calls RESTful API routes.
- Next.js Server
– Server Components & Client Components
– API Routes (KindeAuth handlers, user-resource endpoints)
- Database (Postgres via Prisma)
- Supabase Service (storage, real-time, optional auth)
- External Auth Service (KindeAuth)
- API (e.g., Google Maps)
b. Data Flows
1. User browses UI → Next.js SSR/CSR renders pages.
2. UI triggers actions (e.g., login, create listing) → calls Next.js API route.
3. API route invokes KindeAuth or Supabase SDK, or Prisma client.
4. Prisma performs SQL on Postgres.
5. Supabase handles file storage or real-time subscriptions.
6. Components fetch tile/geo-data from Map API.
c. Architectural Patterns
- MVC‐style separation:
– View: React components (app/components & components/ui)
– Controller/Service: Next.js API routes & server components
– Model: Prisma models (prisma/schema.prisma)
- Microfrontend‐like routes: each feature (create, reservations, favorites) isolated in its own folder.
d. Technologies
- Next.js (SSR/SSG, App Router)
- React 18+ (Server & Client components)
- Prisma ORM + Postgres
- Supabase SDK
- KindeAuth SDK
- Tailwind CSS
- Docker & Docker Compose

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        classDef frontend fill:#D0E8FF,stroke:#4CA1FF,color:#000

        Browser["Browser (User)"]:::frontend

        subgraph "Next.js App Router"
            direction TB
            AppDir["app/"]:::frontend
            Layout["app/layout.tsx"]:::frontend
            Page["app/page.tsx"]:::frontend

            subgraph "Feature Routes"
                direction TB
                CreateLayout["app/create/layout.tsx"]:::frontend
                CreateAddress["app/create/[id]/address/page.tsx"]:::frontend
                CreateDesc["app/create/[id]/description/page.tsx"]:::frontend
                CreateStruct["app/create/[id]/structure/page.tsx"]:::frontend
                HomePage["app/home/page.tsx"]:::frontend
                HomeDetail["app/home/[id]/page.tsx"]:::frontend
                HomeLoading["app/home/[id]/loading.tsx"]:::frontend
                FavPage["app/favorites/page.tsx"]:::frontend
                FavLoading["app/favorites/loading.tsx"]:::frontend
                MyHomes["app/my-homes/page.tsx"]:::frontend
                MyHomesLoading["app/my-homes/loading.tsx"]:::frontend
                ResPage["app/reservations/page.tsx"]:::frontend
                ResLoading["app/reservations/loading.tsx"]:::frontend
            end

            subgraph "UI Components"
                direction TB
                CategoryComp["CategoryShowcase.tsx"]:::frontend
                CounterComp["Counter.tsx"]:::frontend
                BottomBar["CreationBottomBar.tsx"]:::frontend
                HomeMapComp["HomeMap.tsx"]:::frontend
                ListingCard["ListingCard.tsx"]:::frontend
                MapComp["Map.tsx"]:::frontend
                MapFilter["MapFilterItems.tsx"]:::frontend
                NavbarComp["Navbar.tsx"]:::frontend
                NoItem["NoItem.tsx"]:::frontend
                SearchComp["SearchComponent.tsx"]:::frontend
                SelectCal["SelectCalender.tsx"]:::frontend
                SelCategory["SelectedCategory.tsx"]:::frontend
                SkeletonCard["SkeletonCard.tsx"]:::frontend
                SubmitBtn["SubmitButtons.tsx"]:::frontend
                UserNav["UserNav.tsx"]:::frontend
            end
        end
    end

    %% Backend/Server Layer
    subgraph "Backend/Server Layer"
        direction TB
        classDef infra fill:#F0F0F0,stroke:#999,color:#000

        subgraph "Next.js Server"
            direction TB
            ServerComps["Server & Client Components (app/)"]:::infra

            subgraph "API Routes"
                direction TB
                AuthRoute["app/api/auth/[kindeAuth]/route.ts"]:::infra
                CreationRoute["app/api/auth/creation/route.ts"]:::infra
            end
        end
    end

    %% Data & External Services Layer
    subgraph "Data & Services"
        direction TB
        classDef data fill:#E0FFE0,stroke:#3C9,color:#000
        classDef external fill:#FFE0B2,stroke:#E88,color:#000

        Database["Postgres"]:::data
        Prisma["app/lib/db.ts"]:::data
        PrismaSchema["prisma/schema.prisma"]:::data
        CountryUtil["app/lib/getCountries.ts"]:::data
        CategoryUtil["app/lib/categoryItems.ts"]:::data

        Supabase["Supabase Service"]:::external
        SupabaseLib["app/lib/supabase.ts"]:::external
        KindeAuth["KindeAuth Service"]:::external
        MapAPI["Map API"]:::external

        Utils["lib/utils.ts"]:::infra
        GlobalsCSS["app/globals.css"]:::infra
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        DockerCompose["docker-compose.yml"]:::infra
        Dockerfile["Dockerfile"]:::infra
        Configs["next.config.mjs\n tsconfig.json\n tailwind.config.ts\n postcss.config.js"]:::infra
        Public["public/"]:::infra
    end

    %% Connections
    Browser -->|"HTTP GET/POST"| ServerComps
    ServerComps -->|"Prisma Client"| Prisma
    Prisma -->|SQL| Database
    ServerComps -->|"Supabase SDK"| Supabase
    ServerComps -->|"KindeAuth SDK"| KindeAuth
    HomeMapComp -->|Tile/Geo Data| MapAPI
    MapComp -->|Tile/Geo Data| MapAPI

    %% Click Events
    click AppDir "https://github.com/8bit-parth/atlas-go/tree/main/app/"
    click Layout "https://github.com/8bit-parth/atlas-go/blob/main/app/layout.tsx"
    click Page "https://github.com/8bit-parth/atlas-go/blob/main/app/page.tsx"
    click CreateLayout "https://github.com/8bit-parth/atlas-go/blob/main/app/create/layout.tsx"
    click CreateAddress "https://github.com/8bit-parth/atlas-go/blob/main/app/create/[id]/address/page.tsx"
    click CreateDesc "https://github.com/8bit-parth/atlas-go/blob/main/app/create/[id]/description/page.tsx"
    click CreateStruct "https://github.com/8bit-parth/atlas-go/blob/main/app/create/[id]/structure/page.tsx"
    click HomePage "https://github.com/8bit-parth/atlas-go/blob/main/app/home/page.tsx"
    click HomeDetail "https://github.com/8bit-parth/atlas-go/blob/main/app/home/[id]/page.tsx"
    click HomeLoading "https://github.com/8bit-parth/atlas-go/blob/main/app/home/[id]/loading.tsx"
    click FavPage "https://github.com/8bit-parth/atlas-go/blob/main/app/favorites/page.tsx"
    click FavLoading "https://github.com/8bit-parth/atlas-go/blob/main/app/favorites/loading.tsx"
    click MyHomes "https://github.com/8bit-parth/atlas-go/blob/main/app/my-homes/page.tsx"
    click MyHomesLoading "https://github.com/8bit-parth/atlas-go/blob/main/app/my-homes/loading.tsx"
    click ResPage "https://github.com/8bit-parth/atlas-go/blob/main/app/reservations/page.tsx"
    click ResLoading "https://github.com/8bit-parth/atlas-go/blob/main/app/reservations/loading.tsx"
    click CategoryComp "https://github.com/8bit-parth/atlas-go/blob/main/app/components/CategoryShowcase.tsx"
    click CounterComp "https://github.com/8bit-parth/atlas-go/blob/main/app/components/Counter.tsx"
    click BottomBar "https://github.com/8bit-parth/atlas-go/blob/main/app/components/CreationBottomBar.tsx"
    click HomeMapComp "https://github.com/8bit-parth/atlas-go/blob/main/app/components/HomeMap.tsx"
    click ListingCard "https://github.com/8bit-parth/atlas-go/blob/main/app/components/ListingCard.tsx"
    click MapComp "https://github.com/8bit-parth/atlas-go/blob/main/app/components/Map.tsx"
    click MapFilter "https://github.com/8bit-parth/atlas-go/blob/main/app/components/MapFilterItems.tsx"
    click NavbarComp "https://github.com/8bit-parth/atlas-go/blob/main/app/components/Navbar.tsx"
    click NoItem "https://github.com/8bit-parth/atlas-go/blob/main/app/components/NoItem.tsx"
    click SearchComp "https://github.com/8bit-parth/atlas-go/blob/main/app/components/SearchComponent.tsx"
    click SelectCal "https://github.com/8bit-parth/atlas-go/blob/main/app/components/SelectCalender.tsx"
    click SelCategory "https://github.com/8bit-parth/atlas-go/blob/main/app/components/SelectedCategory.tsx"
    click SkeletonCard "https://github.com/8bit-parth/atlas-go/blob/main/app/components/SkeletonCard.tsx"
    click SubmitBtn "https://github.com/8bit-parth/atlas-go/blob/main/app/components/SubmitButtons.tsx"
    click UserNav "https://github.com/8bit-parth/atlas-go/blob/main/app/components/UserNav.tsx"
    click AuthRoute "https://github.com/8bit-parth/atlas-go/blob/main/app/api/auth/[kindeAuth]/route.ts"
    click CreationRoute "https://github.com/8bit-parth/atlas-go/blob/main/app/api/auth/creation/route.ts"
    click Prisma "https://github.com/8bit-parth/atlas-go/blob/main/app/lib/db.ts"
    click PrismaSchema "https://github.com/8bit-parth/atlas-go/blob/main/prisma/schema.prisma"
    click SupabaseLib "https://github.com/8bit-parth/atlas-go/blob/main/app/lib/supabase.ts"
    click CountryUtil "https://github.com/8bit-parth/atlas-go/blob/main/app/lib/getCountries.ts"
    click CategoryUtil "https://github.com/8bit-parth/atlas-go/blob/main/app/lib/categoryItems.ts"
    click GlobalsCSS "https://github.com/8bit-parth/atlas-go/blob/main/app/globals.css"
    click Utils "https://github.com/8bit-parth/atlas-go/blob/main/lib/utils.ts"
    click DockerCompose "https://github.com/8bit-parth/atlas-go/blob/main/docker-compose.yml"
    click Dockerfile "https://github.com/8bit-parth/atlas-go/tree/main/Dockerfile"
    click Public "https://github.com/8bit-parth/atlas-go/tree/main/public/"
```
