Skip to content

Commit

Permalink
refactor: directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ochairo committed Mar 24, 2024
1 parent 46022fa commit 88424e3
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 53 deletions.
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@
"codespaces",
"datasource",
"datasources",
"drawio",
"foca",
"lefthook",
"ochairo",
"shellscripts",
"turbopack",
"usecase",
"usecases",
"vanillatte",
"vaníllatte",
"drawio"
"vaníllatte"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
Expand Down
81 changes: 46 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Initial technology stack is simple.

## Architecture

The architecture of this project adopts concepts such as Separation of concerns,
Feature oriented clean architecture.

The architecture of this project (FOCA) adopts concepts such as Separation of concerns,
SOLID Principles, Software Design Patterns, Atomic Design, and Readable Code.
These concepts aim to develop applications that are easy to understand, maintain, adapt, and modify.

Expand All @@ -33,45 +35,54 @@ the concepts themselves are complex and hard to understand.
## Directory structure

```sh
├── docs # Documentation files
│ ├── diagrams # - Draw.io diagrams
│ ├── images # - Images for documents
│ └── wiki # - Wiki pages
├── docs # Documentation files
│ ├── diagrams # - Draw.io diagrams
│ ├── images # - Images for documents
│ └── wiki # - Wiki pages
├── scripts # Shell scripts
│ ├── deployment # - Deployment tasks
│ └── utilities # - Utility scripts
├── scripts # Shell scripts
│ ├── deployment # - Deployment tasks
│ └── utilities # - Utility scripts
├── src
│ ├── app # Application code
│ │ ├── core # - Core application code
│ │ │ ├── environment # - Environment manager code
│ │ │ ├── http # - HTTP-related code
│ │ │ └── router # - Router code
│ │ ├── shared # - Shared components and utilities
│ │ │ ├── styles # - Shared stylesheets
│ │ │ └── ui-components # - Reusable UI components
│ │ │ ├── atoms # - Basic UI elements
│ │ │ ├── molecules # - Simple component compositions
│ │ │ └── organisms # - Complex UI components
│ │ ├── features # - Feature-specific code
│ │ │ └── ${feature name} # - Individual features
│ │ │ ├── data # - Data-related modules
│ │ │ │ ├── datasources # - Data sources
│ │ │ │ └── repositories # - Data repositories
│ │ │ ├── domain # - Domain logic
│ │ │ └── presentation # - Presentation components
│ │ ├── main.html # - Main HTML file
│ │ ├── main.ts # - Main TypeScript file
│ │ └── routes.ts # - Routing configuration
│ ├── app
│ │ ├── core # Core application code
│ │ │ └── domain # - Domain-specific logic
│ │ │
│ │ ├── features # Features
│ │ │ └── [feature] # - A specific feature
│ │ │ ├── data # - Data-related logic
│ │ │ │ ├── local # - Local data storage logic
│ │ │ │ └── remote # - Remote data fetching logic
│ │ │ ├── domain # - Feature-specific domain
│ │ │ │ ├── interfaces # - Interfaces used within the feature
│ │ │ │ └── usecases # - Feature-specific business logic
│ │ │ ├── presentation # - Presentation components for the feature
│ │ │ └── [feature].module.ts # - Module file for the feature
│ │ │
│ │ ├── infrastructure # Infrastructure code
│ │ │ ├── adapters # - Adapters for external services
│ │ │ │ └── auth # - Adapter for external auth services
│ │ │ ├── http # - HTTP-related code
│ │ │ ├── router # - Router code for handling routing
│ │ │ ├── styles # - Stylesheets for styling the application
│ │ │ └── ui-components # - UI components
│ │ │ ├── atoms # - Basic UI elements
│ │ │ ├── molecules # - Simple UI components
│ │ │ └── organisms # - Complex UI components
│ │ │
│ │ ├── main.html # Entry point
│ │ ├── main.ts # Bootstrapping
│ │ └── routes.ts # Routing configuration
│ │
│ ├── mock # Mock data and mock API server
│ │ ├── data # - Mock data stored in JSON files
│ │ └── server # - Mock API server utilizing the mock data
│ │
│ └── mock # Mock data, server and test
│ ├── data # - Mock data in json files
│ ├── server # - Mock api server using mock data
│ └── test # - Test codes using mock data
│ └── test # Test code
├── webpack.config.cjs # Webpack configuration file
└── package.json # Project dependencies
├── webpack.config.cjs # Webpack configuration
└── package.json # Project dependencies
```

## Onboarding setup
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "@shared/ui-components/atoms/input/input.component";
import { ShowcaseData } from "@showcase/domain/entities/showcase.entity";
import GetShowcase from "@showcase/domain/usecases/get-showcase.usecase";
import style from "@showcase/presentation/showcase.component.css";
import template from "@showcase/presentation/showcase.component.html";
import "../../../infrastructure/ui-components/atoms/input/input.component";

class ShowcaseComponent extends HTMLElement {
private _shadowRoot: ShadowRoot;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/app/infrastructure/styles/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import url(@infrastructure/styles/reset.css);
@import url(@infrastructure/styles/colors.css);
@import url(@infrastructure/styles/fonts.css);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import url("@infrastructure/styles/styles.css");
input {
color: red;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import style from "@shared/ui-components/atoms/input/input.component.css";
import template from "@shared/ui-components/atoms/input/input.component.html";
import style from "@infrastructure/ui-components/atoms/input/input.component.css";
import template from "@infrastructure/ui-components/atoms/input/input.component.html";

export class InputComponent extends HTMLElement {
_shadowRoot: ShadowRoot;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { router } from "./core/router/router";
import { router } from "./infrastructure/router/router";
import { routesConfig } from "./routes";

const rootElement = document.getElementById("root")!;
Expand Down
2 changes: 1 addition & 1 deletion src/app/routes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import errorModule from "@error/error.module";
import showcaseModule from "@showcase/showcase.module";
import { RouteConfig } from "./core/router/interfaces";
import { RouteConfig } from "./infrastructure/router/interfaces";

// LazyLoad feature modules
export const routesConfig: RouteConfig[] = [
Expand Down
3 changes: 0 additions & 3 deletions src/app/shared/styles/styles.css

This file was deleted.

4 changes: 0 additions & 4 deletions src/app/shared/ui-components/atoms/input/input.component.css

This file was deleted.

Empty file added test/.gitkeep
Empty file.
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
// FEATURES
"@showcase/*": ["./src/app/features/showcase/*"],
"@error/*": ["./src/app/features/error/*"],
// SHARED
"@shared/*": ["./src/app/shared/*"],
// CORE
"@core/*": ["./src/app/core/*"],
// INFRASTRUCTURE
"@infrastructure/*": ["./src/app/infrastructure/*"],
// MOCK
"@mock/*": ["./src/mock/*"],
// TEST
Expand Down
6 changes: 4 additions & 2 deletions webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ module.exports = {
// FEATURES
"@showcase": path.resolve("src/app/features/showcase"),
"@error": path.resolve("src/app/features/error"),
// SHARED
"@shared": path.resolve("src/app/shared"),
// CORE
"@core": path.resolve("src/app/core"),
// INFRASTRUCTURE
"@infrastructure": path.resolve("src/app/infrastructure"),
// MOCK
"@mock": path.resolve("src/mock"),
// TEST
Expand Down

0 comments on commit 88424e3

Please sign in to comment.