my_phoenix_api
├── lib
│ ├── my_phoenix_api
│ │ ├── domain
│ │ │ ├── models
│ │ │ │ ├── user.ex # Domain logic (User entity)
│ │ │ │ └── post.ex # Domain logic (Post entity)
│ │ │ ├── services
│ │ │ │ ├── user_service.ex # Service for user-related business logic
│ │ │ │ └── post_service.ex # Service for post-related business logic
│ │ ├── adapters
│ │ │ ├── external
│ │ │ │ └── external_api_client.ex # Example external API client adapter
│ │ │ ├── internal
│ │ │ │ ├── adapter_behaviour.ex # Shared behaviour for adapters (optional)
│ │ │ │ └── repositories
│ │ │ │ ├── user_repository.ex # Repository for user-related database operations
│ │ │ │ └── post_repository.ex # Repository for post-related database operations
│ │ │ └── ports
│ │ │ ├── user_port.ex # Port defining user-related operations
│ │ │ └── post_port.ex # Port defining post-related operations
│ │ ├── utils # Utility functions and helpers
│ │ │ └── example_util.ex # Example utility module
│ │ └── my_phoenix_api.ex # Main module
│ └── my_phoenix_api_web
│ ├── controllers
│ │ ├── user_controller.ex # Controller for user-related API endpoints
│ │ └── post_controller.ex # Controller for post-related API endpoints
│ ├── channels # Phoenix channels (if needed for WebSocket support)
│ ├── router.ex # Phoenix router for API routes
│ └── endpoint.ex # Phoenix endpoint
├── priv
│ ├── repo
│ │ ├── migrations # Database migrations
│ │ └── seeds.exs # Seed data
│ └── static # Static assets (if needed)
├── test
│ ├── my_phoenix_api
│ │ ├── domain
│ │ │ ├── models
│ │ │ │ ├── user_test.ex # Tests for user entity
│ │ │ │ └── post_test.ex # Tests for post entity
│ │ │ ├── services
│ │ │ │ ├── user_service_test.ex # Tests for user service
│ │ │ │ └── post_service_test.ex # Tests for post service
│ │ ├── adapters
│ │ │ ├── external
│ │ │ │ └── external_api_client_test.ex # Tests for external API client
│ │ │ ├── internal
│ │ │ │ ├── adapter_behaviour_test.ex # Tests for shared adapter behaviour
│ │ │ │ └── repositories
│ │ │ │ ├── user_repository_test.ex # Tests for user repository
│ │ │ │ └── post_repository_test.ex # Tests for post repository
│ │ │ └── ports
│ │ │ ├── user_port_test.ex # Tests for user port
│ │ │ └── post_port_test.ex # Tests for post port
│ │ ├── utils
│ │ │ └── example_util_test.ex # Tests for utility functions
│ └── my_phoenix_api_web
│ ├── controllers
│ │ ├── user_controller_test.ex # Tests for user controller
│ │ └── post_controller_test.ex # Tests for post controller
│ ├── channels # Tests for channels (if needed)
│ └── router_test.ex # Tests for the router
│ └── test_helper.exs # Test setup
├── mix.exs # Mix project configuration
├── mix.lock # Dependency lock file
└── README.md # Project documentation
Last active
April 20, 2025 00:35
-
-
Save nmenag/44e61289480fd3789f916890a1253fef to your computer and use it in GitHub Desktop.
elixir phoenix folder structure hexagonal architecture
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment