# sahniaditya007/google-calendar-clone architecture

> Architecture diagram of the GitHub repository sahniaditya007/google-calendar-clone, 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/sahniaditya007/google-calendar-clone
- Repository: https://github.com/sahniaditya007/google-calendar-clone

## Overview

This is a Next.js calendar application for browsing and managing events in month, week, and day views. The user workflow runs from the calendar page, through date-range event fetching and calendar rendering, or through the event modal for create, edit, and delete actions; API routes validate requests and persist events with Prisma. Local date and overlap utilities support presentation. The README documents responsive UI, color coding, time validation, overlap handling, and SQLite persistence. Source excerpts are partial, so unshown implementation links are omitted; future enhancements are not represented as existing features.

Main entry points: [`app/page.tsx`](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/page.tsx) (Calendar page), [`app/api/events/route.ts`](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/events/route.ts) (Event collection API), [`app/api/events/[id]/route.ts`](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/events/%5Bid%5D/route.ts) (Single event API), [`lib/prisma.ts`](https://github.com/sahniaditya007/google-calendar-clone/blob/main/lib/prisma.ts) (Prisma client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Calendar interface"]
  node_page["Calendar page<br/>[page.tsx]"]
  node_calendar["Calendar views<br/>[Calendar.tsx]"]
  node_modal["Event editor<br/>[EventModal.tsx]"]
end

subgraph group_api["Event API"]
  node_collection["Event collection API<br/>[route.ts]"]
  node_item["Single event API<br/>[route.ts]"]
  node_health["Database health API<br/>[route.ts]"]
end

subgraph group_data["Persistence and domain"]
  node_utils["Date utilities<br/>[utils.ts]"]
  node_eventtypes["Event types<br/>[index.ts]"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_sqlite[("SQLite event store<br/>[schema.prisma]")]
end

node_person(("Calendar user"))

node_person -->|"uses"| node_page
node_page -->|"fetches range"| node_collection
node_page -->|"creates event"| node_collection
node_page -->|"updates event"| node_item
node_page -->|"deletes event"| node_item
node_collection -->|"returns events"| node_page
node_item -->|"returns result"| node_page
node_page -->|"renders views"| node_calendar
node_page -->|"opens editor"| node_modal
node_calendar -->|"uses date logic"| node_utils
node_modal -->|"formats dates"| node_utils
node_collection -->|"queries events"| node_prisma
node_item -->|"reads and mutates"| node_prisma
node_health -->|"checks connection"| node_prisma
node_prisma -->|"persists events"| node_sqlite

click node_page "https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/page.tsx"
click node_calendar "https://github.com/sahniaditya007/google-calendar-clone/blob/main/components/Calendar.tsx"
click node_modal "https://github.com/sahniaditya007/google-calendar-clone/blob/main/components/EventModal.tsx"
click node_utils "https://github.com/sahniaditya007/google-calendar-clone/blob/main/lib/utils.ts"
click node_eventtypes "https://github.com/sahniaditya007/google-calendar-clone/blob/main/types/index.ts"
click node_collection "https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/events/route.ts"
click node_item "https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/events/%5Bid%5D/route.ts"
click node_health "https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/health/route.ts"
click node_prisma "https://github.com/sahniaditya007/google-calendar-clone/blob/main/lib/prisma.ts"
click node_sqlite "https://github.com/sahniaditya007/google-calendar-clone/blob/main/prisma/schema.prisma"

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_page,node_calendar,node_modal,node_person toneBlue
class node_collection,node_item,node_health toneAmber
class node_utils,node_eventtypes,node_prisma,node_sqlite toneMint
```

## Components

### Calendar interface

- [Calendar page](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/page.tsx): `app/page.tsx`
- [Calendar views](https://github.com/sahniaditya007/google-calendar-clone/blob/main/components/Calendar.tsx): `components/Calendar.tsx`
- [Event editor](https://github.com/sahniaditya007/google-calendar-clone/blob/main/components/EventModal.tsx): `components/EventModal.tsx`

### Event API

- [Event collection API](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/events/route.ts): `app/api/events/route.ts`
- [Single event API](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/events/%5Bid%5D/route.ts): `app/api/events/[id]/route.ts`
- [Database health API](https://github.com/sahniaditya007/google-calendar-clone/blob/main/app/api/health/route.ts): `app/api/health/route.ts`

### Persistence and domain

- [Date utilities](https://github.com/sahniaditya007/google-calendar-clone/blob/main/lib/utils.ts): `lib/utils.ts`
- [Event types](https://github.com/sahniaditya007/google-calendar-clone/blob/main/types/index.ts): `types/index.ts`
- [Prisma client](https://github.com/sahniaditya007/google-calendar-clone/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [SQLite event store](https://github.com/sahniaditya007/google-calendar-clone/blob/main/prisma/schema.prisma): `prisma/schema.prisma`

### Other components

- **Calendar user**

## Connections

- Calendar user → Calendar page: uses
- Calendar page → Event collection API: fetches range
- Calendar page → Event collection API: creates event
- Calendar page → Single event API: updates event
- Calendar page → Single event API: deletes event
- Event collection API → Calendar page: returns events
- Single event API → Calendar page: returns result
- Calendar page → Calendar views: renders views
- Calendar page → Event editor: opens editor
- Calendar views → Date utilities: uses date logic
- Event editor → Date utilities: formats dates
- Event collection API → Prisma client: queries events
- Single event API → Prisma client: reads and mutates
- Database health API → Prisma client: checks connection
- Prisma client → SQLite event store: persists events
