Skip to content

Commit 2026b9e

Browse files
committed
docs(architecture): add architectural decisions and system diagrams for project overview
1 parent f2a9da7 commit 2026b9e

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

docs/architecture/decisions.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Architectural Decisions
2+
3+
## Why Next.js App Router?
4+
5+
- Enables hybrid rendering (SSR, SSG, CSR)
6+
- File-system routing simplifies maintainability
7+
- Built-in support for middleware (e.g., auth handling)
8+
9+
## Why Supabase?
10+
11+
- Fully managed PostgreSQL with realtime and Row Level Security (RLS)
12+
- First-class support for OAuth providers (GitHub, Google)
13+
- Minimal backend maintenance overhead
14+
- Strong TypeScript support
15+
16+
## Why OAuth only?
17+
18+
- Simplifies user onboarding (no passwords)
19+
- Leveraging trusted identity providers reduces liability
20+
- Fits the developer audience of the app
21+
22+
## Session Strategy
23+
24+
- Supabase manages the session via client SDK
25+
- Session is synced on both client and server (via cookies or `getServerSession`)
26+
- Supabase middleware or protected layout ensures guards on restricted pages
27+
28+
## Deployment Strategy
29+
30+
- Use GitHub Actions for CI checks (lint, test)
31+
- Preview deploys on Vercel for PR validation
32+
- Main branch auto-deploys to production on merge

docs/architecture/diagrams.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# System Diagrams
2+
3+
## Application Architecture
4+
5+
```mermaid
6+
graph TD
7+
A[Public Visitor] --> B[Next.js App Router]
8+
C[Authenticated User] --> D[Supabase Auth]
9+
D --> E[Session JWT]
10+
E --> B
11+
B --> F[React Views]
12+
B --> G[Supabase Client SDK]
13+
G --> H[PostgreSQL]
14+
F --> H
15+
```
16+
17+
> This app supports both unauthenticated public users and authenticated contributors. All content is readable without login. Auth is only required for contributing or interacting (likes, comments, etc.).
18+
19+
---
20+
21+
## Deployment Pipeline
22+
23+
```mermaid
24+
graph LR
25+
A[Push to GitHub] --> B[GitHub Actions CI]
26+
B --> C[Vercel Preview Deployment]
27+
C --> D[Production Promotion]
28+
```
29+
30+
> Every push triggers CI checks and Vercel preview deployments for branch validation. Merging into `main` promotes to production automatically.
31+
32+
---
33+
34+
## Authentication Flow
35+
36+
```mermaid
37+
sequenceDiagram
38+
participant Visitor as Public Visitor
39+
participant User as Authenticated User
40+
participant Supabase
41+
participant App
42+
43+
Visitor->>App: Access public page
44+
App-->>Visitor: Load public content
45+
46+
User->>Supabase: Sign in with GitHub/Google
47+
Supabase-->>User: JWT session token
48+
User->>App: Load protected UI (Create, Edit, Interact)
49+
App->>Supabase: Fetch user data via JWT session
50+
```
51+
52+
> Only authenticated users can create, edit or remove content. Public visitors remain anonymous but can navigate and view everything.

docs/architecture/overview.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Architecture Overview
2+
3+
This application is a full-stack web platform built with **Next.js (App Router)** for the frontend and **Supabase** for backend services such as authentication, database, and storage.
4+
5+
## Core Technologies
6+
7+
- **Next.js (App Router)** — Server-side rendering and routing
8+
- **Supabase** — PostgreSQL DB, Auth (GitHub & Google), Realtime, Storage
9+
- **TypeScript** — Static typing
10+
- **Tailwind CSS** — Utility-first styling
11+
- **Lucide Icons** — UI iconography
12+
- **GitHub Actions** — CI/CD
13+
- **Vercel** — Hosting platform
14+
15+
### High-Level Flow
16+
17+
1. User lands on the app via a public route (e.g., `/`)
18+
2. If unauthenticated, user is redirected to the sign-in page
19+
3. Auth handled via Supabase (OAuth with GitHub/Google)
20+
4. Once authenticated, user session is stored via Supabase client and SSR-safe methods
21+
5. App loads user-specific data using Supabase client/server SDK
22+
6. Frontend interacts directly with Supabase via client APIs

0 commit comments

Comments
 (0)