# arpitthool/blogger-app architecture

> Architecture diagram of the GitHub repository arpitthool/blogger-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arpitthool/blogger-app
- Repository: https://github.com/arpitthool/blogger-app

## Overview

#### Purpose and Runtime
A server-rendered Blogger application built with TypeScript, AdonisJS, Edge templates, and PostgreSQL. Guests browse blogs and register; authenticated users create/delete their blogs and like/dislike posts. The Node/Adonis HTTP runtime starts at `server.ts`, with CLI lifecycle commands exposed through `ace` and `commands/index.ts`.

#### HTTP Composition and Routing
Routes are the application control-plane entry point in `start/routes.ts`; middleware registration/order is defined in `start/kernel.ts`. Requests flow through Adonis middleware, controllers, Lucid ORM models, then render Edge views or redirect. Global error translation is centralized in `app/Exceptions/Handler.ts`.

#### Authentication and Access Boundaries
Authentication is configured as session/cookie-based Adonis auth in `config/auth.ts` and `config/session.ts`. `app/Middleware/Auth.ts` gates logged-in actions, `app/Middleware/Guest.ts` protects guest-only pages, and `app/Middleware/SilentAuth.ts` likely makes optional identity available for public pages. Account/session endpoints belong to `app/Controllers/Http/AuthController.ts`; user persistence is `app/Models/User.ts`.

#### Blog Domain and Ownership
Blog CRUD/read behavior is concentrated in `app/Controllers/Http/BlogsController.ts`, backed by `app/Models/Blog.ts`. The principal authorization boundary is ownership: authenticated users can create and delete only their own blog records. Public index/detail and user-specific views are rendered from `resources/views/blogs/index.edge`, `resources/views/blogs/view.edge`, and `resources/views/blogs/userIndex.edge`.

#### Social Interactions
Likes and comments are independent domain flows attached to blogs and users. Their request handlers are `app/Controllers/Http/LikesController.ts` and `app/Controllers/Http/CommentsController.ts`; persistence models are `app/Models/Like.ts` and `app/Models/Comment.ts`. Comment author-name support is represented in `database/migrations/1727312708346_add_user_name_to_comments.ts`.

#### Persistence Lifecycle
PostgreSQL connectivity is configured in `config/database.ts` from validated environment definitions in `env.ts`. Schema evolution establishes users, blogs, likes, and comments through `database/migrations/1699475376434_users.ts`, `database/migrations/1699505616366_blogs.ts`, and `database/migrations/1726342752206_comments.ts`. Optional initial data enters through `database/seeders/MainSeeder/Index.ts`.

#### Presentation and Deployment Boundaries
Edge templates form the UI boundary, sharing layout/navigation via `resources/views/layouts/app.edge` and `resources/views/layouts/partials/_navbar.edge`; auth pages reside under `resources/views/auth`. Static files and local drive behavior are configured by `config/static.ts` and `config/drive.ts`. A `Dockerfile` supports containerization; production uses Adonis’s compiled build and Node server runtime.

Main entry points: [`start/routes.ts`](https://github.com/arpitthool/blogger-app/blob/master/start/routes.ts) (Routes), [`app/Models/Blog.ts`](https://github.com/arpitthool/blogger-app/blob/master/app/Models/Blog.ts) (Blog social models), [`app/Middleware/Auth.ts`](https://github.com/arpitthool/blogger-app/blob/master/app/Middleware/Auth.ts) (Access middleware), [`app/Controllers/Http/AuthController.ts`](https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/AuthController.ts) (Account sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime &amp; CLI"]
  node_server{{"Adonis HTTP server<br/>Node runtime<br/>[server.ts]"}}
  node_cli["CLI lifecycle commands<br/>Adonis Ace<br/>[index.ts]"]
end

subgraph group_http["HTTP &amp; Access"]
  node_routes["Routes<br/>HTTP control plane<br/>[routes.ts]"]
  node_kernel["Middleware pipeline<br/>Adonis kernel<br/>[kernel.ts]"]
  node_auth_config["Session authentication<br/>Auth configuration<br/>[auth.ts]"]
  node_access_middleware["Access middleware<br/>[Auth.ts]"]
  node_auth_controller["Account sessions<br/>HTTP controller<br/>[AuthController.ts]"]
  node_error_handler["Error translation<br/>Exception handler<br/>[Handler.ts]"]
end

subgraph group_domain["Blog Domain"]
  node_blogs_controller["Blog read and CRUD<br/>HTTP controller<br/>[BlogsController.ts]"]
  node_likes_controller["Like interactions<br/>HTTP controller<br/>[LikesController.ts]"]
  node_comments_controller["Comment interactions<br/>HTTP controller"]
  node_domain_models["Blog social models<br/>Lucid ORM models<br/>[Blog.ts]"]
  node_user_model["User model<br/>Lucid ORM model<br/>[User.ts]"]
end

subgraph group_presentation["Presentation"]
  node_edge_views["Blog Edge views<br/>Server-rendered UI<br/>[index.edge]"]
  node_app_layout["Shared layout and navigation<br/>Edge layout<br/>[app.edge]"]
  node_auth_views["Authentication pages<br/>Edge views"]
end

subgraph group_data["Data &amp; Schema"]
  node_database_config["PostgreSQL connection<br/>Database configuration<br/>[database.ts]"]
  node_postgres[("PostgreSQL<br/>Relational database")]
  node_migrations["Schema migrations<br/>Database migrations"]
  node_seeder["Initial data seeder<br/>Database seeder<br/>[Index.ts]"]
end

node_server -->|"serves requests"| node_routes
node_server -->|"runs pipeline"| node_kernel
node_cli -.->|"runs lifecycle tasks"| node_migrations
node_routes -->|"account endpoints"| node_auth_controller
node_routes -->|"blog endpoints"| node_blogs_controller
node_routes -->|"like endpoints"| node_likes_controller
node_routes -->|"comment endpoints"| node_comments_controller
node_kernel -->|"applies access rules"| node_access_middleware
node_auth_config -->|"configures identity"| node_access_middleware
node_access_middleware -.->|"guards session actions"| node_auth_controller
node_access_middleware -.->|"guards ownership actions"| node_blogs_controller
node_blogs_controller -->|"reads and mutates blogs"| node_domain_models
node_likes_controller -->|"persists reactions"| node_domain_models
node_comments_controller -->|"persists comments"| node_domain_models
node_auth_controller -->|"manages accounts"| node_user_model
node_domain_models -.->|"belongs to users"| node_user_model
node_blogs_controller -->|"renders or redirects"| node_edge_views
node_auth_controller -->|"renders auth pages"| node_auth_views
node_edge_views -->|"uses shared shell"| node_app_layout
node_database_config -->|"connects to"| node_postgres
node_domain_models -->|"queries via Lucid"| node_postgres
node_migrations -->|"evolves schema"| node_postgres
node_seeder -->|"loads initial data"| node_postgres
node_kernel -.->|"forwards failures"| node_error_handler

click node_server "https://github.com/arpitthool/blogger-app/blob/master/server.ts"
click node_cli "https://github.com/arpitthool/blogger-app/blob/master/commands/index.ts"
click node_routes "https://github.com/arpitthool/blogger-app/blob/master/start/routes.ts"
click node_kernel "https://github.com/arpitthool/blogger-app/blob/master/start/kernel.ts"
click node_auth_config "https://github.com/arpitthool/blogger-app/blob/master/config/auth.ts"
click node_access_middleware "https://github.com/arpitthool/blogger-app/blob/master/app/Middleware/Auth.ts"
click node_auth_controller "https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/AuthController.ts"
click node_error_handler "https://github.com/arpitthool/blogger-app/blob/master/app/Exceptions/Handler.ts"
click node_blogs_controller "https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/BlogsController.ts"
click node_likes_controller "https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/LikesController.ts"
click node_comments_controller "https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/CommentsController.ts"
click node_domain_models "https://github.com/arpitthool/blogger-app/blob/master/app/Models/Blog.ts"
click node_user_model "https://github.com/arpitthool/blogger-app/blob/master/app/Models/User.ts"
click node_edge_views "https://github.com/arpitthool/blogger-app/blob/master/resources/views/blogs/index.edge"
click node_app_layout "https://github.com/arpitthool/blogger-app/blob/master/resources/views/layouts/app.edge"
click node_auth_views "https://github.com/arpitthool/blogger-app/tree/master/resources/views/auth"
click node_database_config "https://github.com/arpitthool/blogger-app/blob/master/config/database.ts"
click node_migrations "https://github.com/arpitthool/blogger-app/blob/master/database/migrations/1699475376434_users.ts"
click node_seeder "https://github.com/arpitthool/blogger-app/blob/master/database/seeders/MainSeeder/Index.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_server,node_cli toneBlue
class node_routes,node_kernel,node_auth_config,node_access_middleware,node_auth_controller,node_error_handler toneAmber
class node_blogs_controller,node_likes_controller,node_comments_controller,node_domain_models,node_user_model toneMint
class node_edge_views,node_app_layout,node_auth_views toneRose
class node_database_config,node_postgres,node_migrations,node_seeder toneIndigo
```

## Components

### Runtime & CLI

- [Adonis HTTP server](https://github.com/arpitthool/blogger-app/blob/master/server.ts): Node runtime · `server.ts`
- [CLI lifecycle commands](https://github.com/arpitthool/blogger-app/blob/master/commands/index.ts): Adonis Ace · `commands/index.ts`

### HTTP & Access

- [Routes](https://github.com/arpitthool/blogger-app/blob/master/start/routes.ts): HTTP control plane · `start/routes.ts`
- [Middleware pipeline](https://github.com/arpitthool/blogger-app/blob/master/start/kernel.ts): Adonis kernel · Defines middleware registration and order. · `start/kernel.ts`
- [Session authentication](https://github.com/arpitthool/blogger-app/blob/master/config/auth.ts): Auth configuration · `config/auth.ts`
- [Access middleware](https://github.com/arpitthool/blogger-app/blob/master/app/Middleware/Auth.ts): Auth / guest / optional identity · `app/Middleware/Auth.ts`
- [Account sessions](https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/AuthController.ts): HTTP controller · `app/Controllers/Http/AuthController.ts`
- [Error translation](https://github.com/arpitthool/blogger-app/blob/master/app/Exceptions/Handler.ts): Exception handler · `app/Exceptions/Handler.ts`

### Blog Domain

- [Blog read and CRUD](https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/BlogsController.ts): HTTP controller · Enforces creator ownership for blog deletion. · `app/Controllers/Http/BlogsController.ts`
- [Like interactions](https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/LikesController.ts): HTTP controller · `app/Controllers/Http/LikesController.ts`
- [Comment interactions](https://github.com/arpitthool/blogger-app/blob/master/app/Controllers/Http/CommentsController.ts): HTTP controller · `app/Controllers/Http/CommentsController.ts`
- [Blog social models](https://github.com/arpitthool/blogger-app/blob/master/app/Models/Blog.ts): Lucid ORM models · Blogs, likes, and comments link content to users. · `app/Models/Blog.ts`
- [User model](https://github.com/arpitthool/blogger-app/blob/master/app/Models/User.ts): Lucid ORM model · `app/Models/User.ts`

### Presentation

- [Blog Edge views](https://github.com/arpitthool/blogger-app/blob/master/resources/views/blogs/index.edge): Server-rendered UI · Index, detail, and user-specific blog pages. · `resources/views/blogs/index.edge`
- [Shared layout and navigation](https://github.com/arpitthool/blogger-app/blob/master/resources/views/layouts/app.edge): Edge layout · `resources/views/layouts/app.edge`
- [Authentication pages](https://github.com/arpitthool/blogger-app/tree/master/resources/views/auth): Edge views · `resources/views/auth`

### Data & Schema

- [PostgreSQL connection](https://github.com/arpitthool/blogger-app/blob/master/config/database.ts): Database configuration · Connection settings derive from validated environment values. · `config/database.ts`
- **PostgreSQL**: Relational database
- [Schema migrations](https://github.com/arpitthool/blogger-app/blob/master/database/migrations/1699475376434_users.ts): Database migrations · Creates user, blog, like, and comment schema. · `database/migrations/1699475376434_users.ts`
- [Initial data seeder](https://github.com/arpitthool/blogger-app/blob/master/database/seeders/MainSeeder/Index.ts): Database seeder · `database/seeders/MainSeeder/Index.ts`

## Connections

- Adonis HTTP server → Routes: serves requests
- Adonis HTTP server → Middleware pipeline: runs pipeline
- CLI lifecycle commands → Schema migrations: runs lifecycle tasks
- Routes → Account sessions: account endpoints
- Routes → Blog read and CRUD: blog endpoints
- Routes → Like interactions: like endpoints
- Routes → Comment interactions: comment endpoints
- Middleware pipeline → Access middleware: applies access rules
- Session authentication → Access middleware: configures identity
- Access middleware → Account sessions: guards session actions
- Access middleware → Blog read and CRUD: guards ownership actions
- Blog read and CRUD → Blog social models: reads and mutates blogs
- Like interactions → Blog social models: persists reactions
- Comment interactions → Blog social models: persists comments
- Account sessions → User model: manages accounts
- Blog social models → User model: belongs to users
- Blog read and CRUD → Blog Edge views: renders or redirects
- Account sessions → Authentication pages: renders auth pages
- Blog Edge views → Shared layout and navigation: uses shared shell
- PostgreSQL connection → PostgreSQL: connects to
- Blog social models → PostgreSQL: queries via Lucid
- Schema migrations → PostgreSQL: evolves schema
- Initial data seeder → PostgreSQL: loads initial data
- Middleware pipeline → Error translation: forwards failures
