From 6e504050f072ea635a3532cbb7ac66e816d88f92 Mon Sep 17 00:00:00 2001 From: oabrivard Date: Fri, 30 Jan 2026 11:34:31 +0100 Subject: [PATCH] Defined project's directory structure --- .../application-architecture.md | 180 +++++++++++------- 1 file changed, 110 insertions(+), 70 deletions(-) diff --git a/docs/2_architecture/application-architecture.md b/docs/2_architecture/application-architecture.md index e99b3a0..f2fd691 100644 --- a/docs/2_architecture/application-architecture.md +++ b/docs/2_architecture/application-architecture.md @@ -198,88 +198,128 @@ CI/CD: ``` knowfoolery/ ├── docs/ # Project documentation +│ ├── 1_requirements/ # Functional and Non Functional requirements +│ ├── 2_architecture/ # Application architecture +│ │ ├── decisions/ # ADRs (Architecture Decision Records) +│ │ ├── diagrams/ +│ │ └── api-specs/ # OpenAPI specs +│ └── 3_guidelines/ # Project guidelines including design guidelines ├── backend/ +│ ├── tools/ # Build tools, code generators │ ├── services/ # Microservices -│ │ ├── {service-name}/ +│ │ ├── api-gateway/ # Entry point, routes to services │ │ │ ├── cmd/ -│ │ │ │ └── main.go # Service entry point -│ │ │ ├── internal/ -│ │ │ │ ├── handlers/ # Fiber HTTP handlers -│ │ │ │ ├── app/ # Business logic (commands, queries, dto) -│ │ │ │ ├── domain/ # Domain logic (aggregates, value objects, repositories interfaces, services from Domain Driven Design) -│ │ │ │ ├── infra/ -│ │ │ │ │ ├── events/ -│ │ │ │ │ ├── grpc/ -│ │ │ │ │ └── ent/ # Ent models and schemas + repositories implementation -│ │ │ ├── api/ # API definitions (OpenAPI/gRPC) -│ │ │ ├── config/ # Configuration management -│ │ │ ├── tests/ # Service-specific tests -│ │ │ ├── Dockerfile # Container definition -│ │ │ └── go.mod # Go module -│ │ └── shared/ # Shared packages -│ │ │ ├── errors/ # Shared domain errors -│ │ │ ├── events/ # Domain events contracts -│ │ │ ├── types/ # Shared types -│ │ │ ├── valueobjects/ # Shared value objects -│ │ │ └── infra/ -│ │ │ ├── auth/ # JWT middleware & Zitadel integration -│ │ │ ├── observability/ # Metrics and tracing -│ │ │ ├── security/ # Security utilities -│ │ │ └── utils/ # Common utilities +│ │ │ │ └── main.go +│ │ │ └── internal/ +│ │ │ ├── config/ +│ │ │ │ └── config.go +│ │ │ ├── routes/ +│ │ │ │ └── router.go +│ │ │ └── proxy/ +│ │ │ └── handlers.go +│ │ └── {service-name}/ +│ │ ├── cmd/ +│ │ │ └── main.go # Service entry point +│ │ ├── config/ # Configuration management (Viper/env configuration) +│ │ ├── migrations/ # Ent's migration +│ │ ├── internal/ +│ │ │ ├── handlers/ # Fiber HTTP handlers +│ │ │ ├── app/ # Business logic (commands, queries, dto) +│ │ │ │ ├── command/ +│ │ │ │ ├── query/ +│ │ │ │ └── dto/ +│ │ │ ├── domain/ # Domain logic in pure Go (Domain Driven Design) +│ │ │ │ ├── model/ # Aggregates and Value objects +│ │ │ │ ├── repository/ # Reponsitory interfaces +│ │ │ │ ├── service/ # Services +│ │ │ │ └── events/ # events +│ │ │ ├── infra/ +│ │ │ │ └── ent/ # Ent models and schemas + repositories implementation +│ │ │ │ │ ├── model/ # Ent models and schemas +│ │ │ │ │ │ ├── schema/ +│ │ │ │ │ │ ├── generate.go # //go:generate directive +│ │ │ │ │ │ └── ... (generated) +│ │ │ │ │ ├── repository/ # Implements domain interface +│ │ │ │ │ └── mapper/ # ent to domain mapper +│ │ │ │ │ +│ │ │ │ └── cache/ +│ │ │ └── interfaces/ # Interface adapters (HTTP, gRPC) +│ │ │ ├── events/ +│ │ │ ├── api/ # API definitions (OpenAPI/gRPC) +│ │ │ └── http/ +│ │ │ ├── handlers/ # Fiber HTTP handlers +│ │ │ └── middleware/ +│ │ └── tests/ # Service-specific tests +│ └── shared/ # Shared packages +│ ├── domain/ +│ │ ├── errors/ # Shared domain errors +│ │ ├── events/ # Domain events contracts +│ │ ├── types/ # Shared types +│ │ └── valueobjects/ # Shared value objects +│ └── infra/ +│ ├── auth/ +│ │ ├── zitadel/ # JWT middleware & Zitadel integration +│ │ └── rbac/ +│ ├── database/ # Ent database client +│ │ ├── postgres/ +│ │ └── redis/ +│ ├── observability/ # Metrics and tracing +│ │ ├── logging/ # Structured logging +│ │ ├── tracing/ # OpenTelemetry +│ │ └── metrics/ # Prometheus +│ ├── security/ # Security utilities +│ └── utils/ # Common utilities like httputil (errors, pagintaion, response) +│ ├── frontend/ │ ├── shared/ -│ │ ├── ui-components/ # Shared Gluestack UI components +│ │ ├── ui-components/ # Shared UI components │ │ ├── logic/ # Business logic │ │ ├── types/ # TypeScript types │ │ └── utils/ # Utility functions │ └── apps/ -│ ├── web/ # React web app -│ ├── mobile/ # React Native app -│ └── desktop/ # Wails desktop app +│ ├── web/ # SolidJS web app (Vite + TypeScript) +│ │ ├── package.json +│ │ ├── vite.config.ts +│ │ ├── index.html +│ │ ├── public/ +│ │ ├── src/ +│ │ │ ├── main.tsx +│ │ │ ├── App.tsx +│ │ │ ├── routes/ +│ │ │ ├── layouts/ +│ │ │ ├── features/ # Feature-based organization +│ │ │ ├── hooks/ # App-specific hooks +│ │ │ ├── utils/ +│ │ │ └── styles/ +│ │ │ └── global.css +│ │ └── tsconfig.json +│ └── cross-platform/ # Tauri app (embeds the SolidJS web app) +│ ├── package.json +│ ├── vite.config.ts +│ ├── src/ # Inherits most from web app +│ │ ├── main.tsx +│ │ ├── App.tsx # May wrap web App with desktop-specific logic +│ │ └── platform/ # Desktop-specific code +│ │ +│ ├── src-tauri/ # Rust/Tauri native code +│ │ ├── Cargo.toml +│ │ ├── tauri.conf.json +│ │ ├── capabilities/ +│ │ ├── icons/ +│ │ ├── src/ +│ │ │ ├── main.rs +│ │ │ ├── lib.rs +│ │ │ ├── commands/ # Tauri commands (Rust ↔ JS bridge) +│ │ │ └── plugins/ +│ │ └── build.rs +│ └── tsconfig.json +│ └── infrastructure/ # DevOps and deployment ├── dev/ # Development setup │ ├── docker-compose.yml # dev stack (hot reload, mounts) │ └── api.env # dev env vars └── prod/ # Production setup -``` - -### Backend Directory Structure -``` -backend/ -├── Domain/ # Domain logic (DDD patterns) -├── services/ # Microservices -│ ├── {service-name}/ -│ │ ├── cmd/main.go # Service entry point -│ │ ├── internal/ -│ │ │ ├── handlers/ # Fiber HTTP handlers -│ │ │ ├── app/ # Business logic -│ │ │ ├── middleware/ # Service-specific middleware -│ │ │ └── models/ # Ent models and schemas -│ │ ├── config/ # Configuration management -│ │ └── tests/ # Service-specific tests -│ └── shared/ # Shared packages -│ ├── auth/ # JWT & Zitadel integration -│ ├── database/ # Ent database client -│ ├── observability/ # Metrics and tracing -│ └── security/ # Security utilities -``` - -### Frontend Structure -``` -frontend/ -├── shared/ -│ ├── ui-components/ # Shared Gluestack UI components -│ ├── logic/ # Business logic -│ ├── types/ # TypeScript types -│ └── utils/ # Utility functions -└── apps/ - ├── web/ # SolidJS web app (Vite + TypeScript) - └── cross-platform/ # Tauri app (embeds the SolidJS web app) -``` - -### Infrastructure Structure -``` -Infrastructure/ -├── dev/ # Scripts to setup and start development infrastructure -└── prod/ # Scripts to setup and start production infrastructure + │ ├── docker-compose.yml # prod stack + │ └── api.env # prod env vars + └── services/ # Dockerfiles ```