{"id":20286801,"url":"https://github.com/mdapena/angular-project-structure","last_synced_at":"2025-09-22T16:31:37.216Z","repository":{"id":168269068,"uuid":"612658402","full_name":"mdapena/Angular-Project-Structure","owner":"mdapena","description":"A modular and domain-driven structure for Angular projects","archived":false,"fork":false,"pushed_at":"2023-10-28T15:12:04.000Z","size":493,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-14T14:43:51.922Z","etag":null,"topics":["angular","angular-project-structure","architecture","folder-structure","template","typescript"],"latest_commit_sha":null,"homepage":"https://angular-project-structure-preview.onrender.com","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdapena.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-11T15:49:40.000Z","updated_at":"2024-09-03T06:17:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"61d021c6-0142-4637-be01-f7e651c25098","html_url":"https://github.com/mdapena/Angular-Project-Structure","commit_stats":null,"previous_names":["nachodpp/angular-project-structure","mdapena/angular-project-structure"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdapena%2FAngular-Project-Structure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdapena%2FAngular-Project-Structure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdapena%2FAngular-Project-Structure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdapena%2FAngular-Project-Structure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdapena","download_url":"https://codeload.github.com/mdapena/Angular-Project-Structure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233863308,"owners_count":18742123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-project-structure","architecture","folder-structure","template","typescript"],"created_at":"2024-11-14T14:36:52.023Z","updated_at":"2025-09-22T16:31:31.889Z","avatar_url":"https://github.com/mdapena.png","language":"HTML","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./docs/images/angular.png\" alt=\"angular-logo\" width=\"180px\" height=\"180px\"/\u003e\n  \u003cbr\u003e\n  \u003ci\u003eA modular and domain-driven structure for Angular projects\u003c/i\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt\" target=\"_blank\"\u003e\u003cimg src=\"https://badgen.net/badge/license/MIT/blue\" alt=\"license\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.github.com/angular/angular\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/angular-love-blue?logo=angular\u0026angular=love\" alt=\"angular-love\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://stackblitz.com/github/NachoDPP/Angular-Project-Structure\"\u003e\n    \u003cimg src=\"https://badgen.net/badge/icon/Open in Stackblitz/blue?icon=visualstudio\u0026label\" alt=\"Open in Stackblitz\" /\u003e\n  \u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\n# Angular Project Structure\n\nThis repository proposes a directory structure for any Angular application with a domain and modularity approach. This structure arises from the need to separate the domain/feature layer from the Angular infrastructure concepts.\n\n## About\n\nThe main idea behind this structure is to create an application context bundle that groups all the domain/feature modules of the app, including a shared module inside the app directory, leaving the rest of the infrastructure modules and files outside this scope.\n\nThis directory structure corrects the ng creation of all files within the app directory. The default ng structure forces all code to exist as a subdirectory to the app without giving a clear space for files that are not bound to the application domain or infrastructure related, such as config and core modules, application bootstrap factories, testing section, and so on.\n\n## Tree Sections\n\nThese are the sections that this repository proposes to add to the default structure of an Angular application. Click on the sections below for more information.\n\n- **Sections**\n\n  - [App Directory](./docs/app-directory.md)\n  - [Shared Directory](./docs/shared-directory.md)\n  - [Assets Directory](./docs/assets-directory.md)\n  - [Config Directory](./docs/config-directory.md)\n  - [Core Directory](./docs/core-directory.md)\n  - [Styles Directory](./docs/styles-directory.md)\n  - [Test Directory](./docs/test-directory.md)\n\n- **Extras**\n\n  - [Path Alias](./docs/path-alias.md)\n\n## Tree Structure\n\n```bash\nsrc\n┣ app\n|  ┣ landing\n|  |  ┣ pages\n|  |  |  ┗ landing-page\n|  |  |     ┗ landing-page.component|.html|.scss|.ts\n|  |  ┣ landing-routing.module.ts\n|  |  ┗ landing.module.ts\n|  ┣ shared\n|  |  ┗ shared.module.ts\n|  ┣ app-routing.module.ts\n|  ┗ app.module.ts\n|\n┣ assets\n|  ┗ favicons\n|      ┗ favicon.ico\n|\n┣ config\n|  ┣ enums\n|  |  ┗ environment.enum.ts\n|  ┣ environments\n|  |  ┣ environment.devt.ts\n|  |  ┗ environment.ts\n|  ┣ interfaces\n|  |  ┣ config.interface.ts\n|  |  ┗ environment.interfaces.ts\n|  ┣ services\n|  |  ┗ config.service.ts\n|  ┣ config.module.ts\n|  ┣ envconfig.devt.json\n|  ┗ envconfig.prod.json\n|\n┣ core\n|  ┣ guards\n|  |  ┗ singleton.guard.ts\n|  ┣ layout\n|  |  ┗ toolbar\n|  |     ┗ toolbar.component|.html|.scss|.ts\n|  ┣ pages\n|  |  ┗ page-not-found\n|  |     ┗ page-not-found.component|.html|.scss|.ts\n|  ┗ core.module.ts\n|\n┣ styles\n|  ┗ styles.scss\n|\n┣ index.html\n┣ main-routing.module.ts\n┣ main.component.html\n┣ main.component.ts\n┣ main.module.ts\n┗ main.ts\n```\n\n```bash\n.\n┣ src\n|   ...\n┣ test\n|   ┣ app\n|   |  ┣ landing\n|   |  |  ┣ pages\n|   |  |  |  ┗ landing-page.component.spec.ts\n|   |  |  ┣ landing-routing.module.spec.ts\n|   |  |  ┗ landing.module.spec.ts\n|   |  ┣ shared\n|   |  |  ┗ shared.module.spec.ts\n|   |  ┣ app-routing.module.spec.ts\n|   |  ┗ app.module.spec.ts\n|   ┣ config\n|   |  ┗ config.service.spec.ts\n|   ┣ core\n|   |  ┣ guards\n|   |  |  ┗ singleton.guard.spec.ts\n|   |  ┣ layout\n|   |  |  ┗ toolbar.component.spec.ts\n|   |  ┣ pages\n|   |  |  ┗ page-not-found.component.spec.ts\n|   |  ┗ singleton.guard.spec.ts\n|   ┣ main-routing.module.spec.ts\n|   ┣ main.component.spec.ts\n|   ┗ main.module.spec.ts\n```\n\n## Tree Structure in a New Angular Application\n\nThese instructions describe how to add this structure to a new Angular application that has been created using the Angular CLI. Remember to replace the value of **\"project-name\"** in the commands with the desired one.\n\n#### 1 - Create a new workspace and an initial application\n\n```bash\n# Prerequisites: Install [Angular CLI] and [Node.js] which includes [Node Package Manager][npm]\n$ ng new project-name\n$ cd project-name \u0026\u0026 ng generate environments \u0026\u0026 cd .. \n$ git clone https://github.com/NachoDPP/Angular-Project-Structure.git \n$ rm -rf project-name/src \n$ mv Angular-Project-Structure/src project-name/src \n$ mv Angular-Project-Structure/test project-name/test \n$ rm -rf Angular-Project-Structure\n```\n\n#### 2 - Typescript configurations, path aliases and angular.json\n\n```bash\n# Typescript Configurations and Path Aliases\n$ json --version || npm install -g json\n$ cd project-name\n$ sed -i '1d' tsconfig.json \u0026\u0026 sed -i '1d' tsconfig.spec.json\n```\n\n##### 2.1 - tsconfig.json\n\n```bash\n# tsconfig.json\n$ json -f tsconfig.json -I -c \"this.compilerOptions.paths = {}\"\n$ json -f tsconfig.json -I \\\n    -e \"this.compilerOptions.paths['@config/*'] = ['src/config/*']\" \\\n    -e \"this.compilerOptions.paths['@core/*'] = ['src/core/*']\" \\\n    -e \"this.compilerOptions.paths['@app/*'] = ['src/app/*']\" \\\n    -e \"this.compilerOptions.paths['@assets/*'] = ['src/assets/*']\"\n```\n\n##### 2.2 - tsconfig.spec.json\n\n```bash\n# tsconfig.spec.json\n$ json -f tsconfig.spec.json -I \\\n    -e \"this.include[0] = 'test/**/*.spec.ts'\" \\\n    -e \"this.include[1] = 'test/**/*.d.ts'\" \n```\n\n##### 2.3 - angular.json\n\n```bash\n# angular.json\n$ json -f angular.json -I \\\n    -e \"this.projects['project-name'].architect.build.options.assets = ['src/assets', 'src/config/envconfig.devt.json', 'src/config/envconfig.prod.json']\" \\\n    -e \"this.projects['project-name'].architect.build.options.styles = ['src/styles/styles.scss']\" \\\n    -e \"this.projects['project-name'].architect.build.configurations.development.fileReplacements[0].replace = 'src/config/environments/environment.ts'\" \\\n    -e \"this.projects['project-name'].architect.build.configurations.development.fileReplacements[0].with = 'src/config/environments/environment.devt.ts'\" \\\n    -e \"this.projects['project-name'].architect.test.options.assets = ['src/assets', 'src/config/envconfig.devt.json', 'src/config/envconfig.prod.json']\" \\\n    -e \"this.projects['project-name'].architect.test.options.styles = ['src/styles/styles.scss']\" \\\n    -e \"this.projects['project-name'].architect.test.options.include = ['../test/**/**.spec.ts', '../test/**/**.d.ts']\"\n```\n\n#### 3 - Post configuration\n\n```bash\n# Retrieving the commented line from the tsconfig.json and tsconfig.spec.json files\n$ sed -i '1s/^/\\/* To learn more about this file see: https:\\/\\/angular.io\\/config\\/tsconfig. *\\/\\n/' tsconfig.json \n$ sed -i '1s/^/\\/* To learn more about this file see: https:\\/\\/angular.io\\/config\\/tsconfig. *\\/\\n/' tsconfig.spec.json\n$ npm uninstall -g json # Uninstalling the npm json cli package\n```\n## Running the App\n\n```bash\n# Prerequisites: Install [Node.js] which includes [Node Package Manager][npm]\n$ npm install\n```\n\n```bash\n# Development\n$ ng serve\n```\n\n```bash\n# Production Mode\n$ ng build\n```\n\n```bash\n# Unit Tests\n$ ng test\n```\n\n## License\n\nCopyright (c) Manuel Da Pena. [@NachoDPP](https://github.com/NachoDPP \"@NachoDPP\")\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n## Considerations\n\nPlease keep in mind that this concept is in its early stages of execution and design; any suggestions or comments are welcome. Feel free to design your own structure if this one is not suitable.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdapena%2Fangular-project-structure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdapena%2Fangular-project-structure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdapena%2Fangular-project-structure/lists"}