Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update folder structure readme #9

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 64 additions & 15 deletions FOLDER_STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,72 @@ This document outlines the recommended folder structure for the project, focusin

## Folder Structure

### `DotnetFoundation.DAL`
The `DotnetFoundation.DAL` folder contains files relating to database calls(repositories and interfaces) and objects(DBOs and DTOs)
### `DotnetFoundation.API`
The `DotnetFoundation.API` folder contains all files and folders related to presenting data for client interaction in the form of JSON objects through HTTP requests. This facilitates the consumption of data by front-end applications. Front-end applications can consume these APIs to display and interact with the data in a user-friendly manner through the UI.

1. `DatabaseContext`: This directory consists of contains code that defines and configures the data model, including entity classes that represent database tables, relationships between these entities, and configuration settings related to database connectivity, schema, etc.
2. `Models`: This contains all database objects and data transfer objects that store attributes of a tables which can be used for input or output.
3. `Repositories`: This folder stores all interfaces and repository code files that deal with implementation/interactions of different tables.
**Components**
Harish-osmosys marked this conversation as resolved.
Show resolved Hide resolved

`Controller`: This folder consists of controller files that act as an intermediary between the user interface and the application logic.

`Properties`: This folder usually consists of launchsettings.json which determines the type of launch profiles to be used to launch the application during development.

`Program.cs`: This file contains the entry point for the application and is responsible for configuring and building the web host.

`appsettings.json`: This file contains application-specific settings, configurations, and connection strings.

**Function**
Harish-osmosys marked this conversation as resolved.
Show resolved Hide resolved
- Responsible for handling HTTP requests.
- Follows RESTful API design principles.
- Contains controllers for user management, authentication, and authorization.

### `DotnetFoundation.Application`
The `DotnetFoundation.Application` folder contains the business logic. All the business logic will be written in this layer. It is in this layer that services interfaces are kept, separate from their implementation, for loose coupling and separation of concerns.

**Components**

`DTO`: Data Transfer Object. Define the DTO for clean data transfer between different layers of the application

`Interfaces`: Contain the interfaces for the services and the repositories providing a contract for interactions between different layers of the application

`Services`: Contain the implementations of the various application services centralizing and managing the business logic and application-specific rules

**Function**
- Manages business logic and application-specific rules.
- Consists of Data Transfer Objects (DTOs), interfaces, and services.
- Interfaces define contracts for interacting with the domain and infrastructure layers.
- Services implement application logic, ensuring separation from infrastructure concerns.

### `DotnetFoundation.Domain`
The `DotnetFoundation.Domain` folder contains the enterprise logic, like the entities and their specifications

**Components**

`Entities`: Defines the Core business entities, representing the fundamental building blocks of the business model

**Function**

- Defines core entities representing the business model.
- Encapsulates business rules, validation, and domain-specific logic.
- Remains independent of infrastructure details.

### `DotnetFoundation.Infrastructure`
The `DotnetFoundation.Infrastructure` folder contains all the database migrations and database context Objects. Here, we have the repositories of all the domain model objects

**Components**

`Identity`: This directory defines entities related to identity models within the ASP.NET Identity framework

`Migrations`: Contain database migration scripts

`Persistence`: Contain database context object and repositories

**Function**

- Implements data storage, external integrations, and identity.
- Includes Identity Models extending the ASP.NET Identity framework.
- UserRepository serves as the bridge between the application and the data storage mechanism.
- Configures dependency injection for infrastructure services.

### `DotnetFoundation.API`
The `DotnetFoundation.API` folder contains all files and folders related to business logic layer which is more in concern with client interaction.

1. `BLL`: This folder contains BLL files which deal with http responses to an api request.
2. `Controller`: This folder consists of controller files that act as an intermediary between the user interface and the application logic.
3. `Helpers`: This folder consists of files that are used to encapsulate reusable methods or functionalities that can be used across an application.
4. `Models`: This folder consists of file that deals with error response when an exception has occured.
5. `Properties`: This folder usually consists of launchsettings.json which determines the type of launch profiles to be used to launch the application during development.
6. `appsettings.json`: This file contains application-specific settings, configurations, and connection strings.
7. `program.cs`: This file contains the entry point for the application and is responsible for configuring and building the web host.

## Best Practices

Expand Down