Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.

Commit 7ac5b61

Browse files
authored
Merge pull request #83 from easysoftware/fe-guidelines-structure-and-architecture
Fe guidelines structure and architecture
2 parents cd8a42e + 589e465 commit 7ac5b61

4 files changed

Lines changed: 102 additions & 20 deletions

File tree

docs/Frontend_tutorials/FE-Code_style.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -357,23 +357,3 @@ function toggleSubMenu(menu) {
357357
>**PREFER** new keywords, for instance creations.
358358
>
359359
>**PREFER** usage of `easyClasses.Widget` (*namespace will be moved to EASY in the future*).
360-
361-
362-
## Vue.js apllications
363-
364-
For new microfrontend applications, it is recommended to use the Vue.js framework. Vue.js applications are located in the app/frontend/src folder, where there are folders for each application and a shared folder for shared code, such as components, API services, utils, types, and more.
365-
366-
### Structure of Vue.js application
367-
368-
These folders can be found in each application and in the shared folder. They may contain subfolders if a more logical division is needed:
369-
370-
- **components** - Vue.js components
371-
- **api** - api services
372-
- **utils** - utils methods
373-
- **types** - TypeScript types
374-
- **composables** - Vue.js composables
375-
- **constants** - constants
376-
- **styles** - Styles in Atomic design
377-
- **graphql** - GraphQL queries and mutations definitions
378-
- **store** - Vuex/Pinia stores
379-
- **directives** - custom Vue.js directives
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Frontend Project Structure & Architecture
2+
3+
## 1. Overview
4+
5+
This document defines the frontend project structure, directory organization, naming conventions, and best practices to ensure maintainability, scalability, and consistency across the codebase.
6+
7+
## 2. General Principles
8+
9+
- **Modularization**: Organize code into feature-based modules rather than generic categories. In module we can import from shared folder, no from another module (except easy_ui).
10+
- **Separation of Concerns**: Keep UI components, API interactions, state management, and utilities separate.
11+
- **Naming Consistency**: Follow a strict and predictable naming convention for files and folders.
12+
- **Scalability**: Design the structure to accommodate future growth and easy feature addition.
13+
- **Single Responsibility Principle**: Each file should have a clearly defined purpose.
14+
15+
## 3. Structure
16+
17+
### 3.1 Base Structure
18+
19+
```
20+
app/frontend/
21+
├── entrypoints/ # Contains entry points files
22+
│ ├── <module_name>.ts # Entry point for a specific module
23+
│ ├── application.js # Global entrypoint accessible in whole application
24+
├── src/ # Contains all frontend modules
25+
│ ├── <module_name>/ # Each module contain subset of module structure or submodules and shared folder
26+
│ │ ├── <submodule_name>/ # Nested submodules (if needed) with same structure as module
27+
│ │ ├── shared/ # Shared between submodules, contain subset of module structure
28+
│ ├── easy_ui/ # Global shared UI components, from this module can be imported in any other module
29+
│ ├── shared/ # Global shared, contain subset of module structure
30+
│ ├── tests/ # Unit and integration frontend tests, contains tests structure, more in frontend testing guidelines
31+
```
32+
33+
### 3.2 Module Structure
34+
35+
```
36+
<module_name>/
37+
├── api/ # API services
38+
├── components/ # Vue components
39+
├── composables/ # Reusable feature-specific logic (Vue composables)
40+
├── constants/ # Module-related constants
41+
├── directives/ # Module-specific directives
42+
├── graphql/ # GraphQL definitions
43+
│ ├── fragments/ # GraphQL fragments definitions
44+
│ ├── mutations/ # GraphQL mutations definitions
45+
│ ├── queries/ # GraphQL queries definitions
46+
├── store/ # Module-specific state management stores
47+
├── stylesheets/ # Global stylesheets, contain structure using atomic design, more in detail in styling guidelines
48+
├── types/ # TypeScript interfaces & types & enums
49+
├── utils/ # Utility functions
50+
```
51+
52+
<!-- theme: danger -->
53+
> **Note**: Module can contain submodules and shared folder or subset of module structure. Not submodules and subset of module structure at the same time. If we need to share somethig between submodules we can use shared folder.
54+
55+
## 4. Naming Conventions
56+
57+
### 4.3 File Naming
58+
59+
- Use **camelCase** for *.ts and *.js filenames.
60+
- Use **PascalCase** for Vue component filenames.
61+
- API services: Filename ends with `Api` suffix like `easyAIFeedbackApi.ts`
62+
- Composables: Filename starts with `use` prefix like `useScrollToBottomMessages.ts`
63+
64+
### 4.2 Directory Naming
65+
66+
- Use **snake_case** for folder names (`easy_scrum_boards`)
67+
- Use **module-based or shared folders** under `src/`.
68+
- Use **shared/** inside modules when common components/utils exist across submodules.
69+
70+
### 4.3 Code Naming
71+
72+
- **API services:** Class name ends with `Api` suffix like `class EasyAIFeedbackApi ...`
73+
- **Composables:** Function name starts with `use` prefix like `const useScrollToBottomMessages = ...`
74+
- **Directives:** Directive name starts with `v` prefix like `const vTrapTab = ...`
75+
- **Graphql fragments:** Definitions name ends with `Fragment` suffix like `const easyAIFeedbackFragment = gql(...`
76+
- **Graphql mutations:** Definitions name ends with `Mutation` suffix like `const easyAIFeedbackMutation = gql(...`
77+
- **Graphql queries:** Definitions name ends with `Query` suffix like `const easyAIFeedbackQuery = gql(...`
78+
- **Store:** Store name has prefix `use` and suffix `Store` like `const useEasyAIFeedbackStore = ...`
79+
- **Typescript enums:** Enum has singular name like `enum EasyAIFeedbackStatus { ... }`

docs/Frontend_tutorials/FE-Testing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@
44

55
---
66

7+
## Tests Structure
78

9+
### Base Test Structure
10+
```
11+
app/frontend/src/tests/
12+
├── <module_name>/ # Tests for a specific module, contains subset of tests module structure
13+
├── shared/ # Shared between tests modules, contain subset of tests module structure
14+
```
15+
16+
### Module Test Structure
17+
```
18+
<module_name>/
19+
├── fixtures/ # Test fixtures
20+
├── mocks/ # Test mocks
21+
├── stubs/ # Test stubs
22+
├── tests/ # Unit and integration tests, can be splitted into separate folders from module structure, but does not have to
23+
├── types/ # TypeScript interfaces & types & enums, typically enum with tests selectors
24+
├── utils/ # Utility functions for tests
25+
```
826

927
## Frontend tests
1028

toc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@
162162
"title": "Frontend Introduction",
163163
"uri": "docs/Frontend_tutorials/FE-Introduction.md"
164164
},
165+
{
166+
"type": "item",
167+
"title": "Frontend Project Structure & Architecture",
168+
"uri": "docs/Frontend_tutorials/FE-Structure-and-architecture.md"
169+
},
165170
{
166171
"type": "item",
167172
"title": "Frontend code style",

0 commit comments

Comments
 (0)