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

Refactor: project architecture, ddd #66

Open
lcrojano opened this issue Oct 18, 2024 · 0 comments
Open

Refactor: project architecture, ddd #66

lcrojano opened this issue Oct 18, 2024 · 0 comments
Labels
good first issue Good for newcomers hacktoberfest hacktoberfest-accepted hacktoberfest-accepted help wanted Extra attention is needed

Comments

@lcrojano
Copy link
Owner

Proposed Folder Structure for Frontend Application (DDD with Testing)

This structure supports Firebase authentication and integration with MongoDB Atlas while including dedicated folders for unit, integration, and end-to-end tests.

 
/src
│
├── /domains             # Domain-specific logic and entities
│   ├── /auth            # Authentication domain (e.g., user entity, auth logic)
│   ├── /dashboard       # Dashboard domain (e.g., dashboard data and business logic)
│   └── /common          # Common domain shared across the application
│
├── /components          # Reusable UI components
│   ├── /auth           # Components related to authentication (e.g., login, signup)
│   ├── /common         # Commonly used components (e.g., buttons, modals)
│   └── /dashboard      # Components specific to the dashboard
│
├── /pages              # Top-level pages for routing
│   ├── Home.jsx        # Home page component
│   ├── Login.jsx       # Login page component
│   ├── Signup.jsx      # Signup page component
│   └── Dashboard.jsx    # Dashboard page component
│
├── /hooks              # Custom React hooks
│   ├── useAuth.js      # Hook for Firebase authentication
│   └── useFetch.js     # Hook for data fetching from MongoDB Atlas
│
├── /context            # Context API for state management
│   ├── AuthContext.js   # Context for authentication state
│   └── DataContext.js   # Context for data management
│
├── /services           # Services for API interactions
│   ├── firebase.js     # Firebase configuration and initialization
│   └── api.js          # API functions for MongoDB Atlas
│
├── /styles             # Global styles and theming
│   └── global.css      # Global styles
│
├── /tests              # Testing folder for unit and integration tests
│   ├── /components     # Tests for UI components
│   ├── /domains        # Tests for domain logic
│   ├── /hooks          # Tests for custom hooks
│   └── /services       # Tests for service functions
│
└── App.js              # Main application component
│
/cypress                # Cypress end-to-end tests
│   ├── /fixtures       # Sample data for tests
│   ├── /integration    # E2E tests
│   └── /support        # Custom commands and configurations for Cypress
│

/jest.config.js         # Jest configuration file
/cypress.config.js      # Cypress configuration file

Explanation of the Structure
/domains: Contains domain-specific logic, entities, and business rules, organized by domain.
/components: Holds reusable UI components, organized by functionality and domain relevance.
/pages: Each file represents a distinct page within the application for routing purposes.
/hooks: Custom hooks that encapsulate reusable logic, such as authentication and data fetching.
/context: Contains context providers for managing global state, like user authentication and data.
/services: Dedicated to service files, including Firebase initialization and API interactions with MongoDB Atlas.
/styles: For global styles, ensuring consistent styling across the application.
/tests: Organized folder for unit and integration tests using Jest, categorized by components, domains, hooks, and services.
/cypress: Dedicated folder for Cypress end-to-end testing, containing fixtures, integration tests, and support files.
jest.config.js: Configuration file for Jest, enabling customized test setups.
cypress.config.js: Configuration file for Cypress, allowing for specific test setups and integrations.
This structure promotes a clean separation of concerns while accommodating unit, integration, and E2E testing, making it easier to maintain and scale the application.

@lcrojano lcrojano self-assigned this Oct 18, 2024
@lcrojano lcrojano added help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest-accepted hacktoberfest-accepted hacktoberfest labels Oct 18, 2024
@lcrojano lcrojano removed their assignment Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest hacktoberfest-accepted hacktoberfest-accepted help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant