diff --git a/404.html b/404.html index e22e35da..4fab2dc4 100644 --- a/404.html +++ b/404.html @@ -18,7 +18,7 @@ - +
diff --git a/assets/js/0058b4c6.3377be63.js b/assets/js/0058b4c6.3377be63.js deleted file mode 100644 index 3a5a10d9..00000000 --- a/assets/js/0058b4c6.3377be63.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[849],{6164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"category","label":"Getting Started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/getting-started/installation","docId":"getting-started/installation","unlisted":false},{"type":"link","label":"AthennaRC File","href":"/docs/getting-started/athennarc-file","docId":"getting-started/athennarc-file","unlisted":false},{"type":"link","label":"Configuration","href":"/docs/getting-started/configuration","docId":"getting-started/configuration","unlisted":false},{"type":"link","label":"Directory Structure","href":"/docs/getting-started/directory-structure","docId":"getting-started/directory-structure","unlisted":false}]},{"type":"category","label":"Architecture Concepts","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Application Lifecycle","href":"/docs/architecture-concepts/application-lifecycle","docId":"architecture-concepts/application-lifecycle","unlisted":false},{"type":"link","label":"Service Container","href":"/docs/architecture-concepts/service-container","docId":"architecture-concepts/service-container","unlisted":false},{"type":"link","label":"Service Providers","href":"/docs/architecture-concepts/service-providers","docId":"architecture-concepts/service-providers","unlisted":false},{"type":"link","label":"Facades","href":"/docs/architecture-concepts/facades","docId":"architecture-concepts/facades","unlisted":false}]},{"type":"category","label":"The Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Logging","href":"/docs/the-basics/logging","docId":"the-basics/logging","unlisted":false},{"type":"link","label":"Helpers","href":"/docs/the-basics/helpers","docId":"the-basics/helpers","unlisted":false},{"type":"link","label":"Compilation","href":"/docs/the-basics/compilation","docId":"the-basics/compilation","unlisted":false},{"type":"link","label":"Deployment","href":"/docs/the-basics/deployment","docId":"the-basics/deployment","unlisted":false}]},{"type":"category","label":"Digging Deeper","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"REPL","href":"/docs/digging-deeper/repl","docId":"digging-deeper/repl","unlisted":false},{"type":"link","label":"Graceful Shutdown","href":"/docs/digging-deeper/graceful-shutdown","docId":"digging-deeper/graceful-shutdown","unlisted":false},{"type":"link","label":"Collections","href":"/docs/digging-deeper/collections","docId":"digging-deeper/collections","unlisted":false},{"type":"link","label":"Mail","href":"/docs/digging-deeper/mail","docId":"digging-deeper/mail","unlisted":false},{"type":"link","label":"Library Development","href":"/docs/digging-deeper/library-development","docId":"digging-deeper/library-development","unlisted":false}]},{"type":"category","label":"REST API Application","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Routing","href":"/docs/rest-api-application/routing","docId":"rest-api-application/routing","unlisted":false},{"type":"link","label":"Middlewares","href":"/docs/rest-api-application/middlewares","docId":"rest-api-application/middlewares","unlisted":false},{"type":"link","label":"Controllers","href":"/docs/rest-api-application/controllers","docId":"rest-api-application/controllers","unlisted":false},{"type":"link","label":"Request Context","href":"/docs/rest-api-application/request-context","docId":"rest-api-application/request-context","unlisted":false},{"type":"link","label":"Error Handling","href":"/docs/rest-api-application/error-handling","docId":"rest-api-application/error-handling","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/rest-api-application/annotations","docId":"rest-api-application/annotations","unlisted":false},{"type":"link","label":"Rate Limiting","href":"/docs/rest-api-application/rate-limiting","docId":"rest-api-application/rate-limiting","unlisted":false},{"type":"link","label":"Tracing Requests","href":"/docs/rest-api-application/tracing-requests","docId":"rest-api-application/tracing-requests","unlisted":false},{"type":"link","label":"Security with Helmet","href":"/docs/rest-api-application/security-with-helmet","docId":"rest-api-application/security-with-helmet","unlisted":false},{"type":"link","label":"Swagger Documentation","href":"/docs/rest-api-application/swagger-documentation","docId":"rest-api-application/swagger-documentation","unlisted":false},{"type":"link","label":"Views","href":"/docs/rest-api-application/views","docId":"rest-api-application/views","unlisted":false},{"type":"link","label":"Static Files","href":"/docs/rest-api-application/static-files","docId":"rest-api-application/static-files","unlisted":false}]},{"type":"category","label":"CLI Application","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Commands","href":"/docs/cli-application/commands","docId":"cli-application/commands","unlisted":false},{"type":"link","label":"Running","href":"/docs/cli-application/running","docId":"cli-application/running","unlisted":false},{"type":"link","label":"Publishing","href":"/docs/cli-application/publishing","docId":"cli-application/publishing","unlisted":false},{"type":"link","label":"Error Handling","href":"/docs/cli-application/error-handling","docId":"cli-application/error-handling","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/cli-application/annotations","docId":"cli-application/annotations","unlisted":false}]},{"type":"category","label":"CRON Application","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Schedulers","href":"/docs/cron-application/schedulers","docId":"cron-application/schedulers","unlisted":false},{"type":"link","label":"CRON Context","href":"/docs/cron-application/cron-context","docId":"cron-application/cron-context","unlisted":false},{"type":"link","label":"Error Handling","href":"/docs/cron-application/error-handling","docId":"cron-application/error-handling","unlisted":false},{"type":"link","label":"Tracing Executions","href":"/docs/cron-application/tracing-executions","docId":"cron-application/tracing-executions","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/cron-application/annotations","docId":"cron-application/annotations","unlisted":false}]},{"type":"category","label":"Database","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Getting Started","href":"/docs/database/getting-started","docId":"database/getting-started","unlisted":false},{"type":"link","label":"Query Builder","href":"/docs/database/query-builder","docId":"database/query-builder","unlisted":false},{"type":"link","label":"Migrations","href":"/docs/database/migrations","docId":"database/migrations","unlisted":false},{"type":"link","label":"Seeding","href":"/docs/database/seeding","docId":"database/seeding","unlisted":false}]},{"type":"category","label":"ORM","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Getting Started","href":"/docs/orm/getting-started","docId":"orm/getting-started","unlisted":false},{"type":"link","label":"Query Builder","href":"/docs/orm/query-builder","docId":"orm/query-builder","unlisted":false},{"type":"link","label":"Relationships","href":"/docs/orm/relationships","docId":"orm/relationships","unlisted":false},{"type":"link","label":"Extending Models","href":"/docs/orm/extending-models","docId":"orm/extending-models","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/orm/annotations","docId":"orm/annotations","unlisted":false},{"type":"link","label":"Factories","href":"/docs/orm/factories","docId":"orm/factories","unlisted":false}]},{"type":"category","label":"Testing","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Getting Started","href":"/docs/testing/getting-started","docId":"testing/getting-started","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/testing/annotations","docId":"testing/annotations","unlisted":false},{"type":"link","label":"REST API Testing","href":"/docs/testing/rest-api-testing","docId":"testing/rest-api-testing","unlisted":false},{"type":"link","label":"CLI Testing","href":"/docs/testing/cli-tests","docId":"testing/cli-tests","unlisted":false},{"type":"link","label":"Mocking","href":"/docs/testing/mocking","docId":"testing/mocking","unlisted":false}]}]},"docs":{"architecture-concepts/application-lifecycle":{"id":"architecture-concepts/application-lifecycle","title":"Application Lifecycle","description":"Understand each one of the Athenna applications lifecycles.","sidebar":"tutorialSidebar"},"architecture-concepts/facades":{"id":"architecture-concepts/facades","title":"Facades","description":"Understand the purpose and how to use the Athenna facades.","sidebar":"tutorialSidebar"},"architecture-concepts/service-container":{"id":"architecture-concepts/service-container","title":"Service Container","description":"Understand the purpose and how to use the Athenna service container.","sidebar":"tutorialSidebar"},"architecture-concepts/service-providers":{"id":"architecture-concepts/service-providers","title":"Service Providers","description":"Understand the purpose and how to use the Athenna service providers.","sidebar":"tutorialSidebar"},"cli-application/annotations":{"id":"cli-application/annotations","title":"Annotations","description":"Check all available Artisan annotations and it options.","sidebar":"tutorialSidebar"},"cli-application/commands":{"id":"cli-application/commands","title":"Commands","description":"See how to create and configure your CLI commands.","sidebar":"tutorialSidebar"},"cli-application/error-handling":{"id":"cli-application/error-handling","title":"Error Handling","description":"Understand how you can handle the errors of the CLI Application.","sidebar":"tutorialSidebar"},"cli-application/publishing":{"id":"cli-application/publishing","title":"Publishing","description":"Check how you can publish a global CLI application.","sidebar":"tutorialSidebar"},"cli-application/running":{"id":"cli-application/running","title":"Running","description":"Check how to run your CLI commands in different scenarios.","sidebar":"tutorialSidebar"},"cron-application/annotations":{"id":"cron-application/annotations","title":"Annotations","description":"Check all available CRON annotations and it options.","sidebar":"tutorialSidebar"},"cron-application/cron-context":{"id":"cron-application/cron-context","title":"CRON Context","description":"Understand the purpose of the CRON context object.","sidebar":"tutorialSidebar"},"cron-application/error-handling":{"id":"cron-application/error-handling","title":"Error Handling","description":"Understand how you can handle the errors of the CRON Application.","sidebar":"tutorialSidebar"},"cron-application/schedulers":{"id":"cron-application/schedulers","title":"Schedulers","description":"See how to create and configure your CRON job schedulers.","sidebar":"tutorialSidebar"},"cron-application/tracing-executions":{"id":"cron-application/tracing-executions","title":"Tracing Executions","description":"Understand how to trace executions of your CRON application.","sidebar":"tutorialSidebar"},"database/getting-started":{"id":"database/getting-started","title":"Getting Started","description":"See how to create database connections in Athenna Framework.","sidebar":"tutorialSidebar"},"database/migrations":{"id":"database/migrations","title":"Migrations","description":"See how to create and run database migrations in Athenna Framework.","sidebar":"tutorialSidebar"},"database/query-builder":{"id":"database/query-builder","title":"Query Builder","description":"See how to use the Athenna database query builder.","sidebar":"tutorialSidebar"},"database/seeding":{"id":"database/seeding","title":"Seeding","description":"See how to create and run database seeders.","sidebar":"tutorialSidebar"},"digging-deeper/collections":{"id":"digging-deeper/collections","title":"Collections","description":"Understand the Collections API of the Athenna Framework.","sidebar":"tutorialSidebar"},"digging-deeper/graceful-shutdown":{"id":"digging-deeper/graceful-shutdown","title":"Graceful Shutdown","description":"See how to graceful shutdown any kind of Athenna application.","sidebar":"tutorialSidebar"},"digging-deeper/library-development":{"id":"digging-deeper/library-development","title":"Library Development","description":"See how you can create your own library and integrate with Athenna.","sidebar":"tutorialSidebar"},"digging-deeper/mail":{"id":"digging-deeper/mail","title":"Mail","description":"See how to send emails in Athenna.","sidebar":"tutorialSidebar"},"digging-deeper/repl":{"id":"digging-deeper/repl","title":"REPL","description":"See how to create a REPL session with Athenna Framework ecosystem.","sidebar":"tutorialSidebar"},"getting-started/athennarc-file":{"id":"getting-started/athennarc-file","title":"AthennaRC File","description":"Understand what is the purpose of the .athennarc.json file.","sidebar":"tutorialSidebar"},"getting-started/configuration":{"id":"getting-started/configuration","title":"Configuration","description":"Understand the initial configurations of your project.","sidebar":"tutorialSidebar"},"getting-started/directory-structure":{"id":"getting-started/directory-structure","title":"Directory Structure","description":"Understand the directory structure of your project.","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"How to install and set up your first Athenna project.","sidebar":"tutorialSidebar"},"orm/annotations":{"id":"orm/annotations","title":"Annotations","description":"Check all available ORM annotations and it options.","sidebar":"tutorialSidebar"},"orm/extending-models":{"id":"orm/extending-models","title":"Extending Models","description":"See how to extend models implementations in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/factories":{"id":"orm/factories","title":"Factories","description":"See how to factory fake models in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/getting-started":{"id":"orm/getting-started","title":"Getting Started","description":"See how to create models in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/query-builder":{"id":"orm/query-builder","title":"Query Builder","description":"See how to retrieve, insert, update and delete models using the query builder in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/relationships":{"id":"orm/relationships","title":"Relationships","description":"See how to create relations between models in Athenna Framework.","sidebar":"tutorialSidebar"},"rest-api-application/annotations":{"id":"rest-api-application/annotations","title":"Annotations","description":"Check all available REST API annotations and it options.","sidebar":"tutorialSidebar"},"rest-api-application/controllers":{"id":"rest-api-application/controllers","title":"Controllers","description":"Understand how you can set up controllers in your REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/error-handling":{"id":"rest-api-application/error-handling","title":"Error Handling","description":"Understand how you can handle the errors of the REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/middlewares":{"id":"rest-api-application/middlewares","title":"Middlewares","description":"Understand how you can set up middlewares in your REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/rate-limiting":{"id":"rest-api-application/rate-limiting","title":"Rate Limiting","description":"See how to create rate limiting rules for Athenna REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/request-context":{"id":"rest-api-application/request-context","title":"Request Context","description":"Understand the purpose of the request context object.","sidebar":"tutorialSidebar"},"rest-api-application/routing":{"id":"rest-api-application/routing","title":"Routing","description":"Understand how you can set up routes for your REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/security-with-helmet":{"id":"rest-api-application/security-with-helmet","title":"Security with Helmet","description":"See how to improve the security of your REST API with Helmet in Athenna.","sidebar":"tutorialSidebar"},"rest-api-application/static-files":{"id":"rest-api-application/static-files","title":"Static Files","description":"See how to serve static files in Athenna REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/swagger-documentation":{"id":"rest-api-application/swagger-documentation","title":"Swagger Documentation","description":"See how to create the Swagger documentation for Athenna REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/tracing-requests":{"id":"rest-api-application/tracing-requests","title":"Tracing Requests","description":"Understand how to trace requests in your REST API application of Athenna.","sidebar":"tutorialSidebar"},"rest-api-application/views":{"id":"rest-api-application/views","title":"Views","description":"Understand how you can use the Athenna view API for rendering HTML pages.","sidebar":"tutorialSidebar"},"testing/annotations":{"id":"testing/annotations","title":"Annotations","description":"Check all available testing annotations and it options.","sidebar":"tutorialSidebar"},"testing/cli-tests":{"id":"testing/cli-tests","title":"CLI Testing","description":"See how to create tests for CLI applications in Athenna.","sidebar":"tutorialSidebar"},"testing/getting-started":{"id":"testing/getting-started","title":"Getting Started","description":"See how to create tests in an Athenna application.","sidebar":"tutorialSidebar"},"testing/mocking":{"id":"testing/mocking","title":"Mocking","description":"Understand how to mock dependencies and functions in Athenna.","sidebar":"tutorialSidebar"},"testing/rest-api-testing":{"id":"testing/rest-api-testing","title":"REST API Testing","description":"See how to create tests for REST APIs applications in Athenna.","sidebar":"tutorialSidebar"},"the-basics/compilation":{"id":"the-basics/compilation","title":"Compilation","description":"Understand the TypeScript compilation process of Athenna.","sidebar":"tutorialSidebar"},"the-basics/deployment":{"id":"the-basics/deployment","title":"Deployment","description":"See how to deploy any kind of Athenna application.","sidebar":"tutorialSidebar"},"the-basics/helpers":{"id":"the-basics/helpers","title":"Helpers","description":"Understand how to use all the Athenna Helpers from @athenna/common and other packages.","sidebar":"tutorialSidebar"},"the-basics/logging":{"id":"the-basics/logging","title":"Logging","description":"Understand how you can use the Athenna logging API.","sidebar":"tutorialSidebar"}}}}')}}]); \ No newline at end of file diff --git a/assets/js/0058b4c6.e7eea27f.js b/assets/js/0058b4c6.e7eea27f.js new file mode 100644 index 00000000..0332483d --- /dev/null +++ b/assets/js/0058b4c6.e7eea27f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[849],{6164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"category","label":"Getting Started","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/getting-started/installation","docId":"getting-started/installation","unlisted":false},{"type":"link","label":"Athenna RC File","href":"/docs/getting-started/athennarc-file","docId":"getting-started/athennarc-file","unlisted":false},{"type":"link","label":"Configuration","href":"/docs/getting-started/configuration","docId":"getting-started/configuration","unlisted":false},{"type":"link","label":"Directory Structure","href":"/docs/getting-started/directory-structure","docId":"getting-started/directory-structure","unlisted":false}]},{"type":"category","label":"Architecture Concepts","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Application Lifecycle","href":"/docs/architecture-concepts/application-lifecycle","docId":"architecture-concepts/application-lifecycle","unlisted":false},{"type":"link","label":"Service Container","href":"/docs/architecture-concepts/service-container","docId":"architecture-concepts/service-container","unlisted":false},{"type":"link","label":"Service Providers","href":"/docs/architecture-concepts/service-providers","docId":"architecture-concepts/service-providers","unlisted":false},{"type":"link","label":"Facades","href":"/docs/architecture-concepts/facades","docId":"architecture-concepts/facades","unlisted":false}]},{"type":"category","label":"The Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Logging","href":"/docs/the-basics/logging","docId":"the-basics/logging","unlisted":false},{"type":"link","label":"Helpers","href":"/docs/the-basics/helpers","docId":"the-basics/helpers","unlisted":false},{"type":"link","label":"Compilation","href":"/docs/the-basics/compilation","docId":"the-basics/compilation","unlisted":false},{"type":"link","label":"Deployment","href":"/docs/the-basics/deployment","docId":"the-basics/deployment","unlisted":false}]},{"type":"category","label":"Digging Deeper","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"REPL","href":"/docs/digging-deeper/repl","docId":"digging-deeper/repl","unlisted":false},{"type":"link","label":"Graceful Shutdown","href":"/docs/digging-deeper/graceful-shutdown","docId":"digging-deeper/graceful-shutdown","unlisted":false},{"type":"link","label":"Collections","href":"/docs/digging-deeper/collections","docId":"digging-deeper/collections","unlisted":false},{"type":"link","label":"Mail","href":"/docs/digging-deeper/mail","docId":"digging-deeper/mail","unlisted":false},{"type":"link","label":"Library Development","href":"/docs/digging-deeper/library-development","docId":"digging-deeper/library-development","unlisted":false}]},{"type":"category","label":"REST API Application","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Routing","href":"/docs/rest-api-application/routing","docId":"rest-api-application/routing","unlisted":false},{"type":"link","label":"Middlewares","href":"/docs/rest-api-application/middlewares","docId":"rest-api-application/middlewares","unlisted":false},{"type":"link","label":"Controllers","href":"/docs/rest-api-application/controllers","docId":"rest-api-application/controllers","unlisted":false},{"type":"link","label":"Request Context","href":"/docs/rest-api-application/request-context","docId":"rest-api-application/request-context","unlisted":false},{"type":"link","label":"Error Handling","href":"/docs/rest-api-application/error-handling","docId":"rest-api-application/error-handling","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/rest-api-application/annotations","docId":"rest-api-application/annotations","unlisted":false},{"type":"link","label":"Rate Limiting","href":"/docs/rest-api-application/rate-limiting","docId":"rest-api-application/rate-limiting","unlisted":false},{"type":"link","label":"Tracing Requests","href":"/docs/rest-api-application/tracing-requests","docId":"rest-api-application/tracing-requests","unlisted":false},{"type":"link","label":"Security with Helmet","href":"/docs/rest-api-application/security-with-helmet","docId":"rest-api-application/security-with-helmet","unlisted":false},{"type":"link","label":"Swagger Documentation","href":"/docs/rest-api-application/swagger-documentation","docId":"rest-api-application/swagger-documentation","unlisted":false},{"type":"link","label":"Views","href":"/docs/rest-api-application/views","docId":"rest-api-application/views","unlisted":false},{"type":"link","label":"Static Files","href":"/docs/rest-api-application/static-files","docId":"rest-api-application/static-files","unlisted":false}]},{"type":"category","label":"CLI Application","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Commands","href":"/docs/cli-application/commands","docId":"cli-application/commands","unlisted":false},{"type":"link","label":"Running","href":"/docs/cli-application/running","docId":"cli-application/running","unlisted":false},{"type":"link","label":"Publishing","href":"/docs/cli-application/publishing","docId":"cli-application/publishing","unlisted":false},{"type":"link","label":"Error Handling","href":"/docs/cli-application/error-handling","docId":"cli-application/error-handling","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/cli-application/annotations","docId":"cli-application/annotations","unlisted":false}]},{"type":"category","label":"CRON Application","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Schedulers","href":"/docs/cron-application/schedulers","docId":"cron-application/schedulers","unlisted":false},{"type":"link","label":"CRON Context","href":"/docs/cron-application/cron-context","docId":"cron-application/cron-context","unlisted":false},{"type":"link","label":"Error Handling","href":"/docs/cron-application/error-handling","docId":"cron-application/error-handling","unlisted":false},{"type":"link","label":"Tracing Executions","href":"/docs/cron-application/tracing-executions","docId":"cron-application/tracing-executions","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/cron-application/annotations","docId":"cron-application/annotations","unlisted":false}]},{"type":"category","label":"Database","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Getting Started","href":"/docs/database/getting-started","docId":"database/getting-started","unlisted":false},{"type":"link","label":"Query Builder","href":"/docs/database/query-builder","docId":"database/query-builder","unlisted":false},{"type":"link","label":"Migrations","href":"/docs/database/migrations","docId":"database/migrations","unlisted":false},{"type":"link","label":"Seeding","href":"/docs/database/seeding","docId":"database/seeding","unlisted":false}]},{"type":"category","label":"ORM","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Getting Started","href":"/docs/orm/getting-started","docId":"orm/getting-started","unlisted":false},{"type":"link","label":"Query Builder","href":"/docs/orm/query-builder","docId":"orm/query-builder","unlisted":false},{"type":"link","label":"Relationships","href":"/docs/orm/relationships","docId":"orm/relationships","unlisted":false},{"type":"link","label":"Extending Models","href":"/docs/orm/extending-models","docId":"orm/extending-models","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/orm/annotations","docId":"orm/annotations","unlisted":false},{"type":"link","label":"Factories","href":"/docs/orm/factories","docId":"orm/factories","unlisted":false}]},{"type":"category","label":"Testing","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Getting Started","href":"/docs/testing/getting-started","docId":"testing/getting-started","unlisted":false},{"type":"link","label":"Annotations","href":"/docs/testing/annotations","docId":"testing/annotations","unlisted":false},{"type":"link","label":"REST API Testing","href":"/docs/testing/rest-api-testing","docId":"testing/rest-api-testing","unlisted":false},{"type":"link","label":"CLI Testing","href":"/docs/testing/cli-tests","docId":"testing/cli-tests","unlisted":false},{"type":"link","label":"Mocking","href":"/docs/testing/mocking","docId":"testing/mocking","unlisted":false}]}]},"docs":{"architecture-concepts/application-lifecycle":{"id":"architecture-concepts/application-lifecycle","title":"Application Lifecycle","description":"Understand each one of the Athenna applications lifecycles.","sidebar":"tutorialSidebar"},"architecture-concepts/facades":{"id":"architecture-concepts/facades","title":"Facades","description":"Understand the purpose and how to use the Athenna facades.","sidebar":"tutorialSidebar"},"architecture-concepts/service-container":{"id":"architecture-concepts/service-container","title":"Service Container","description":"Understand the purpose and how to use the Athenna service container.","sidebar":"tutorialSidebar"},"architecture-concepts/service-providers":{"id":"architecture-concepts/service-providers","title":"Service Providers","description":"Understand the purpose and how to use the Athenna service providers.","sidebar":"tutorialSidebar"},"cli-application/annotations":{"id":"cli-application/annotations","title":"Annotations","description":"Check all available Artisan annotations and it options.","sidebar":"tutorialSidebar"},"cli-application/commands":{"id":"cli-application/commands","title":"Commands","description":"See how to create and configure your CLI commands.","sidebar":"tutorialSidebar"},"cli-application/error-handling":{"id":"cli-application/error-handling","title":"Error Handling","description":"Understand how you can handle the errors of the CLI Application.","sidebar":"tutorialSidebar"},"cli-application/publishing":{"id":"cli-application/publishing","title":"Publishing","description":"Check how you can publish a global CLI application.","sidebar":"tutorialSidebar"},"cli-application/running":{"id":"cli-application/running","title":"Running","description":"Check how to run your CLI commands in different scenarios.","sidebar":"tutorialSidebar"},"cron-application/annotations":{"id":"cron-application/annotations","title":"Annotations","description":"Check all available CRON annotations and it options.","sidebar":"tutorialSidebar"},"cron-application/cron-context":{"id":"cron-application/cron-context","title":"CRON Context","description":"Understand the purpose of the CRON context object.","sidebar":"tutorialSidebar"},"cron-application/error-handling":{"id":"cron-application/error-handling","title":"Error Handling","description":"Understand how you can handle the errors of the CRON Application.","sidebar":"tutorialSidebar"},"cron-application/schedulers":{"id":"cron-application/schedulers","title":"Schedulers","description":"See how to create and configure your CRON job schedulers.","sidebar":"tutorialSidebar"},"cron-application/tracing-executions":{"id":"cron-application/tracing-executions","title":"Tracing Executions","description":"Understand how to trace executions of your CRON application.","sidebar":"tutorialSidebar"},"database/getting-started":{"id":"database/getting-started","title":"Getting Started","description":"See how to create database connections in Athenna Framework.","sidebar":"tutorialSidebar"},"database/migrations":{"id":"database/migrations","title":"Migrations","description":"See how to create and run database migrations in Athenna Framework.","sidebar":"tutorialSidebar"},"database/query-builder":{"id":"database/query-builder","title":"Query Builder","description":"See how to use the Athenna database query builder.","sidebar":"tutorialSidebar"},"database/seeding":{"id":"database/seeding","title":"Seeding","description":"See how to create and run database seeders.","sidebar":"tutorialSidebar"},"digging-deeper/collections":{"id":"digging-deeper/collections","title":"Collections","description":"Understand the Collections API of the Athenna Framework.","sidebar":"tutorialSidebar"},"digging-deeper/graceful-shutdown":{"id":"digging-deeper/graceful-shutdown","title":"Graceful Shutdown","description":"See how to graceful shutdown any kind of Athenna application.","sidebar":"tutorialSidebar"},"digging-deeper/library-development":{"id":"digging-deeper/library-development","title":"Library Development","description":"See how you can create your own library and integrate with Athenna.","sidebar":"tutorialSidebar"},"digging-deeper/mail":{"id":"digging-deeper/mail","title":"Mail","description":"See how to send emails in Athenna.","sidebar":"tutorialSidebar"},"digging-deeper/repl":{"id":"digging-deeper/repl","title":"REPL","description":"See how to create a REPL session with Athenna Framework ecosystem.","sidebar":"tutorialSidebar"},"getting-started/athennarc-file":{"id":"getting-started/athennarc-file","title":"Athenna RC File","description":"Understand what is the purpose of the .athennarc.json file.","sidebar":"tutorialSidebar"},"getting-started/configuration":{"id":"getting-started/configuration","title":"Configuration","description":"Understand the initial configurations of your project.","sidebar":"tutorialSidebar"},"getting-started/directory-structure":{"id":"getting-started/directory-structure","title":"Directory Structure","description":"Understand the directory structure of your project.","sidebar":"tutorialSidebar"},"getting-started/installation":{"id":"getting-started/installation","title":"Installation","description":"How to install and set up your first Athenna project.","sidebar":"tutorialSidebar"},"orm/annotations":{"id":"orm/annotations","title":"Annotations","description":"Check all available ORM annotations and it options.","sidebar":"tutorialSidebar"},"orm/extending-models":{"id":"orm/extending-models","title":"Extending Models","description":"See how to extend models implementations in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/factories":{"id":"orm/factories","title":"Factories","description":"See how to factory fake models in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/getting-started":{"id":"orm/getting-started","title":"Getting Started","description":"See how to create models in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/query-builder":{"id":"orm/query-builder","title":"Query Builder","description":"See how to retrieve, insert, update and delete models using the query builder in Athenna Framework.","sidebar":"tutorialSidebar"},"orm/relationships":{"id":"orm/relationships","title":"Relationships","description":"See how to create relations between models in Athenna Framework.","sidebar":"tutorialSidebar"},"rest-api-application/annotations":{"id":"rest-api-application/annotations","title":"Annotations","description":"Check all available REST API annotations and it options.","sidebar":"tutorialSidebar"},"rest-api-application/controllers":{"id":"rest-api-application/controllers","title":"Controllers","description":"Understand how you can set up controllers in your REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/error-handling":{"id":"rest-api-application/error-handling","title":"Error Handling","description":"Understand how you can handle the errors of the REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/middlewares":{"id":"rest-api-application/middlewares","title":"Middlewares","description":"Understand how you can set up middlewares in your REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/rate-limiting":{"id":"rest-api-application/rate-limiting","title":"Rate Limiting","description":"See how to create rate limiting rules for Athenna REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/request-context":{"id":"rest-api-application/request-context","title":"Request Context","description":"Understand the purpose of the request context object.","sidebar":"tutorialSidebar"},"rest-api-application/routing":{"id":"rest-api-application/routing","title":"Routing","description":"Understand how you can set up routes for your REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/security-with-helmet":{"id":"rest-api-application/security-with-helmet","title":"Security with Helmet","description":"See how to improve the security of your REST API with Helmet in Athenna.","sidebar":"tutorialSidebar"},"rest-api-application/static-files":{"id":"rest-api-application/static-files","title":"Static Files","description":"See how to serve static files in Athenna REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/swagger-documentation":{"id":"rest-api-application/swagger-documentation","title":"Swagger Documentation","description":"See how to create the Swagger documentation for Athenna REST API application.","sidebar":"tutorialSidebar"},"rest-api-application/tracing-requests":{"id":"rest-api-application/tracing-requests","title":"Tracing Requests","description":"Understand how to trace requests in your REST API application of Athenna.","sidebar":"tutorialSidebar"},"rest-api-application/views":{"id":"rest-api-application/views","title":"Views","description":"Understand how you can use the Athenna view API for rendering HTML pages.","sidebar":"tutorialSidebar"},"testing/annotations":{"id":"testing/annotations","title":"Annotations","description":"Check all available testing annotations and it options.","sidebar":"tutorialSidebar"},"testing/cli-tests":{"id":"testing/cli-tests","title":"CLI Testing","description":"See how to create tests for CLI applications in Athenna.","sidebar":"tutorialSidebar"},"testing/getting-started":{"id":"testing/getting-started","title":"Getting Started","description":"See how to create tests in an Athenna application.","sidebar":"tutorialSidebar"},"testing/mocking":{"id":"testing/mocking","title":"Mocking","description":"Understand how to mock dependencies and functions in Athenna.","sidebar":"tutorialSidebar"},"testing/rest-api-testing":{"id":"testing/rest-api-testing","title":"REST API Testing","description":"See how to create tests for REST APIs applications in Athenna.","sidebar":"tutorialSidebar"},"the-basics/compilation":{"id":"the-basics/compilation","title":"Compilation","description":"Understand the TypeScript compilation process of Athenna.","sidebar":"tutorialSidebar"},"the-basics/deployment":{"id":"the-basics/deployment","title":"Deployment","description":"See how to deploy any kind of Athenna application.","sidebar":"tutorialSidebar"},"the-basics/helpers":{"id":"the-basics/helpers","title":"Helpers","description":"Understand how to use all the Athenna Helpers from @athenna/common and other packages.","sidebar":"tutorialSidebar"},"the-basics/logging":{"id":"the-basics/logging","title":"Logging","description":"Understand how you can use the Athenna logging API.","sidebar":"tutorialSidebar"}}}}')}}]); \ No newline at end of file diff --git a/assets/js/30d27832.8b98abf6.js b/assets/js/30d27832.8b98abf6.js new file mode 100644 index 00000000..233cfba0 --- /dev/null +++ b/assets/js/30d27832.8b98abf6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[4890],{9604:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>d});var i=t(4848),o=t(8453),s=t(7049);const r={title:"Configuration",sidebar_position:4,description:"Understand the initial configurations of your project."},a="Configuration",c={id:"getting-started/configuration",title:"Configuration",description:"Understand the initial configurations of your project.",source:"@site/docs/getting-started/configuration.mdx",sourceDirName:"getting-started",slug:"/getting-started/configuration",permalink:"/docs/getting-started/configuration",draft:!1,unlisted:!1,editUrl:"https://github.com/AthennaIO/Docs/tree/main/docs/getting-started/configuration.mdx",tags:[],version:"current",sidebarPosition:4,frontMatter:{title:"Configuration",sidebar_position:4,description:"Understand the initial configurations of your project."},sidebar:"tutorialSidebar",previous:{title:"Athenna RC File",permalink:"/docs/getting-started/athennarc-file"},next:{title:"Directory Structure",permalink:"/docs/getting-started/directory-structure"}},l={},d=[{value:"Environment configuration",id:"environment-configuration",level:2},{value:"Determining the current environment",id:"determining-the-current-environment",level:3},{value:"Get an environment variable value",id:"get-an-environment-variable-value",level:3},{value:"Custom environment file path",id:"custom-environment-file-path",level:2},{value:"Configuration files",id:"configuration-files",level:2},{value:"Manipulating configuration values",id:"manipulating-configuration-values",level:3},{value:"Config.get()
",id:"configget",level:4},{value:"Config.set()
",id:"configset",level:4},{value:"Config.safeSet()
",id:"configsafeset",level:4},{value:"Config.delete()
",id:"configdelete",level:4},{value:"Config.rewrite()
",id:"configrewrite",level:4},{value:"Config.is()
",id:"configis",level:4},{value:"Config.existsAll()
",id:"configexistsall",level:4},{value:"Config.clear()
",id:"configclear",level:4},{value:"Config.load()
",id:"configload",level:4},{value:"Config.safeLoad()
",id:"configsafeload",level:4},{value:"Config.loadAll()
",id:"configloadall",level:4},{value:"Get configuration with @Value()
decorator",id:"get-configuration-with-value-decorator",level:3},{value:"Define my own configuration path",id:"define-my-own-configuration-path",level:3},{value:"Safe loading configuration files",id:"safe-loading-configuration-files",level:2},{value:"Debug mode",id:"debug-mode",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"configuration",children:"Configuration"})}),"\n",(0,i.jsx)(n.p,{children:"Understand the initial configurations of your project."}),"\n",(0,i.jsx)(n.h2,{id:"environment-configuration",children:"Environment configuration"}),"\n",(0,i.jsx)(n.p,{children:"It is often helpful to have different configuration values\nbased on the environment where the application is running.\nFor example, you may wish to use a different storage driver\nlocally than you do on your production server."}),"\n",(0,i.jsxs)(n.p,{children:["To make this a cinch, Athenna utilizes the ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/dotenv",children:"dotenv"}),"\nNode.js library. In a fresh Athenna installation, the root\ndirectory of your application will contain a ",(0,i.jsx)(n.code,{children:".env.example"})," file\nthat defines many common environment variables. During the\nAthenna installation process, this file will automatically\nbe copied to ",(0,i.jsx)(n.code,{children:".env"})," and ",(0,i.jsx)(n.code,{children:".env.test"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Athenna default ",(0,i.jsx)(n.code,{children:".env"})," file contains some common configuration\nvalues that may differ based on whether your application is\nrunning locally or on a production. These values are then\nretrieved from various Athenna configuration files within the\n",(0,i.jsx)(n.code,{children:"config"})," directory using Athenna ",(0,i.jsx)(n.code,{children:"Env()"})," function."]}),"\n",(0,i.jsxs)(n.p,{children:["If you are developing with a team, you may wish to continue\nincluding a ",(0,i.jsx)(n.code,{children:".env.example"})," file with your application. By\nputting placeholder values in the example configuration file,\nother developers on your team can clearly see which environment\nvariables are needed to run your application."]}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["Any variable in your ",(0,i.jsx)(n.code,{children:".env"})," file can be overridden by\nexternal environment variables such as server-level or\nsystem-level environment variables. But off course you\ncan turn off this behavior setting the ",(0,i.jsx)(n.code,{children:"OVERRIDE_ENV=true"}),"\nvariable before running your application, if this variable\nis set to true, all environment variables set in ",(0,i.jsx)(n.code,{children:".env"}),"\nwill override the externals."]})}),"\n",(0,i.jsx)(n.admonition,{type:"caution",children:(0,i.jsxs)(n.p,{children:["Your ",(0,i.jsx)(n.code,{children:".env"})," file should not be committed to your application\nsource control, since each developer/server using your\napplication could require a different environment configuration.\nFurthermore, this would be a security risk in the event an\nintruder gains access to your source control repository,\nsince any sensitive credentials would get exposed."]})}),"\n",(0,i.jsx)(n.h3,{id:"determining-the-current-environment",children:"Determining the current environment"}),"\n",(0,i.jsxs)(n.p,{children:["Before loading your application's environment variables,\nAthenna determines if either the ",(0,i.jsx)(n.code,{children:"--env"})," Artisan flag has\nbeen specified or if the ",(0,i.jsx)(n.code,{children:"APP_ENV"})," environment variable has\nbeen externally provided."]}),"\n",(0,i.jsxs)(n.p,{children:["If so, Athenna will attempt to load the ",(0,i.jsx)(n.code,{children:".env.${env}"})," or\n",(0,i.jsx)(n.code,{children:".env.${APP_ENV}"})," file if it exists. If the file cannot be\nfound, Athenna will try to find the ",(0,i.jsx)(n.code,{children:"APP_ENV"})," variable inside\nthe ",(0,i.jsx)(n.code,{children:".env"})," file and again try to find the ",(0,i.jsx)(n.code,{children:".env.${APP_ENV}"}),"\nfile to load. Finally, if the ",(0,i.jsx)(n.code,{children:"APP_ENV"})," is not present in ",(0,i.jsx)(n.code,{children:".env"})," file,\nAthenna will end up loading the ",(0,i.jsx)(n.code,{children:".env"})," file by default."]}),"\n",(0,i.jsxs)(n.p,{children:["Running providing ",(0,i.jsx)(n.code,{children:"--env"})," flag in Artisan:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"node artisan serve --env=local\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Running providing ",(0,i.jsx)(n.code,{children:"APP_ENV"})," externally:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"APP_ENV=local node artisan serve\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Let's check some practical examples. This is the default\n",(0,i.jsx)(n.code,{children:".env"})," file that comes in Athenna project:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-dotenv",children:"HOST=localhost\nPORT=3000\n\nAPP_NAME=Athenna\nAPP_ENV=local\nAPP_DEBUG=true\nAPP_URL=http://${HOST}:${PORT}\nAPP_DOMAIN=${HOST}\nAPP_DOCUMENTATION=${APP_URL}\nAPP_SOURCE=https://github.com/AthennaIO\n\nLOG_HTTP=true\nLOG_CHANNEL=application\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In the ",(0,i.jsx)(n.code,{children:".env"})," file above, you can see that we have the\n",(0,i.jsx)(n.code,{children:"APP_ENV=local"}),". This means that if you create a new\n",(0,i.jsx)(n.code,{children:".env.local"})," file in your project root path, Athenna\nwill load it instead of ",(0,i.jsx)(n.code,{children:".env"})," if running your application\nwithout a predefined environment."]}),"\n",(0,i.jsx)(n.h3,{id:"get-an-environment-variable-value",children:"Get an environment variable value"}),"\n",(0,i.jsxs)(n.p,{children:["You can get environment variables using the ",(0,i.jsx)(n.code,{children:"Env()"})," function:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Env } from '@athenna/config'\n\nconst defaultValue = 'Athenna'\n\nconst appName = Env('APP_NAME', defaultValue)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["All environment variables in your .env file and inside\n",(0,i.jsx)(n.code,{children:"process.env"})," object are always interpreted as strings.\nBut when using the ",(0,i.jsx)(n.code,{children:"Env()"})," function, it will auto cast the\nvalue for you. Check the comparison:"]}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{style:{textAlign:"left"},children:"Value in .env"}),(0,i.jsx)(n.th,{style:{textAlign:"right"},children:"Value returned by Env function"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:["true ",(0,i.jsx)(n.strong,{children:"(boolean)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["true ",(0,i.jsx)(n.strong,{children:"(boolean)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"true" ',(0,i.jsx)(n.strong,{children:"(string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["true ",(0,i.jsx)(n.strong,{children:"(boolean)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:["10 ",(0,i.jsx)(n.strong,{children:"(number)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10 ",(0,i.jsx)(n.strong,{children:"(number)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"10" ',(0,i.jsx)(n.strong,{children:"(string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10 ",(0,i.jsx)(n.strong,{children:"(number)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:["10.090909 ",(0,i.jsx)(n.strong,{children:"(float)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10.090909 ",(0,i.jsx)(n.strong,{children:"(float)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"10.090909" ',(0,i.jsx)(n.strong,{children:"(string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10.090909 ",(0,i.jsx)(n.strong,{children:"(float)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['{"name":"Paulo"} ',(0,i.jsx)(n.strong,{children:"(json)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:['{ name: "Paulo" } ',(0,i.jsx)(n.strong,{children:"(Object)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"{"name":"Paulo"}" ',(0,i.jsx)(n.strong,{children:"(json string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:['{ name: "Paulo" } ',(0,i.jsx)(n.strong,{children:"(Object)"})]})]})]})]}),"\n",(0,i.jsx)(n.p,{children:"Let's see a more practical example of it:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"process.env.PORT = '3000'\nprocess.env.APP_DEBUG = 'true'\nprocess.env.APP_JSON = '{\"name\":\"Paulo\"}'\n\nconsole.log(Env('PORT')) // 3000 <- number\nconsole.log(Env('APP_DEBUG')) // true <- boolean\nconsole.log(Env('APP_JSON')) // { name: \"Paulo\" } <- object\n"})}),"\n",(0,i.jsxs)(n.p,{children:["There will certainly have scenarios in your business rule\nwhere you explicitly need an environment variable with value\n",(0,i.jsx)(n.code,{children:"true"}),", ",(0,i.jsx)(n.code,{children:"10"})," or ",(0,i.jsx)(n.code,{children:'{"name":"Paulo"}'})," to be a string. To solve\nthis, you can turn off the auto cast when using the ",(0,i.jsx)(n.code,{children:"Env()"}),"\nfunction:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"process.env.PORT = '3000'\nprocess.env.APP_DEBUG = 'true'\nprocess.env.APP_JSON = '{\"name\":\"Paulo\"}'\n\nconst autoCast = false\nconst defaultValue = undefined\n\nconsole.log(Env('PORT', defaultValue, autoCast)) // 3000 <- string\nconsole.log(Env('APP_DEBUG', defaultValue, autoCast)) // true <- string\nconsole.log(Env('APP_JSON', defaultValue, autoCast)) // {\"name\":\"Paulo\"} <- string\n"})}),"\n",(0,i.jsx)(n.p,{children:"Environment variables can parse other environment variables\ntoo. See the example above:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-dotenv",children:"HOST=localhost\nPORT=3000\n\nAPP_URL=http://${HOST}:${PORT}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"console.log(Env('APP_URL')) // \"http://localhost:3000\"\n"})}),"\n",(0,i.jsx)(n.h2,{id:"custom-environment-file-path",children:"Custom environment file path"}),"\n",(0,i.jsxs)(n.p,{children:["You can also change the name and the path of your ",(0,i.jsx)(n.code,{children:".env"})," file.\nTo do that you need to set the new path to ",(0,i.jsx)(n.code,{children:"Ignite::load()"})," static method:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",metastring:"title=\"Path.bin('dev.ts')\"",children:"import { Ignite } from '@athenna/core'\n\nconst ignite = await new Ignite().load(import.meta.url, {\n envPath: './bootstrap/.env.dev' \ud83d\udc48\n})\n\nawait ignite.httpServer()\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsx)(n.p,{children:"Always remember that when using relative paths to set something\nin Athenna, you need to use your project root path as reference,\njust like in the example above."})}),"\n",(0,i.jsx)(n.h2,{id:"configuration-files",children:"Configuration files"}),"\n",(0,i.jsxs)(n.p,{children:["All the configuration files for the Athenna framework are\nstored in the ",(0,i.jsx)(n.code,{children:"src/config"})," directory. Each option is documented, so\nfeel free to look through the files and get familiar with\nthe options available to you."]}),"\n",(0,i.jsx)(n.p,{children:"Athenna needs almost no additional configuration out of\nthe box. You are free to get started developing! Each\noption is documented, so feel free to look through the\nfiles and get familiar with the options available to you.\nIt contains several options such as locale that you may\nwish to change, according to your application."}),"\n",(0,i.jsx)(n.h3,{id:"manipulating-configuration-values",children:"Manipulating configuration values"}),"\n",(0,i.jsxs)(n.p,{children:["You may easily access your configuration values using the\nglobal ",(0,i.jsx)(n.code,{children:"Config"})," helper class. The configuration values may\nbe accessed using ",(0,i.jsx)(n.code,{children:'"dot (.)"'})," syntax, which includes the\nname of the file and option you wish to access. Let's cover\nsome methods bellow:"]}),"\n",(0,i.jsx)(n.h4,{id:"configget",children:(0,i.jsx)(n.code,{children:"Config.get()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"get()"})," method will return the value of your configuration.\nYou can also set a default value as second parameter that will\nbe returned if the configuration option does not exist:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nconst defaultValue = 'Athenna'\nconst name = Config.get('app.name', defaultValue)\n\nconsole.log(name) // MyAppName\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["You can get all the configuration values using ",(0,i.jsx)(n.code,{children:"get()"})," method\nwithout any key:"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"console.log(Config.get()) // { app: {...}, http: {...}, ... }\n"})})]}),"\n",(0,i.jsx)(n.h4,{id:"configset",children:(0,i.jsx)(n.code,{children:"Config.set()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"set()"})," method is very useful to set or change the value\nof some configuration in runtime:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.set('app.name', 'Athenna Framework')\n\nconsole.log(Config.get('app.name')) // Athenna Framework\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"Config.set()"})," method does not change the values in\nthe configuration file, only in runtime. To do that, you\nwill need to use the ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/getting-started/configuration#configrewrite",children:"Config.rewrite()"}),"\nmethod."]})}),"\n",(0,i.jsx)(n.h4,{id:"configsafeset",children:(0,i.jsx)(n.code,{children:"Config.safeSet()"})}),"\n",(0,i.jsxs)(n.p,{children:["If you are not sure if some configuration value is already\nset of not, you can use the ",(0,i.jsx)(n.code,{children:"safeSet()"})," method instead to\nnot overwrite something that was already defined:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nconsole.log(Config.get('app.name')) // MyAppName\n\nConfig.safeSet('app.name', 'Athenna Framework')\n\nconsole.log(Config.get('app.name')) // MyAppName\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configdelete",children:(0,i.jsx)(n.code,{children:"Config.delete()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"delete()"})," method could be used to delete some configuration\nvalue:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.delete('app.name')\n\nconsole.log(Config.get('app.name')) // undefined\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Just like ",(0,i.jsx)(n.code,{children:"Config.set()"})," method, ",(0,i.jsx)(n.code,{children:"Config.delete()"})," does\nnot change the values in the configuration file, only\nin runtime. To do that you will need to use the\n",(0,i.jsx)(n.code,{children:"Config.rewrite()"})," method."]})}),"\n",(0,i.jsx)(n.h4,{id:"configrewrite",children:(0,i.jsx)(n.code,{children:"Config.rewrite()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"rewrite()"})," method is very useful for rewriting the\nconfiguration file. Very useful when you want to\nprogrammatically modify the configuration file source code.\nThis method uses the ",(0,i.jsx)(n.a,{href:"https://github.com/unjs/magicast",children:"magicast"}),"\nlibrary under the hood to do that:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.set('app.name', 'Athenna Framework')\n\nawait Config.rewrite('app')\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"warning",children:[(0,i.jsxs)(n.p,{children:["Let's suppose that you want to set a function as a value,\nyou can use builders.functionCall function of ",(0,i.jsx)(n.a,{href:"https://github.com/unjs/magicast",children:"magicast"}),"\nlibrary to do that:"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { builders } from 'magicast'\nimport { Config } from '@athenna/config'\n\nConfig.set('app.name', builders.functionCall('Env', ['MY_APP_NAME']))\n\nawait Config.rewrite('app')\n"})}),(0,i.jsxs)(n.p,{children:["The example above will produce the following code in ",(0,i.jsx)(s.A,{father:"config",child:"app.ts"}),":"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"export default {\n name: Env('MY_APP_NAME')\n ...\n}\n"})})]}),"\n",(0,i.jsx)(n.h4,{id:"configis",children:(0,i.jsx)(n.code,{children:"Config.is()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"is()"})," method could be used to validate if your\nconfiguration value matches some other value:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nif (Config.is('app.name', 'Athenna')) {\n // do something\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["You can set an array as second parameter to ",(0,i.jsx)(n.code,{children:"is()"})," method.\nIf any value in the array matches the configuration value,\nthe method will return true:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nif (Config.is('app.name', ['Athenna', 'MyAppName'])) {\n // do something\n}\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["You can use the ",(0,i.jsx)(n.code,{children:"isNot()"})," method to do the negated validation."]})}),"\n",(0,i.jsx)(n.h4,{id:"configexistsall",children:(0,i.jsx)(n.code,{children:"Config.existsAll()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"existsAll()"})," method could be used to validate if an\narray of configuration keys exists or not:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nif (Config.existsAll(['app.name', 'app.version'])) {\n // do something\n}\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["You can use the ",(0,i.jsx)(n.code,{children:"notExistsAll()"})," method to do the negate\nvalidation."]})}),"\n",(0,i.jsx)(n.h4,{id:"configclear",children:(0,i.jsx)(n.code,{children:"Config.clear()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"clear()"})," method could be used to clear all the configuration\nvalues:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.clear()\n\nconsole.log(Config.get()) // {}\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configload",children:(0,i.jsx)(n.code,{children:"Config.load()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"load()"})," method could be used to load some configuration\nfile path:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\nimport { Config } from '@athenna/config'\n\nconst testConfig = Path.stubs('config/test.ts') // /path/to/your/project/tests/stubs/config/test.ts\nawait Config.load(testConfig)\n\nconsole.log(Config.get('test')) // { ... }\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configsafeload",children:(0,i.jsx)(n.code,{children:"Config.safeLoad()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"safeLoad()"})," method will only load the file path if it\nis not defined:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\nimport { Config } from '@athenna/config'\n\nconst appConfig = Path.stubs('config/app.js') // /path/to/your/project/tests/stubs/config/app.js\nawait Config.safeLoad(appConfig)\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configloadall",children:(0,i.jsx)(n.code,{children:"Config.loadAll()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"loadAll"})," method will load all files found inside some\nconfiguration path:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\nimport { Config } from '@athenna/config'\n\nconst config = Path.stubs('config') // /path/to/your/project/tests/stubs/config\nawait Config.loadAll(config)\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"get-configuration-with-value-decorator",children:["Get configuration with ",(0,i.jsx)(n.code,{children:"@Value()"})," decorator"]}),"\n",(0,i.jsxs)(n.p,{children:["Instead of using the ",(0,i.jsx)(n.code,{children:"Config.get()"})," method to get a configuration\nvalue, you can use the ",(0,i.jsx)(n.code,{children:"@Value()"})," annotation in your classes to\nautomatically add it value to a class property:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Value } from '@athenna/config'\n\nexport class UserService {\n @Value('api.users') \ud83d\udc48\n public api: string\n}\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["Just like ",(0,i.jsx)(n.code,{children:"Config.get()"})," method, you can set a default value\nwhen using the ",(0,i.jsx)(n.code,{children:"@Value()"})," annotation:"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"@Value('api.users', 'http://localhost:3000/users') \ud83d\udc48\n"})})]}),"\n",(0,i.jsx)(n.h3,{id:"define-my-own-configuration-path",children:"Define my own configuration path"}),"\n",(0,i.jsxs)(n.p,{children:["If you are building your own project structure you might want to\nchange the configurations directory from ",(0,i.jsx)(n.code,{children:"src/config"})," to something\nelse. For this case you can specify to Athenna a different path to\nwhat ",(0,i.jsx)(s.A,{fatherPath:"config"})," will resolve."]}),"\n",(0,i.jsxs)(n.p,{children:["To specify your application directories to Athenna, you can\nopen the ",(0,i.jsx)(n.code,{children:".athennarc.json"})," file and add the ",(0,i.jsx)(n.code,{children:"directories"}),"\nproperty to it. The ",(0,i.jsx)(n.code,{children:"directories"})," property is an object that maps the directory\nbase path that the ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,i.jsx)(n.code,{children:"Path"})}),"\nhelper will use to resolve your application paths:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\n\nconsole.log(Path.config()) // /path/to/your/project/src/config\n"})}),"\n",(0,i.jsxs)(n.p,{children:["All the ",(0,i.jsx)(n.code,{children:"directories"})," key names follow the ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,i.jsx)(n.code,{children:"Path"})}),"\nclass methods names. This means that if you want to change\nwhat is returned by the ",(0,i.jsx)(s.A,{fatherPath:"config"})," method, you will\nneed to add the ",(0,i.jsx)(n.code,{children:"config"})," key to the ",(0,i.jsx)(n.code,{children:"directories"})," object:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "directories": {\n "config": "src/app/config"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Now when calling the ",(0,i.jsx)(s.A,{father:"config"})," method, it will return\na different path:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\n\nconsole.log(Path.config()) // /path/to/your/project/src/app/config \ud83d\udc48\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Athenna always rely on ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,i.jsx)(n.code,{children:"Path"})}),"\nclass methods to find files and directories that are used\ninternally by the framework, like configuration file, route\nfiles, entry points and many others."]}),"\n",(0,i.jsxs)(n.p,{children:["Check ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/getting-started/athennarc-file#the-directories-property",children:"the directories property documentation section"}),"\nfor more information about the ",(0,i.jsx)(n.code,{children:"directories"})," property. And\ncheck ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/getting-started/directory-structure#do-your-own-structure",children:"the do your own structure documentation section"}),"\nfor more information about how to create your own project\nstructure."]}),"\n",(0,i.jsx)(n.h2,{id:"safe-loading-configuration-files",children:"Safe loading configuration files"}),"\n",(0,i.jsxs)(n.p,{children:["Athenna got multiple types of applications, while using the framework\nyou will notice that some times you could end up igniting your application\ntwice. Let's suppose you are using ",(0,i.jsx)(n.code,{children:"node artisan serve"})," command to start\nyour application, this command will first ignite your application by Artisan\nand them by the HTTP server."]}),"\n",(0,i.jsxs)(n.p,{children:["This is usually not a problem at all, but depending on how you have created\nyour environment it could become one. To avoid reloading configuration\nfiles in these situations, you can set the ",(0,i.jsx)(n.code,{children:"loadConfigSafe"})," option as ",(0,i.jsx)(n.code,{children:"true"}),"\nin ",(0,i.jsx)(n.code,{children:"Ignite::load()"})," static method:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",metastring:"title=\"Path.bin('main.ts')\"",children:"import { Ignite } from '@athenna/core'\n\nconst ignite = await new Ignite().load(import.meta.url, {\n loadConfigSafe: true, \ud83d\udc48\n})\n\nawait ignite.httpServer()\n"})}),"\n",(0,i.jsx)(n.h2,{id:"debug-mode",children:"Debug mode"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"debug"})," option in your ",(0,i.jsx)(s.A,{path:"config",child:"app.ts"})," configuration\nfile determines how much information about your application\nis actually displayed to you and for who is going to consume\nyour application. By default, this option is set to respect\nthe value of the ",(0,i.jsx)(n.code,{children:"APP_DEBUG"})," environment variable, which is\nstored in your ",(0,i.jsx)(n.code,{children:".env"})," file."]}),"\n",(0,i.jsxs)(n.p,{children:["For local development, you should set the ",(0,i.jsx)(n.code,{children:"APP_DEBUG"}),"\nenvironment variable to ",(0,i.jsx)(n.code,{children:"true"}),". In your production environment,\nthis value should always be ",(0,i.jsx)(n.code,{children:"false"}),", if the variable is\nset to ",(0,i.jsx)(n.code,{children:"true"})," in production, you risk exposing sensitive\nconfiguration values to your application's end users."]})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}},7049:(e,n,t)=>{t.d(n,{A:()=>s});t(6540);const i={hoverCardContainer:"hoverCardContainer_jqUQ",hoverCardLink:"hoverCardLink_oDZU",hoverCard:"hoverCard_qTDS"};var o=t(4848);function s(e){let n=e.father;switch(e.father){case"storage":n="src/storage";break;case"logs":n="src/storage/logs";break;case"views":n="src/resources/views";break;case"locales":n="src/resources/locales";break;case"static":n="src/resources/static";break;case"config":n="src/config";break;case"database":n="src/database";break;case"seeders":n="src/database/seeders";break;case"migrations":n="src/database/migrations";break;case"console":n="src/console";break;case"commands":n="src/console/commands";break;case"cron":n="src/cron";break;case"schedulers":n="src/cron/schedulers";break;case"models":n="src/models";break;case"services":n="src/services";break;case"repositories":n="src/repositories";break;case"http":n="src/http";break;case"controllers":n="src/http/controllers";break;case"middlewares":n="src/http/middlewares";break;case"interceptors":n="src/http/interceptors";break;case"terminators":n="src/http/terminators";break;case"stubs":n="tests/stubs";break;case"fixtures":n="tests/fixtures";break;case"providers":n="src/providers";break;case"facades":n="src/facades";break;case"routes":n="src/routes"}return(0,o.jsxs)("div",{className:i.hoverCardContainer,children:[(0,o.jsx)("a",{className:i.hoverCardLink,href:`/docs/the-basics/helpers#path${e.father}`,children:(0,o.jsxs)("code",{children:["Path.",e.father,"(",e.child?`'${e.child}'`:"",")"]})}),(0,o.jsx)("div",{className:i.hoverCard,children:(0,o.jsxs)("p",{style:{margin:0},children:["./",n,e.child?`/${e.child}`:""]})})]})}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>a});var i=t(6540);const o={},s=i.createContext(o);function r(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/30d27832.8c09266b.js b/assets/js/30d27832.8c09266b.js
deleted file mode 100644
index 5be81c7b..00000000
--- a/assets/js/30d27832.8c09266b.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[4890],{9604:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>d});var i=t(4848),o=t(8453),s=t(7049);const r={title:"Configuration",sidebar_position:4,description:"Understand the initial configurations of your project."},a="Configuration",c={id:"getting-started/configuration",title:"Configuration",description:"Understand the initial configurations of your project.",source:"@site/docs/getting-started/configuration.mdx",sourceDirName:"getting-started",slug:"/getting-started/configuration",permalink:"/docs/getting-started/configuration",draft:!1,unlisted:!1,editUrl:"https://github.com/AthennaIO/Docs/tree/main/docs/getting-started/configuration.mdx",tags:[],version:"current",sidebarPosition:4,frontMatter:{title:"Configuration",sidebar_position:4,description:"Understand the initial configurations of your project."},sidebar:"tutorialSidebar",previous:{title:"AthennaRC File",permalink:"/docs/getting-started/athennarc-file"},next:{title:"Directory Structure",permalink:"/docs/getting-started/directory-structure"}},l={},d=[{value:"Environment configuration",id:"environment-configuration",level:2},{value:"Determining the current environment",id:"determining-the-current-environment",level:3},{value:"Get an environment variable value",id:"get-an-environment-variable-value",level:3},{value:"Custom environment file path",id:"custom-environment-file-path",level:2},{value:"Configuration files",id:"configuration-files",level:2},{value:"Manipulating configuration values",id:"manipulating-configuration-values",level:3},{value:"Config.get()
",id:"configget",level:4},{value:"Config.set()
",id:"configset",level:4},{value:"Config.safeSet()
",id:"configsafeset",level:4},{value:"Config.delete()
",id:"configdelete",level:4},{value:"Config.rewrite()
",id:"configrewrite",level:4},{value:"Config.is()
",id:"configis",level:4},{value:"Config.existsAll()
",id:"configexistsall",level:4},{value:"Config.clear()
",id:"configclear",level:4},{value:"Config.load()
",id:"configload",level:4},{value:"Config.safeLoad()
",id:"configsafeload",level:4},{value:"Config.loadAll()
",id:"configloadall",level:4},{value:"Get configuration with @Value()
decorator",id:"get-configuration-with-value-decorator",level:3},{value:"Define my own configuration path",id:"define-my-own-configuration-path",level:3},{value:"Safe loading configuration files",id:"safe-loading-configuration-files",level:2},{value:"Debug mode",id:"debug-mode",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"configuration",children:"Configuration"})}),"\n",(0,i.jsx)(n.p,{children:"Understand the initial configurations of your project."}),"\n",(0,i.jsx)(n.h2,{id:"environment-configuration",children:"Environment configuration"}),"\n",(0,i.jsx)(n.p,{children:"It is often helpful to have different configuration values\nbased on the environment where the application is running.\nFor example, you may wish to use a different storage driver\nlocally than you do on your production server."}),"\n",(0,i.jsxs)(n.p,{children:["To make this a cinch, Athenna utilizes the ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/dotenv",children:"dotenv"}),"\nNode.js library. In a fresh Athenna installation, the root\ndirectory of your application will contain a ",(0,i.jsx)(n.code,{children:".env.example"})," file\nthat defines many common environment variables. During the\nAthenna installation process, this file will automatically\nbe copied to ",(0,i.jsx)(n.code,{children:".env"})," and ",(0,i.jsx)(n.code,{children:".env.test"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Athenna default ",(0,i.jsx)(n.code,{children:".env"})," file contains some common configuration\nvalues that may differ based on whether your application is\nrunning locally or on a production. These values are then\nretrieved from various Athenna configuration files within the\n",(0,i.jsx)(n.code,{children:"config"})," directory using Athenna ",(0,i.jsx)(n.code,{children:"Env()"})," function."]}),"\n",(0,i.jsxs)(n.p,{children:["If you are developing with a team, you may wish to continue\nincluding a ",(0,i.jsx)(n.code,{children:".env.example"})," file with your application. By\nputting placeholder values in the example configuration file,\nother developers on your team can clearly see which environment\nvariables are needed to run your application."]}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["Any variable in your ",(0,i.jsx)(n.code,{children:".env"})," file can be overridden by\nexternal environment variables such as server-level or\nsystem-level environment variables. But off course you\ncan turn off this behavior setting the ",(0,i.jsx)(n.code,{children:"OVERRIDE_ENV=true"}),"\nvariable before running your application, if this variable\nis set to true, all environment variables set in ",(0,i.jsx)(n.code,{children:".env"}),"\nwill override the externals."]})}),"\n",(0,i.jsx)(n.admonition,{type:"caution",children:(0,i.jsxs)(n.p,{children:["Your ",(0,i.jsx)(n.code,{children:".env"})," file should not be committed to your application\nsource control, since each developer/server using your\napplication could require a different environment configuration.\nFurthermore, this would be a security risk in the event an\nintruder gains access to your source control repository,\nsince any sensitive credentials would get exposed."]})}),"\n",(0,i.jsx)(n.h3,{id:"determining-the-current-environment",children:"Determining the current environment"}),"\n",(0,i.jsxs)(n.p,{children:["Before loading your application's environment variables,\nAthenna determines if either the ",(0,i.jsx)(n.code,{children:"--env"})," Artisan flag has\nbeen specified or if the ",(0,i.jsx)(n.code,{children:"APP_ENV"})," environment variable has\nbeen externally provided."]}),"\n",(0,i.jsxs)(n.p,{children:["If so, Athenna will attempt to load the ",(0,i.jsx)(n.code,{children:".env.${env}"})," or\n",(0,i.jsx)(n.code,{children:".env.${APP_ENV}"})," file if it exists. If the file cannot be\nfound, Athenna will try to find the ",(0,i.jsx)(n.code,{children:"APP_ENV"})," variable inside\nthe ",(0,i.jsx)(n.code,{children:".env"})," file and again try to find the ",(0,i.jsx)(n.code,{children:".env.${APP_ENV}"}),"\nfile to load. Finally, if the ",(0,i.jsx)(n.code,{children:"APP_ENV"})," is not present in ",(0,i.jsx)(n.code,{children:".env"})," file,\nAthenna will end up loading the ",(0,i.jsx)(n.code,{children:".env"})," file by default."]}),"\n",(0,i.jsxs)(n.p,{children:["Running providing ",(0,i.jsx)(n.code,{children:"--env"})," flag in Artisan:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"node artisan serve --env=local\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Running providing ",(0,i.jsx)(n.code,{children:"APP_ENV"})," externally:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"APP_ENV=local node artisan serve\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Let's check some practical examples. This is the default\n",(0,i.jsx)(n.code,{children:".env"})," file that comes in Athenna project:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-dotenv",children:"HOST=localhost\nPORT=3000\n\nAPP_NAME=Athenna\nAPP_ENV=local\nAPP_DEBUG=true\nAPP_URL=http://${HOST}:${PORT}\nAPP_DOMAIN=${HOST}\nAPP_DOCUMENTATION=${APP_URL}\nAPP_SOURCE=https://github.com/AthennaIO\n\nLOG_HTTP=true\nLOG_CHANNEL=application\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In the ",(0,i.jsx)(n.code,{children:".env"})," file above, you can see that we have the\n",(0,i.jsx)(n.code,{children:"APP_ENV=local"}),". This means that if you create a new\n",(0,i.jsx)(n.code,{children:".env.local"})," file in your project root path, Athenna\nwill load it instead of ",(0,i.jsx)(n.code,{children:".env"})," if running your application\nwithout a predefined environment."]}),"\n",(0,i.jsx)(n.h3,{id:"get-an-environment-variable-value",children:"Get an environment variable value"}),"\n",(0,i.jsxs)(n.p,{children:["You can get environment variables using the ",(0,i.jsx)(n.code,{children:"Env()"})," function:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Env } from '@athenna/config'\n\nconst defaultValue = 'Athenna'\n\nconst appName = Env('APP_NAME', defaultValue)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["All environment variables in your .env file and inside\n",(0,i.jsx)(n.code,{children:"process.env"})," object are always interpreted as strings.\nBut when using the ",(0,i.jsx)(n.code,{children:"Env()"})," function, it will auto cast the\nvalue for you. Check the comparison:"]}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{style:{textAlign:"left"},children:"Value in .env"}),(0,i.jsx)(n.th,{style:{textAlign:"right"},children:"Value returned by Env function"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:["true ",(0,i.jsx)(n.strong,{children:"(boolean)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["true ",(0,i.jsx)(n.strong,{children:"(boolean)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"true" ',(0,i.jsx)(n.strong,{children:"(string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["true ",(0,i.jsx)(n.strong,{children:"(boolean)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:["10 ",(0,i.jsx)(n.strong,{children:"(number)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10 ",(0,i.jsx)(n.strong,{children:"(number)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"10" ',(0,i.jsx)(n.strong,{children:"(string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10 ",(0,i.jsx)(n.strong,{children:"(number)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:["10.090909 ",(0,i.jsx)(n.strong,{children:"(float)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10.090909 ",(0,i.jsx)(n.strong,{children:"(float)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"10.090909" ',(0,i.jsx)(n.strong,{children:"(string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:["10.090909 ",(0,i.jsx)(n.strong,{children:"(float)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['{"name":"Paulo"} ',(0,i.jsx)(n.strong,{children:"(json)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:['{ name: "Paulo" } ',(0,i.jsx)(n.strong,{children:"(Object)"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{style:{textAlign:"left"},children:['"{"name":"Paulo"}" ',(0,i.jsx)(n.strong,{children:"(json string)"})]}),(0,i.jsxs)(n.td,{style:{textAlign:"right"},children:['{ name: "Paulo" } ',(0,i.jsx)(n.strong,{children:"(Object)"})]})]})]})]}),"\n",(0,i.jsx)(n.p,{children:"Let's see a more practical example of it:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"process.env.PORT = '3000'\nprocess.env.APP_DEBUG = 'true'\nprocess.env.APP_JSON = '{\"name\":\"Paulo\"}'\n\nconsole.log(Env('PORT')) // 3000 <- number\nconsole.log(Env('APP_DEBUG')) // true <- boolean\nconsole.log(Env('APP_JSON')) // { name: \"Paulo\" } <- object\n"})}),"\n",(0,i.jsxs)(n.p,{children:["There will certainly have scenarios in your business rule\nwhere you explicitly need an environment variable with value\n",(0,i.jsx)(n.code,{children:"true"}),", ",(0,i.jsx)(n.code,{children:"10"})," or ",(0,i.jsx)(n.code,{children:'{"name":"Paulo"}'})," to be a string. To solve\nthis, you can turn off the auto cast when using the ",(0,i.jsx)(n.code,{children:"Env()"}),"\nfunction:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"process.env.PORT = '3000'\nprocess.env.APP_DEBUG = 'true'\nprocess.env.APP_JSON = '{\"name\":\"Paulo\"}'\n\nconst autoCast = false\nconst defaultValue = undefined\n\nconsole.log(Env('PORT', defaultValue, autoCast)) // 3000 <- string\nconsole.log(Env('APP_DEBUG', defaultValue, autoCast)) // true <- string\nconsole.log(Env('APP_JSON', defaultValue, autoCast)) // {\"name\":\"Paulo\"} <- string\n"})}),"\n",(0,i.jsx)(n.p,{children:"Environment variables can parse other environment variables\ntoo. See the example above:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-dotenv",children:"HOST=localhost\nPORT=3000\n\nAPP_URL=http://${HOST}:${PORT}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"console.log(Env('APP_URL')) // \"http://localhost:3000\"\n"})}),"\n",(0,i.jsx)(n.h2,{id:"custom-environment-file-path",children:"Custom environment file path"}),"\n",(0,i.jsxs)(n.p,{children:["You can also change the name and the path of your ",(0,i.jsx)(n.code,{children:".env"})," file.\nTo do that you need to set the new path to ",(0,i.jsx)(n.code,{children:"Ignite::load()"})," static method:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",metastring:"title=\"Path.bin('dev.ts')\"",children:"import { Ignite } from '@athenna/core'\n\nconst ignite = await new Ignite().load(import.meta.url, {\n envPath: './bootstrap/.env.dev' \ud83d\udc48\n})\n\nawait ignite.httpServer()\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsx)(n.p,{children:"Always remember that when using relative paths to set something\nin Athenna, you need to use your project root path as reference,\njust like in the example above."})}),"\n",(0,i.jsx)(n.h2,{id:"configuration-files",children:"Configuration files"}),"\n",(0,i.jsxs)(n.p,{children:["All the configuration files for the Athenna framework are\nstored in the ",(0,i.jsx)(n.code,{children:"src/config"})," directory. Each option is documented, so\nfeel free to look through the files and get familiar with\nthe options available to you."]}),"\n",(0,i.jsx)(n.p,{children:"Athenna needs almost no additional configuration out of\nthe box. You are free to get started developing! Each\noption is documented, so feel free to look through the\nfiles and get familiar with the options available to you.\nIt contains several options such as locale that you may\nwish to change, according to your application."}),"\n",(0,i.jsx)(n.h3,{id:"manipulating-configuration-values",children:"Manipulating configuration values"}),"\n",(0,i.jsxs)(n.p,{children:["You may easily access your configuration values using the\nglobal ",(0,i.jsx)(n.code,{children:"Config"})," helper class. The configuration values may\nbe accessed using ",(0,i.jsx)(n.code,{children:'"dot (.)"'})," syntax, which includes the\nname of the file and option you wish to access. Let's cover\nsome methods bellow:"]}),"\n",(0,i.jsx)(n.h4,{id:"configget",children:(0,i.jsx)(n.code,{children:"Config.get()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"get()"})," method will return the value of your configuration.\nYou can also set a default value as second parameter that will\nbe returned if the configuration option does not exist:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nconst defaultValue = 'Athenna'\nconst name = Config.get('app.name', defaultValue)\n\nconsole.log(name) // MyAppName\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["You can get all the configuration values using ",(0,i.jsx)(n.code,{children:"get()"})," method\nwithout any key:"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"console.log(Config.get()) // { app: {...}, http: {...}, ... }\n"})})]}),"\n",(0,i.jsx)(n.h4,{id:"configset",children:(0,i.jsx)(n.code,{children:"Config.set()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"set()"})," method is very useful to set or change the value\nof some configuration in runtime:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.set('app.name', 'Athenna Framework')\n\nconsole.log(Config.get('app.name')) // Athenna Framework\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"Config.set()"})," method does not change the values in\nthe configuration file, only in runtime. To do that, you\nwill need to use the ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/getting-started/configuration#configrewrite",children:"Config.rewrite()"}),"\nmethod."]})}),"\n",(0,i.jsx)(n.h4,{id:"configsafeset",children:(0,i.jsx)(n.code,{children:"Config.safeSet()"})}),"\n",(0,i.jsxs)(n.p,{children:["If you are not sure if some configuration value is already\nset of not, you can use the ",(0,i.jsx)(n.code,{children:"safeSet()"})," method instead to\nnot overwrite something that was already defined:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nconsole.log(Config.get('app.name')) // MyAppName\n\nConfig.safeSet('app.name', 'Athenna Framework')\n\nconsole.log(Config.get('app.name')) // MyAppName\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configdelete",children:(0,i.jsx)(n.code,{children:"Config.delete()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"delete()"})," method could be used to delete some configuration\nvalue:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.delete('app.name')\n\nconsole.log(Config.get('app.name')) // undefined\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Just like ",(0,i.jsx)(n.code,{children:"Config.set()"})," method, ",(0,i.jsx)(n.code,{children:"Config.delete()"})," does\nnot change the values in the configuration file, only\nin runtime. To do that you will need to use the\n",(0,i.jsx)(n.code,{children:"Config.rewrite()"})," method."]})}),"\n",(0,i.jsx)(n.h4,{id:"configrewrite",children:(0,i.jsx)(n.code,{children:"Config.rewrite()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"rewrite()"})," method is very useful for rewriting the\nconfiguration file. Very useful when you want to\nprogrammatically modify the configuration file source code.\nThis method uses the ",(0,i.jsx)(n.a,{href:"https://github.com/unjs/magicast",children:"magicast"}),"\nlibrary under the hood to do that:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.set('app.name', 'Athenna Framework')\n\nawait Config.rewrite('app')\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"warning",children:[(0,i.jsxs)(n.p,{children:["Let's suppose that you want to set a function as a value,\nyou can use builders.functionCall function of ",(0,i.jsx)(n.a,{href:"https://github.com/unjs/magicast",children:"magicast"}),"\nlibrary to do that:"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { builders } from 'magicast'\nimport { Config } from '@athenna/config'\n\nConfig.set('app.name', builders.functionCall('Env', ['MY_APP_NAME']))\n\nawait Config.rewrite('app')\n"})}),(0,i.jsxs)(n.p,{children:["The example above will produce the following code in ",(0,i.jsx)(s.A,{father:"config",child:"app.ts"}),":"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"export default {\n name: Env('MY_APP_NAME')\n ...\n}\n"})})]}),"\n",(0,i.jsx)(n.h4,{id:"configis",children:(0,i.jsx)(n.code,{children:"Config.is()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"is()"})," method could be used to validate if your\nconfiguration value matches some other value:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nif (Config.is('app.name', 'Athenna')) {\n // do something\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["You can set an array as second parameter to ",(0,i.jsx)(n.code,{children:"is()"})," method.\nIf any value in the array matches the configuration value,\nthe method will return true:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nif (Config.is('app.name', ['Athenna', 'MyAppName'])) {\n // do something\n}\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["You can use the ",(0,i.jsx)(n.code,{children:"isNot()"})," method to do the negated validation."]})}),"\n",(0,i.jsx)(n.h4,{id:"configexistsall",children:(0,i.jsx)(n.code,{children:"Config.existsAll()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"existsAll()"})," method could be used to validate if an\narray of configuration keys exists or not:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nif (Config.existsAll(['app.name', 'app.version'])) {\n // do something\n}\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["You can use the ",(0,i.jsx)(n.code,{children:"notExistsAll()"})," method to do the negate\nvalidation."]})}),"\n",(0,i.jsx)(n.h4,{id:"configclear",children:(0,i.jsx)(n.code,{children:"Config.clear()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"clear()"})," method could be used to clear all the configuration\nvalues:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Config } from '@athenna/config'\n\nConfig.clear()\n\nconsole.log(Config.get()) // {}\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configload",children:(0,i.jsx)(n.code,{children:"Config.load()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"load()"})," method could be used to load some configuration\nfile path:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\nimport { Config } from '@athenna/config'\n\nconst testConfig = Path.stubs('config/test.ts') // /path/to/your/project/tests/stubs/config/test.ts\nawait Config.load(testConfig)\n\nconsole.log(Config.get('test')) // { ... }\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configsafeload",children:(0,i.jsx)(n.code,{children:"Config.safeLoad()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"safeLoad()"})," method will only load the file path if it\nis not defined:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\nimport { Config } from '@athenna/config'\n\nconst appConfig = Path.stubs('config/app.js') // /path/to/your/project/tests/stubs/config/app.js\nawait Config.safeLoad(appConfig)\n"})}),"\n",(0,i.jsx)(n.h4,{id:"configloadall",children:(0,i.jsx)(n.code,{children:"Config.loadAll()"})}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"loadAll"})," method will load all files found inside some\nconfiguration path:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\nimport { Config } from '@athenna/config'\n\nconst config = Path.stubs('config') // /path/to/your/project/tests/stubs/config\nawait Config.loadAll(config)\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"get-configuration-with-value-decorator",children:["Get configuration with ",(0,i.jsx)(n.code,{children:"@Value()"})," decorator"]}),"\n",(0,i.jsxs)(n.p,{children:["Instead of using the ",(0,i.jsx)(n.code,{children:"Config.get()"})," method to get a configuration\nvalue, you can use the ",(0,i.jsx)(n.code,{children:"@Value()"})," annotation in your classes to\nautomatically add it value to a class property:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Value } from '@athenna/config'\n\nexport class UserService {\n @Value('api.users') \ud83d\udc48\n public api: string\n}\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["Just like ",(0,i.jsx)(n.code,{children:"Config.get()"})," method, you can set a default value\nwhen using the ",(0,i.jsx)(n.code,{children:"@Value()"})," annotation:"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"@Value('api.users', 'http://localhost:3000/users') \ud83d\udc48\n"})})]}),"\n",(0,i.jsx)(n.h3,{id:"define-my-own-configuration-path",children:"Define my own configuration path"}),"\n",(0,i.jsxs)(n.p,{children:["If you are building your own project structure you might want to\nchange the configurations directory from ",(0,i.jsx)(n.code,{children:"src/config"})," to something\nelse. For this case you can specify to Athenna a different path to\nwhat ",(0,i.jsx)(s.A,{fatherPath:"config"})," will resolve."]}),"\n",(0,i.jsxs)(n.p,{children:["To specify your application directories to Athenna, you can\nopen the ",(0,i.jsx)(n.code,{children:".athennarc.json"})," file and add the ",(0,i.jsx)(n.code,{children:"directories"}),"\nproperty to it. The ",(0,i.jsx)(n.code,{children:"directories"})," property is an object that maps the directory\nbase path that the ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,i.jsx)(n.code,{children:"Path"})}),"\nhelper will use to resolve your application paths:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\n\nconsole.log(Path.config()) // /path/to/your/project/src/config\n"})}),"\n",(0,i.jsxs)(n.p,{children:["All the ",(0,i.jsx)(n.code,{children:"directories"})," key names follow the ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,i.jsx)(n.code,{children:"Path"})}),"\nclass methods names. This means that if you want to change\nwhat is returned by the ",(0,i.jsx)(s.A,{fatherPath:"config"})," method, you will\nneed to add the ",(0,i.jsx)(n.code,{children:"config"})," key to the ",(0,i.jsx)(n.code,{children:"directories"})," object:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "directories": {\n "config": "src/app/config"\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Now when calling the ",(0,i.jsx)(s.A,{father:"config"})," method, it will return\na different path:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"import { Path } from '@athenna/common'\n\nconsole.log(Path.config()) // /path/to/your/project/src/app/config \ud83d\udc48\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Athenna always rely on ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,i.jsx)(n.code,{children:"Path"})}),"\nclass methods to find files and directories that are used\ninternally by the framework, like configuration file, route\nfiles, entry points and many others."]}),"\n",(0,i.jsxs)(n.p,{children:["Check ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/getting-started/athennarc-file#the-directories-property",children:"the directories property documentation section"}),"\nfor more information about the ",(0,i.jsx)(n.code,{children:"directories"})," property. And\ncheck ",(0,i.jsx)(n.a,{href:"https://athenna.io/docs/getting-started/directory-structure#do-your-own-structure",children:"the do your own structure documentation section"}),"\nfor more information about how to create your own project\nstructure."]}),"\n",(0,i.jsx)(n.h2,{id:"safe-loading-configuration-files",children:"Safe loading configuration files"}),"\n",(0,i.jsxs)(n.p,{children:["Athenna got multiple types of applications, while using the framework\nyou will notice that some times you could end up igniting your application\ntwice. Let's suppose you are using ",(0,i.jsx)(n.code,{children:"node artisan serve"})," command to start\nyour application, this command will first ignite your application by Artisan\nand them by the HTTP server."]}),"\n",(0,i.jsxs)(n.p,{children:["This is usually not a problem at all, but depending on how you have created\nyour environment it could become one. To avoid reloading configuration\nfiles in these situations, you can set the ",(0,i.jsx)(n.code,{children:"loadConfigSafe"})," option as ",(0,i.jsx)(n.code,{children:"true"}),"\nin ",(0,i.jsx)(n.code,{children:"Ignite::load()"})," static method:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",metastring:"title=\"Path.bin('main.ts')\"",children:"import { Ignite } from '@athenna/core'\n\nconst ignite = await new Ignite().load(import.meta.url, {\n loadConfigSafe: true, \ud83d\udc48\n})\n\nawait ignite.httpServer()\n"})}),"\n",(0,i.jsx)(n.h2,{id:"debug-mode",children:"Debug mode"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"debug"})," option in your ",(0,i.jsx)(s.A,{path:"config",child:"app.ts"})," configuration\nfile determines how much information about your application\nis actually displayed to you and for who is going to consume\nyour application. By default, this option is set to respect\nthe value of the ",(0,i.jsx)(n.code,{children:"APP_DEBUG"})," environment variable, which is\nstored in your ",(0,i.jsx)(n.code,{children:".env"})," file."]}),"\n",(0,i.jsxs)(n.p,{children:["For local development, you should set the ",(0,i.jsx)(n.code,{children:"APP_DEBUG"}),"\nenvironment variable to ",(0,i.jsx)(n.code,{children:"true"}),". In your production environment,\nthis value should always be ",(0,i.jsx)(n.code,{children:"false"}),", if the variable is\nset to ",(0,i.jsx)(n.code,{children:"true"})," in production, you risk exposing sensitive\nconfiguration values to your application's end users."]})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}},7049:(e,n,t)=>{t.d(n,{A:()=>s});t(6540);const i={hoverCardContainer:"hoverCardContainer_jqUQ",hoverCardLink:"hoverCardLink_oDZU",hoverCard:"hoverCard_qTDS"};var o=t(4848);function s(e){let n=e.father;switch(e.father){case"storage":n="src/storage";break;case"logs":n="src/storage/logs";break;case"views":n="src/resources/views";break;case"locales":n="src/resources/locales";break;case"static":n="src/resources/static";break;case"config":n="src/config";break;case"database":n="src/database";break;case"seeders":n="src/database/seeders";break;case"migrations":n="src/database/migrations";break;case"console":n="src/console";break;case"commands":n="src/console/commands";break;case"cron":n="src/cron";break;case"schedulers":n="src/cron/schedulers";break;case"models":n="src/models";break;case"services":n="src/services";break;case"repositories":n="src/repositories";break;case"http":n="src/http";break;case"controllers":n="src/http/controllers";break;case"middlewares":n="src/http/middlewares";break;case"interceptors":n="src/http/interceptors";break;case"terminators":n="src/http/terminators";break;case"stubs":n="tests/stubs";break;case"fixtures":n="tests/fixtures";break;case"providers":n="src/providers";break;case"facades":n="src/facades";break;case"routes":n="src/routes"}return(0,o.jsxs)("div",{className:i.hoverCardContainer,children:[(0,o.jsx)("a",{className:i.hoverCardLink,href:`/docs/the-basics/helpers#path${e.father}`,children:(0,o.jsxs)("code",{children:["Path.",e.father,"(",e.child?`'${e.child}'`:"",")"]})}),(0,o.jsx)("div",{className:i.hoverCard,children:(0,o.jsxs)("p",{style:{margin:0},children:["./",n,e.child?`/${e.child}`:""]})})]})}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>a});var i=t(6540);const o={},s=i.createContext(o);function r(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/6459b84b.41354f80.js b/assets/js/6459b84b.41354f80.js
deleted file mode 100644
index 487eb16e..00000000
--- a/assets/js/6459b84b.41354f80.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[6459],{7112:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>h});var a=t(4848),i=t(8453),o=t(7049);const r={title:"Installation",sidebar_position:1,description:"How to install and set up your first Athenna project."},s="Installation",c={id:"getting-started/installation",title:"Installation",description:"How to install and set up your first Athenna project.",source:"@site/docs/getting-started/installation.mdx",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/getting-started/installation",draft:!1,unlisted:!1,editUrl:"https://github.com/AthennaIO/Docs/tree/main/docs/getting-started/installation.mdx",tags:[],version:"current",sidebarPosition:1,frontMatter:{title:"Installation",sidebar_position:1,description:"How to install and set up your first Athenna project."},sidebar:"tutorialSidebar",next:{title:"AthennaRC File",permalink:"/docs/getting-started/athennarc-file"}},l={},h=[{value:"Meet Athenna",id:"meet-athenna",level:2},{value:"Why Athenna?",id:"why-athenna",level:2},{value:"A progressive framework",id:"a-progressive-framework",level:3},{value:"A scalable framework",id:"a-scalable-framework",level:3},{value:"An agnostic framework",id:"an-agnostic-framework",level:3},{value:"A community framework",id:"a-community-framework",level:3},{value:"Your first Athenna project",id:"your-first-athenna-project",level:2},{value:"Prerequisites",id:"prerequisites",level:3},{value:"Installing via package manager",id:"installing-via-package-manager",level:3},{value:"Application type",id:"application-type",level:4},{value:"Running your application",id:"running-your-application",level:2},{value:"What the \ud83e\udd2c is Path.bin('main.ts')
?",id:"what-the--is-pathbinmaints",level:3},{value:"Initial configuration",id:"initial-configuration",level:2},{value:"Environment based configuration",id:"environment-based-configuration",level:2},{value:"Workspace and runtime configurations",id:"workspace-and-runtime-configurations",level:2},{value:"Next steps",id:"next-steps",level:2},{value:"REST API application",id:"rest-api-application",level:3},{value:"Command Line Interface (CLI) application",id:"command-line-interface-cli-application",level:3},{value:"CRON Job application",id:"cron-job-application",level:3}];function d(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.header,{children:(0,a.jsx)(n.h1,{id:"installation",children:"Installation"})}),"\n",(0,a.jsx)(n.p,{children:"How to install and set up your first Athenna project."}),"\n",(0,a.jsx)(n.h2,{id:"meet-athenna",children:"Meet Athenna"}),"\n",(0,a.jsx)(n.p,{children:"Athenna is a framework written specially for the Node.js runtime\nwith expressive and elegant syntax. The framework provides a reliable\ncode foundation and starting point for creating your application,\nallowing you to focus on creating something amazing while we sweat the\ndetails."}),"\n",(0,a.jsx)(n.p,{children:"Athenna strives to provide an amazing developer experience while\nproviding powerful features such as thorough dependency injection,\nan expressive database abstraction layer, unit and e2e testing,\nand more."}),"\n",(0,a.jsxs)(n.p,{children:["Whether you are new to Node.js ecosystem or have years of experience,\nAthenna is a framework that can grow with you. We'll help you take\nyour first steps as a developer or give you a boost as you take your\nexpertise to the next level. We can't wait to see what you build, make\nsure to share it with us in our ",(0,a.jsx)(n.a,{href:"https://discord.gg/JdEbBAKw6X",children:"Discord community"}),"."]}),"\n",(0,a.jsx)(n.admonition,{type:"tip",children:(0,a.jsxs)(n.p,{children:["New to Athenna? Check out the ",(0,a.jsx)(n.a,{href:"https://www.youtube.com/@athennaio",children:"Athenna YouTube channel"}),"\nfor an infinity of hands-on videos!"]})}),"\n",(0,a.jsx)(n.h2,{id:"why-athenna",children:"Why Athenna?"}),"\n",(0,a.jsx)(n.p,{children:"There are a variety of tools and frameworks available to you when building\na software using Node.js. However, we believe Athenna is the best choice for\nbuilding modern microservices."}),"\n",(0,a.jsx)(n.h3,{id:"a-progressive-framework",children:"A progressive framework"}),"\n",(0,a.jsx)(n.p,{children:"We like to call Athenna a \"progressive\" framework. By that, we mean that\nAthenna grows with you. If you're just taking your first steps into backend\ndevelopment, Athenna's vast library of documentation, guides, and video\ntutorials will help you learn the ropes without becoming overwhelmed."}),"\n",(0,a.jsx)(n.p,{children:"If you're a senior developer, Athenna gives you robust tools for dependency\ninjection, unit and e2e testing, database abstracted layer and more.\nAthenna is fine-tuned for building professional applications and ready to\nhandle enterprise work loads."}),"\n",(0,a.jsx)(n.h3,{id:"a-scalable-framework",children:"A scalable framework"}),"\n",(0,a.jsxs)(n.p,{children:["Athenna is incredibly scalable. Thanks to the scaling-friendly nature of\nNode.js and great libraries like ",(0,a.jsx)(n.a,{href:"https://fastify.dev/",children:"Fastify"}),", horizontal\nscaling with Athenna is a breeze. In fact, Athenna REST API's have been\neasily scaled to handle hundreds of millions of requests per month."]}),"\n",(0,a.jsx)(n.h3,{id:"an-agnostic-framework",children:"An agnostic framework"}),"\n",(0,a.jsx)(n.p,{children:"Athenna is perpect for building modern software using microservices architecture.\nNo matter what type of application you are creating, be it a REST API, a CLI, a CRON Job,\nAthenna has a reliable solution foundation for each occasion, the only thing you will\nneed to take care is how your application will communicate with the external world."}),"\n",(0,a.jsx)(n.h3,{id:"a-community-framework",children:"A community framework"}),"\n",(0,a.jsxs)(n.p,{children:["Athenna is not reinventing the whell, the framework combines the best packages\nin the Node.js ecosystem to offer the most robust and developer friendly\nframework. We are always seeking for talented developers like you to\nhelp us by ",(0,a.jsx)(n.a,{href:"https://github.com/athennaio",children:"contributing to the framework"})," and\nmake it even better."]}),"\n",(0,a.jsx)(n.h2,{id:"your-first-athenna-project",children:"Your first Athenna project"}),"\n",(0,a.jsx)(n.h3,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,a.jsxs)(n.p,{children:["First, you need to install ",(0,a.jsx)(n.a,{href:"https://nodejs.org/",children:"Node.js"}),".\nWe recommend using ",(0,a.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",children:"nvm"})," to do that."]}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm#installing-and-updating",children:"Click here to install nvm and get npm and Node.js\nrunning on your machine."})}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["After you install ",(0,a.jsx)(n.code,{children:"nvm"}),", we recommend you to install\nNode.js v20.x or above, but you can still use\nNode.js v16.x and above. Install Node.js v20.x by running:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"nvm install 20\n"})}),"\n",(0,a.jsxs)(n.p,{children:["We recommend setting Node.js v20.x as the default version, to do\nso with ",(0,a.jsx)(n.code,{children:"nvm"})," run:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"nvm alias default 20.8.1\n"})}),"\n",(0,a.jsx)(n.h3,{id:"installing-via-package-manager",children:"Installing via package manager"}),"\n",(0,a.jsx)(n.p,{children:"We want it to be as easy as possible to get started with\nAthenna. With that in mind, we developed a CLI to assist\nin the creation of a new project."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"npm install -g @athenna/cli\n"})}),"\n",(0,a.jsx)(n.p,{children:"Then you can run this command to generate your project:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"athenna new my-project-name\n"})}),"\n",(0,a.jsx)(n.p,{children:"The installation process prompts for the following selections:"}),"\n",(0,a.jsx)(n.h4,{id:"application-type",children:"Application type"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"REST Api"})," application is ideal for creating a Http server\nusing REST architecture."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"CLI"})," application is ideal for creating global CLI's to publish\nin some registry like npm."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"CRON"})," application is ideal for creating schedulers that will run\nperiodic jobs, such as for maintenance or calling third-party APIs\nto collect up-to-date data."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"running-your-application",children:"Running your application"}),"\n",(0,a.jsx)(n.p,{children:"To run your application in development mode, run the following\ncommand:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"node artisan serve --watch\n"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["The ",(0,a.jsx)(n.code,{children:"serve"})," command will look up for your ",(0,a.jsx)(o.A,{father:"bin",child:"main.ts"}),"\nfile to bootstrap your application with predefined configurations."]}),"\n",(0,a.jsxs)(n.li,{children:["The ",(0,a.jsx)(n.code,{children:"watch"})," flag is meant to watch the file system for\nchanges and restart your application automatically when\ndoing some change on it."]}),"\n"]}),"\n",(0,a.jsxs)(n.h3,{id:"what-the--is-pathbinmaints",children:["What the \ud83e\udd2c is ",(0,a.jsx)(n.code,{children:"Path.bin('main.ts')"}),"?"]}),"\n",(0,a.jsx)(n.p,{children:"Well, Athenna tries a lot to be a framework without opinion, one thing\nthat some frameworks do that makes them to have a lot of opinion is defining\ncrucial file paths where you can't touch that file without breaking everything."}),"\n",(0,a.jsxs)(n.p,{children:["Athenna is not totally different from them in this aspect, as you can see,\nthe ",(0,a.jsx)(n.code,{children:"node artisan serve"})," command depends on the existence of the ",(0,a.jsx)(n.code,{children:"./bin/main.ts"}),'\nfile. To be able to be "opinion less" without losing DX (Developer Experience)\nwe ensure that you can easily configure this path the way you want by doing two\nthings:']}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["In all places of our documentation you will see that we always use the\n",(0,a.jsx)(n.a,{href:"/docs/the-basics/helpers#path",children:(0,a.jsx)(n.code,{children:"Path"})})," helper to reference file paths, this\nway is easier for you to understand that the path directory you just see is\nconfigurable."]}),"\n",(0,a.jsxs)(n.li,{children:["Inside ",(0,a.jsx)(n.code,{children:".athennarc.json"})," file or the ",(0,a.jsx)(n.code,{children:"athenna"})," property of your ",(0,a.jsx)(n.code,{children:"package.json"})," you\nhave the ",(0,a.jsxs)(n.a,{href:"/docs/getting-started/athennarc-file#the-directories-property",children:[(0,a.jsx)(n.code,{children:"directories"})," property"]}),"\nwhere you can modify any path supported by the ",(0,a.jsx)(n.a,{href:"/docs/the-basics/helpers#path",children:(0,a.jsx)(n.code,{children:"Path"})})," helper."]}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["Ok, now you might be asking yourself: what the \ud83e\udd2c is ",(0,a.jsx)(n.code,{children:".athennarc.json"}),"? Be patient, we\ngonna see later on this documentation page \ud83d\ude06."]}),"\n",(0,a.jsx)(n.h2,{id:"initial-configuration",children:"Initial configuration"}),"\n",(0,a.jsxs)(n.p,{children:["All of the configuration files for the Athenna framework are stored\nin the ",(0,a.jsx)(o.A,{father:"config"})," directory. Each option is documented, so feel\nfree to look through the files and get familiar with the options available\nto you."]}),"\n",(0,a.jsxs)(n.p,{children:["Athenna needs almost no additional configuration out of the box. You are\nfree to get started developing! However, you may wish to review the\n",(0,a.jsx)(o.A,{father:"config",child:"app.ts"})," file and its documentation. It contains several\noptions such as locale that you may wish to change according to your\napplication."]}),"\n",(0,a.jsx)(n.h2,{id:"environment-based-configuration",children:"Environment based configuration"}),"\n",(0,a.jsxs)(n.p,{children:["Since many of Athenna's configuration option values may vary depending on\nwhether your application is running on your local machine or in production,\nmany important configuration values are defined using the ",(0,a.jsx)(n.code,{children:".env"})," file that\nexists at the root of your application."]}),"\n",(0,a.jsxs)(n.p,{children:["Your ",(0,a.jsx)(n.code,{children:".env"})," file should not be committed to your application's source control,\nsince each developer / server using your application could require a different\nenvironment configuration. Furthermore, this would be a security risk in the\nevent an intruder gains access to your source control repository, since any\nsensitive credentials would get exposed."]}),"\n",(0,a.jsx)(n.admonition,{type:"note",children:(0,a.jsxs)(n.p,{children:["For more information about the ",(0,a.jsx)(n.code,{children:".env"})," file and environment based configuration,\ncheck out the full ",(0,a.jsx)(n.a,{href:"/docs/getting-started/configuration",children:"configuration documentation"}),"."]})}),"\n",(0,a.jsx)(n.h2,{id:"workspace-and-runtime-configurations",children:"Workspace and runtime configurations"}),"\n",(0,a.jsxs)(n.p,{children:["Inside the root directory of your project, there is a file\ncalled ",(0,a.jsx)(n.code,{children:".athennarc.json"})," or the ",(0,a.jsx)(n.code,{children:"athenna"})," property of your\n",(0,a.jsx)(n.code,{children:"package.json"}),". These configurations are used by Athenna\nfor configuring the workspace and certain runtime\nsettings of your Athenna application. Basically any configuration\nrelated to how the framework will bootstrap and behave should be\ndefined in these configuration."]}),"\n",(0,a.jsxs)(n.admonition,{type:"note",children:[(0,a.jsxs)(n.p,{children:["Always remember that if you can't find the ",(0,a.jsx)(n.code,{children:".athennarc.json"})," file\nin the root path of you project, it will be defined inside of your\n",(0,a.jsx)(n.code,{children:"package.json"})," in the ",(0,a.jsx)(n.code,{children:"athenna"})," property."]}),(0,a.jsxs)(n.p,{children:["For more information about the RC file, more details about each one\nof its options and also how to define your own properties inside of it\ncheck out the full ",(0,a.jsx)(n.a,{href:"/docs/getting-started/athennarc-file",children:"Athenna RC file documentation"}),"."]})]}),"\n",(0,a.jsx)(n.h2,{id:"next-steps",children:"Next steps"}),"\n",(0,a.jsx)(n.p,{children:"Now that you have created your Athenna project, you may be\nwondering what to learn next. First, we strongly recommend\nbecoming familiar with how Athenna works by reading the\nfollowing documentation:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/architecture-concepts/application-lifecycle",children:"Application lifecycle"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/getting-started/configuration",children:"Configuration"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/getting-started/directory-structure",children:"Directory structure"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/architecture-concepts/service-container",children:"Service container"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/architecture-concepts/facades",children:"Facades"})}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"How you want to use Athenna will also dictate the next steps\non your journey. Since Athenna has different kind of applications,\nthere are a variety of ways to use Athenna, and we'll explore\nthe available ones bellow."}),"\n",(0,a.jsx)(n.admonition,{type:"tip",children:(0,a.jsxs)(n.p,{children:["New to Athenna? Check out the ",(0,a.jsx)(n.a,{href:"https://www.youtube.com/@athennaio",children:"Athenna YouTube channel"}),"\nfor an infinity of hands-on videos!"]})}),"\n",(0,a.jsx)(n.h3,{id:"rest-api-application",children:"REST API application"}),"\n",(0,a.jsx)(n.p,{children:"Use the REST API Application to serve as an API backend to single page application\nor mobile apps. In this context you may use Athenna for data storage / retrieval\nfor your REST API, while also taking advantage of Athenna's powerful services such\nas database, emails, notifications, and more."}),"\n",(0,a.jsxs)(n.p,{children:["If this is how you plan to use Athenna, you may want to check out our documentation\non ",(0,a.jsx)(n.a,{href:"/docs/rest-api-application/routing",children:"routing"})," and the ",(0,a.jsx)(n.a,{href:"/docs/orm/getting-started",children:"ORM"}),"."]}),"\n",(0,a.jsx)(n.h3,{id:"command-line-interface-cli-application",children:"Command Line Interface (CLI) application"}),"\n",(0,a.jsxs)(n.p,{children:["Use the command line interface (CLI) application to create libraries like ",(0,a.jsx)(n.code,{children:"athenna"}),"\nfor NPM where other developers could install it in their terminal. In this context\nyou may use Athenna for automatting process or generating files, while also taking\nadvantage of all Athenna's powerful foundation."]}),"\n",(0,a.jsxs)(n.p,{children:["If this is how you plan to use Athenna, you may want to check out our documentation\non ",(0,a.jsx)(n.a,{href:"/docs/cli-application/commands",children:"commands"}),"."]}),"\n",(0,a.jsx)(n.h3,{id:"cron-job-application",children:"CRON Job application"}),"\n",(0,a.jsx)(n.p,{children:"Use the CRON Job application to create schedulers for running periodic jobs, such\nas for maintenance or calling third-party APIs to collect up-to-date data."}),"\n",(0,a.jsxs)(n.p,{children:["If this is how you plan to use Athenna, you may want to check out our documentation\non ",(0,a.jsx)(n.a,{href:"/docs/cron-application/schedulers",children:"schedulers"}),"."]})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},7049:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);const a={hoverCardContainer:"hoverCardContainer_jqUQ",hoverCardLink:"hoverCardLink_oDZU",hoverCard:"hoverCard_qTDS"};var i=t(4848);function o(e){let n=e.father;switch(e.father){case"storage":n="src/storage";break;case"logs":n="src/storage/logs";break;case"views":n="src/resources/views";break;case"locales":n="src/resources/locales";break;case"static":n="src/resources/static";break;case"config":n="src/config";break;case"database":n="src/database";break;case"seeders":n="src/database/seeders";break;case"migrations":n="src/database/migrations";break;case"console":n="src/console";break;case"commands":n="src/console/commands";break;case"cron":n="src/cron";break;case"schedulers":n="src/cron/schedulers";break;case"models":n="src/models";break;case"services":n="src/services";break;case"repositories":n="src/repositories";break;case"http":n="src/http";break;case"controllers":n="src/http/controllers";break;case"middlewares":n="src/http/middlewares";break;case"interceptors":n="src/http/interceptors";break;case"terminators":n="src/http/terminators";break;case"stubs":n="tests/stubs";break;case"fixtures":n="tests/fixtures";break;case"providers":n="src/providers";break;case"facades":n="src/facades";break;case"routes":n="src/routes"}return(0,i.jsxs)("div",{className:a.hoverCardContainer,children:[(0,i.jsx)("a",{className:a.hoverCardLink,href:`/docs/the-basics/helpers#path${e.father}`,children:(0,i.jsxs)("code",{children:["Path.",e.father,"(",e.child?`'${e.child}'`:"",")"]})}),(0,i.jsx)("div",{className:a.hoverCard,children:(0,i.jsxs)("p",{style:{margin:0},children:["./",n,e.child?`/${e.child}`:""]})})]})}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>s});var a=t(6540);const i={},o=a.createContext(i);function r(e){const n=a.useContext(o);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/6459b84b.e29b05d3.js b/assets/js/6459b84b.e29b05d3.js
new file mode 100644
index 00000000..f62a2238
--- /dev/null
+++ b/assets/js/6459b84b.e29b05d3.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[6459],{7112:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>h});var a=t(4848),i=t(8453),o=t(7049);const r={title:"Installation",sidebar_position:1,description:"How to install and set up your first Athenna project."},s="Installation",c={id:"getting-started/installation",title:"Installation",description:"How to install and set up your first Athenna project.",source:"@site/docs/getting-started/installation.mdx",sourceDirName:"getting-started",slug:"/getting-started/installation",permalink:"/docs/getting-started/installation",draft:!1,unlisted:!1,editUrl:"https://github.com/AthennaIO/Docs/tree/main/docs/getting-started/installation.mdx",tags:[],version:"current",sidebarPosition:1,frontMatter:{title:"Installation",sidebar_position:1,description:"How to install and set up your first Athenna project."},sidebar:"tutorialSidebar",next:{title:"Athenna RC File",permalink:"/docs/getting-started/athennarc-file"}},l={},h=[{value:"Meet Athenna",id:"meet-athenna",level:2},{value:"Why Athenna?",id:"why-athenna",level:2},{value:"A progressive framework",id:"a-progressive-framework",level:3},{value:"A scalable framework",id:"a-scalable-framework",level:3},{value:"An agnostic framework",id:"an-agnostic-framework",level:3},{value:"A community framework",id:"a-community-framework",level:3},{value:"Your first Athenna project",id:"your-first-athenna-project",level:2},{value:"Prerequisites",id:"prerequisites",level:3},{value:"Installing via package manager",id:"installing-via-package-manager",level:3},{value:"Application type",id:"application-type",level:4},{value:"Running your application",id:"running-your-application",level:2},{value:"What the \ud83e\udd2c is Path.bin('main.ts')
?",id:"what-the--is-pathbinmaints",level:3},{value:"Initial configuration",id:"initial-configuration",level:2},{value:"Environment based configuration",id:"environment-based-configuration",level:2},{value:"Workspace and runtime configurations",id:"workspace-and-runtime-configurations",level:2},{value:"Next steps",id:"next-steps",level:2},{value:"REST API application",id:"rest-api-application",level:3},{value:"Command Line Interface (CLI) application",id:"command-line-interface-cli-application",level:3},{value:"CRON Job application",id:"cron-job-application",level:3}];function d(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.header,{children:(0,a.jsx)(n.h1,{id:"installation",children:"Installation"})}),"\n",(0,a.jsx)(n.p,{children:"How to install and set up your first Athenna project."}),"\n",(0,a.jsx)(n.h2,{id:"meet-athenna",children:"Meet Athenna"}),"\n",(0,a.jsx)(n.p,{children:"Athenna is a framework written specially for the Node.js runtime\nwith expressive and elegant syntax. The framework provides a reliable\ncode foundation and starting point for creating your application,\nallowing you to focus on creating something amazing while we sweat the\ndetails."}),"\n",(0,a.jsx)(n.p,{children:"Athenna strives to provide an amazing developer experience while\nproviding powerful features such as thorough dependency injection,\nan expressive database abstraction layer, unit and e2e testing,\nand more."}),"\n",(0,a.jsxs)(n.p,{children:["Whether you are new to Node.js ecosystem or have years of experience,\nAthenna is a framework that can grow with you. We'll help you take\nyour first steps as a developer or give you a boost as you take your\nexpertise to the next level. We can't wait to see what you build, make\nsure to share it with us in our ",(0,a.jsx)(n.a,{href:"https://discord.gg/JdEbBAKw6X",children:"Discord community"}),"."]}),"\n",(0,a.jsx)(n.admonition,{type:"tip",children:(0,a.jsxs)(n.p,{children:["New to Athenna? Check out the ",(0,a.jsx)(n.a,{href:"https://www.youtube.com/@athennaio",children:"Athenna YouTube channel"}),"\nfor an infinity of hands-on videos!"]})}),"\n",(0,a.jsx)(n.h2,{id:"why-athenna",children:"Why Athenna?"}),"\n",(0,a.jsx)(n.p,{children:"There are a variety of tools and frameworks available to you when building\na software using Node.js. However, we believe Athenna is the best choice for\nbuilding modern microservices."}),"\n",(0,a.jsx)(n.h3,{id:"a-progressive-framework",children:"A progressive framework"}),"\n",(0,a.jsx)(n.p,{children:"We like to call Athenna a \"progressive\" framework. By that, we mean that\nAthenna grows with you. If you're just taking your first steps into backend\ndevelopment, Athenna's vast library of documentation, guides, and video\ntutorials will help you learn the ropes without becoming overwhelmed."}),"\n",(0,a.jsx)(n.p,{children:"If you're a senior developer, Athenna gives you robust tools for dependency\ninjection, unit and e2e testing, database abstracted layer and more.\nAthenna is fine-tuned for building professional applications and ready to\nhandle enterprise work loads."}),"\n",(0,a.jsx)(n.h3,{id:"a-scalable-framework",children:"A scalable framework"}),"\n",(0,a.jsxs)(n.p,{children:["Athenna is incredibly scalable. Thanks to the scaling-friendly nature of\nNode.js and great libraries like ",(0,a.jsx)(n.a,{href:"https://fastify.dev/",children:"Fastify"}),", horizontal\nscaling with Athenna is a breeze. In fact, Athenna REST API's have been\neasily scaled to handle hundreds of millions of requests per month."]}),"\n",(0,a.jsx)(n.h3,{id:"an-agnostic-framework",children:"An agnostic framework"}),"\n",(0,a.jsx)(n.p,{children:"Athenna is perpect for building modern software using microservices architecture.\nNo matter what type of application you are creating, be it a REST API, a CLI, a CRON Job,\nAthenna has a reliable solution foundation for each occasion, the only thing you will\nneed to take care is how your application will communicate with the external world."}),"\n",(0,a.jsx)(n.h3,{id:"a-community-framework",children:"A community framework"}),"\n",(0,a.jsxs)(n.p,{children:["Athenna is not reinventing the whell, the framework combines the best packages\nin the Node.js ecosystem to offer the most robust and developer friendly\nframework. We are always seeking for talented developers like you to\nhelp us by ",(0,a.jsx)(n.a,{href:"https://github.com/athennaio",children:"contributing to the framework"})," and\nmake it even better."]}),"\n",(0,a.jsx)(n.h2,{id:"your-first-athenna-project",children:"Your first Athenna project"}),"\n",(0,a.jsx)(n.h3,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,a.jsxs)(n.p,{children:["First, you need to install ",(0,a.jsx)(n.a,{href:"https://nodejs.org/",children:"Node.js"}),".\nWe recommend using ",(0,a.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm",children:"nvm"})," to do that."]}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://github.com/nvm-sh/nvm#installing-and-updating",children:"Click here to install nvm and get npm and Node.js\nrunning on your machine."})}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["After you install ",(0,a.jsx)(n.code,{children:"nvm"}),", we recommend you to install\nNode.js v20.x or above, but you can still use\nNode.js v16.x and above. Install Node.js v20.x by running:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"nvm install 20\n"})}),"\n",(0,a.jsxs)(n.p,{children:["We recommend setting Node.js v20.x as the default version, to do\nso with ",(0,a.jsx)(n.code,{children:"nvm"})," run:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"nvm alias default 20.8.1\n"})}),"\n",(0,a.jsx)(n.h3,{id:"installing-via-package-manager",children:"Installing via package manager"}),"\n",(0,a.jsx)(n.p,{children:"We want it to be as easy as possible to get started with\nAthenna. With that in mind, we developed a CLI to assist\nin the creation of a new project."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"npm install -g @athenna/cli\n"})}),"\n",(0,a.jsx)(n.p,{children:"Then you can run this command to generate your project:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"athenna new my-project-name\n"})}),"\n",(0,a.jsx)(n.p,{children:"The installation process prompts for the following selections:"}),"\n",(0,a.jsx)(n.h4,{id:"application-type",children:"Application type"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"REST Api"})," application is ideal for creating a Http server\nusing REST architecture."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"CLI"})," application is ideal for creating global CLI's to publish\nin some registry like npm."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"CRON"})," application is ideal for creating schedulers that will run\nperiodic jobs, such as for maintenance or calling third-party APIs\nto collect up-to-date data."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"running-your-application",children:"Running your application"}),"\n",(0,a.jsx)(n.p,{children:"To run your application in development mode, run the following\ncommand:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"node artisan serve --watch\n"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["The ",(0,a.jsx)(n.code,{children:"serve"})," command will look up for your ",(0,a.jsx)(o.A,{father:"bin",child:"main.ts"}),"\nfile to bootstrap your application with predefined configurations."]}),"\n",(0,a.jsxs)(n.li,{children:["The ",(0,a.jsx)(n.code,{children:"watch"})," flag is meant to watch the file system for\nchanges and restart your application automatically when\ndoing some change on it."]}),"\n"]}),"\n",(0,a.jsxs)(n.h3,{id:"what-the--is-pathbinmaints",children:["What the \ud83e\udd2c is ",(0,a.jsx)(n.code,{children:"Path.bin('main.ts')"}),"?"]}),"\n",(0,a.jsx)(n.p,{children:"Well, Athenna tries a lot to be a framework without opinion, one thing\nthat some frameworks do that makes them to have a lot of opinion is defining\ncrucial file paths where you can't touch that file without breaking everything."}),"\n",(0,a.jsxs)(n.p,{children:["Athenna is not totally different from them in this aspect, as you can see,\nthe ",(0,a.jsx)(n.code,{children:"node artisan serve"})," command depends on the existence of the ",(0,a.jsx)(n.code,{children:"./bin/main.ts"}),'\nfile. To be able to be "opinion less" without losing DX (Developer Experience)\nwe ensure that you can easily configure this path the way you want by doing two\nthings:']}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["In all places of our documentation you will see that we always use the\n",(0,a.jsx)(n.a,{href:"/docs/the-basics/helpers#path",children:(0,a.jsx)(n.code,{children:"Path"})})," helper to reference file paths, this\nway is easier for you to understand that the path directory you just see is\nconfigurable."]}),"\n",(0,a.jsxs)(n.li,{children:["Inside ",(0,a.jsx)(n.code,{children:".athennarc.json"})," file or the ",(0,a.jsx)(n.code,{children:"athenna"})," property of your ",(0,a.jsx)(n.code,{children:"package.json"})," you\nhave the ",(0,a.jsxs)(n.a,{href:"/docs/getting-started/athennarc-file#the-directories-property",children:[(0,a.jsx)(n.code,{children:"directories"})," property"]}),"\nwhere you can modify any path supported by the ",(0,a.jsx)(n.a,{href:"/docs/the-basics/helpers#path",children:(0,a.jsx)(n.code,{children:"Path"})})," helper."]}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["Ok, now you might be asking yourself: what the \ud83e\udd2c is ",(0,a.jsx)(n.code,{children:".athennarc.json"}),"? Be patient, we\ngonna see later on this documentation page \ud83d\ude06."]}),"\n",(0,a.jsx)(n.h2,{id:"initial-configuration",children:"Initial configuration"}),"\n",(0,a.jsxs)(n.p,{children:["All of the configuration files for the Athenna framework are stored\nin the ",(0,a.jsx)(o.A,{father:"config"})," directory. Each option is documented, so feel\nfree to look through the files and get familiar with the options available\nto you."]}),"\n",(0,a.jsxs)(n.p,{children:["Athenna needs almost no additional configuration out of the box. You are\nfree to get started developing! However, you may wish to review the\n",(0,a.jsx)(o.A,{father:"config",child:"app.ts"})," file and its documentation. It contains several\noptions such as locale that you may wish to change according to your\napplication."]}),"\n",(0,a.jsx)(n.h2,{id:"environment-based-configuration",children:"Environment based configuration"}),"\n",(0,a.jsxs)(n.p,{children:["Since many of Athenna's configuration option values may vary depending on\nwhether your application is running on your local machine or in production,\nmany important configuration values are defined using the ",(0,a.jsx)(n.code,{children:".env"})," file that\nexists at the root of your application."]}),"\n",(0,a.jsxs)(n.p,{children:["Your ",(0,a.jsx)(n.code,{children:".env"})," file should not be committed to your application's source control,\nsince each developer / server using your application could require a different\nenvironment configuration. Furthermore, this would be a security risk in the\nevent an intruder gains access to your source control repository, since any\nsensitive credentials would get exposed."]}),"\n",(0,a.jsx)(n.admonition,{type:"note",children:(0,a.jsxs)(n.p,{children:["For more information about the ",(0,a.jsx)(n.code,{children:".env"})," file and environment based configuration,\ncheck out the full ",(0,a.jsx)(n.a,{href:"/docs/getting-started/configuration",children:"configuration documentation"}),"."]})}),"\n",(0,a.jsx)(n.h2,{id:"workspace-and-runtime-configurations",children:"Workspace and runtime configurations"}),"\n",(0,a.jsxs)(n.p,{children:["Inside the root directory of your project, there is a file\ncalled ",(0,a.jsx)(n.code,{children:".athennarc.json"})," or the ",(0,a.jsx)(n.code,{children:"athenna"})," property of your\n",(0,a.jsx)(n.code,{children:"package.json"}),". These configurations are used by Athenna\nfor configuring the workspace and certain runtime\nsettings of your Athenna application. Basically any configuration\nrelated to how the framework will bootstrap and behave should be\ndefined in these configuration."]}),"\n",(0,a.jsxs)(n.admonition,{type:"note",children:[(0,a.jsxs)(n.p,{children:["Always remember that if you can't find the ",(0,a.jsx)(n.code,{children:".athennarc.json"})," file\nin the root path of you project, it will be defined inside of your\n",(0,a.jsx)(n.code,{children:"package.json"})," in the ",(0,a.jsx)(n.code,{children:"athenna"})," property."]}),(0,a.jsxs)(n.p,{children:["For more information about the RC file, more details about each one\nof its options and also how to define your own properties inside of it\ncheck out the full ",(0,a.jsx)(n.a,{href:"/docs/getting-started/athennarc-file",children:"Athenna RC file documentation"}),"."]})]}),"\n",(0,a.jsx)(n.h2,{id:"next-steps",children:"Next steps"}),"\n",(0,a.jsx)(n.p,{children:"Now that you have created your Athenna project, you may be\nwondering what to learn next. First, we strongly recommend\nbecoming familiar with how Athenna works by reading the\nfollowing documentation:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/architecture-concepts/application-lifecycle",children:"Application lifecycle"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/getting-started/configuration",children:"Configuration"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/getting-started/directory-structure",children:"Directory structure"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/architecture-concepts/service-container",children:"Service container"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.a,{href:"/docs/architecture-concepts/facades",children:"Facades"})}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"How you want to use Athenna will also dictate the next steps\non your journey. Since Athenna has different kind of applications,\nthere are a variety of ways to use Athenna, and we'll explore\nthe available ones bellow."}),"\n",(0,a.jsx)(n.admonition,{type:"tip",children:(0,a.jsxs)(n.p,{children:["New to Athenna? Check out the ",(0,a.jsx)(n.a,{href:"https://www.youtube.com/@athennaio",children:"Athenna YouTube channel"}),"\nfor an infinity of hands-on videos!"]})}),"\n",(0,a.jsx)(n.h3,{id:"rest-api-application",children:"REST API application"}),"\n",(0,a.jsx)(n.p,{children:"Use the REST API Application to serve as an API backend to single page application\nor mobile apps. In this context you may use Athenna for data storage / retrieval\nfor your REST API, while also taking advantage of Athenna's powerful services such\nas database, emails, notifications, and more."}),"\n",(0,a.jsxs)(n.p,{children:["If this is how you plan to use Athenna, you may want to check out our documentation\non ",(0,a.jsx)(n.a,{href:"/docs/rest-api-application/routing",children:"routing"})," and the ",(0,a.jsx)(n.a,{href:"/docs/orm/getting-started",children:"ORM"}),"."]}),"\n",(0,a.jsx)(n.h3,{id:"command-line-interface-cli-application",children:"Command Line Interface (CLI) application"}),"\n",(0,a.jsxs)(n.p,{children:["Use the command line interface (CLI) application to create libraries like ",(0,a.jsx)(n.code,{children:"athenna"}),"\nfor NPM where other developers could install it in their terminal. In this context\nyou may use Athenna for automatting process or generating files, while also taking\nadvantage of all Athenna's powerful foundation."]}),"\n",(0,a.jsxs)(n.p,{children:["If this is how you plan to use Athenna, you may want to check out our documentation\non ",(0,a.jsx)(n.a,{href:"/docs/cli-application/commands",children:"commands"}),"."]}),"\n",(0,a.jsx)(n.h3,{id:"cron-job-application",children:"CRON Job application"}),"\n",(0,a.jsx)(n.p,{children:"Use the CRON Job application to create schedulers for running periodic jobs, such\nas for maintenance or calling third-party APIs to collect up-to-date data."}),"\n",(0,a.jsxs)(n.p,{children:["If this is how you plan to use Athenna, you may want to check out our documentation\non ",(0,a.jsx)(n.a,{href:"/docs/cron-application/schedulers",children:"schedulers"}),"."]})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},7049:(e,n,t)=>{t.d(n,{A:()=>o});t(6540);const a={hoverCardContainer:"hoverCardContainer_jqUQ",hoverCardLink:"hoverCardLink_oDZU",hoverCard:"hoverCard_qTDS"};var i=t(4848);function o(e){let n=e.father;switch(e.father){case"storage":n="src/storage";break;case"logs":n="src/storage/logs";break;case"views":n="src/resources/views";break;case"locales":n="src/resources/locales";break;case"static":n="src/resources/static";break;case"config":n="src/config";break;case"database":n="src/database";break;case"seeders":n="src/database/seeders";break;case"migrations":n="src/database/migrations";break;case"console":n="src/console";break;case"commands":n="src/console/commands";break;case"cron":n="src/cron";break;case"schedulers":n="src/cron/schedulers";break;case"models":n="src/models";break;case"services":n="src/services";break;case"repositories":n="src/repositories";break;case"http":n="src/http";break;case"controllers":n="src/http/controllers";break;case"middlewares":n="src/http/middlewares";break;case"interceptors":n="src/http/interceptors";break;case"terminators":n="src/http/terminators";break;case"stubs":n="tests/stubs";break;case"fixtures":n="tests/fixtures";break;case"providers":n="src/providers";break;case"facades":n="src/facades";break;case"routes":n="src/routes"}return(0,i.jsxs)("div",{className:a.hoverCardContainer,children:[(0,i.jsx)("a",{className:a.hoverCardLink,href:`/docs/the-basics/helpers#path${e.father}`,children:(0,i.jsxs)("code",{children:["Path.",e.father,"(",e.child?`'${e.child}'`:"",")"]})}),(0,i.jsx)("div",{className:a.hoverCard,children:(0,i.jsxs)("p",{style:{margin:0},children:["./",n,e.child?`/${e.child}`:""]})})]})}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>s});var a=t(6540);const i={},o=a.createContext(i);function r(e){const n=a.useContext(o);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/98b8cc29.41262bc9.js b/assets/js/98b8cc29.41262bc9.js
deleted file mode 100644
index 726cab29..00000000
--- a/assets/js/98b8cc29.41262bc9.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[6427],{6557:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>a,toc:()=>c});var t=r(4848),s=r(8453);const o={title:"AthennaRC File",sidebar_position:3,description:"Understand what is the purpose of the .athennarc.json file."},i="AthennaRC File",a={id:"getting-started/athennarc-file",title:"AthennaRC File",description:"Understand what is the purpose of the .athennarc.json file.",source:"@site/docs/getting-started/athennarc-file.mdx",sourceDirName:"getting-started",slug:"/getting-started/athennarc-file",permalink:"/docs/getting-started/athennarc-file",draft:!1,unlisted:!1,editUrl:"https://github.com/AthennaIO/Docs/tree/main/docs/getting-started/athennarc-file.mdx",tags:[],version:"current",sidebarPosition:3,frontMatter:{title:"AthennaRC File",sidebar_position:3,description:"Understand what is the purpose of the .athennarc.json file."},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/getting-started/installation"},next:{title:"Configuration",permalink:"/docs/getting-started/configuration"}},d={},c=[{value:"Introduction",id:"introduction",level:2},{value:"RC file vs Configurations",id:"rc-file-vs-configurations",level:2},{value:"Custom RC file path",id:"custom-rc-file-path",level:2},{value:"Using RC file in package.json
",id:"using-rc-file-in-packagejson",level:2},{value:"The preloads
property",id:"the-preloads-property",level:2},{value:"The providers
property",id:"the-providers-property",level:2},{value:"The services
property",id:"the-services-property",level:2},{value:"The commands
property",id:"the-commands-property",level:2},{value:"The templates
property",id:"the-templates-property",level:2},{value:"The directories
property",id:"the-directories-property",level:2},{value:"The controllers
property",id:"the-controllers-property",level:2},{value:"The middlewares
property",id:"the-middlewares-property",level:2},{value:"The namedMiddlewares
property",id:"the-namedmiddlewares-property",level:2},{value:"The globalMiddlewares
property",id:"the-globalmiddlewares-property",level:2},{value:"The artisan
property",id:"the-artisan-property",level:2}];function l(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"athennarc-file",children:"AthennaRC File"})}),"\n",(0,t.jsx)(n.p,{children:"Understand what is the purpose of the .athennarc.json file."}),"\n",(0,t.jsx)(n.h2,{id:"introduction",children:"Introduction"}),"\n",(0,t.jsxs)(n.p,{children:["Inside the root directory of your project, there is a file\ncalled ",(0,t.jsx)(n.code,{children:".athennarc.json"})," which is responsible for configuring\nthe workspace and certain runtime settings of your Athenna\napplication."]}),"\n",(0,t.jsx)(n.h2,{id:"rc-file-vs-configurations",children:"RC file vs Configurations"}),"\n",(0,t.jsxs)(n.p,{children:["The responsible for the RC file is configuring the workspace\nand certain runtime settings to bootstrap your Athenna\napplication properly. Also, when working with ",(0,t.jsx)(n.code,{children:".json"})," files is\nvery easy to manipulate the values of it, making it possible\nto make changes on the file in runtime. Let's see an example\nwhere Athenna manipulates your RC file:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"node artisan make:service UserService\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Athenna will create the service file in your project but\nalso register it inside your ",(0,t.jsx)(n.code,{children:".athennarc.json"})," file:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "services": [\n "#src/services/UserService"\n ]\n}\n'})}),"\n",(0,t.jsx)(n.h2,{id:"custom-rc-file-path",children:"Custom RC file path"}),"\n",(0,t.jsxs)(n.p,{children:["You can change the name and the path of your RC file or even\ncreate customized ones for each environement (",(0,t.jsx)(n.code,{children:".athennarc.dev.json"}),",\n",(0,t.jsx)(n.code,{children:".athennarc.prod.json"}),"). To do that you need to set the new\npath to ",(0,t.jsx)(n.code,{children:"Ignite::load()"})," static method:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",metastring:"title=\"Path.bin('dev.ts')\"",children:"import { Ignite } from '@athenna/core'\n\nconst ignite = await new Ignite().load(import.meta.url, {\n athennaRcPath: './bin/athennadevrc.json' \ud83d\udc48\n})\n\nawait ignite.httpServer()\n"})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"Always remember that when using relative paths to set something\nin Athenna, you need to use your project root path as reference,\njust like in the example above."})}),"\n",(0,t.jsxs)(n.h2,{id:"using-rc-file-in-packagejson",children:["Using RC file in ",(0,t.jsx)(n.code,{children:"package.json"})]}),"\n",(0,t.jsxs)(n.p,{children:["You can also use the RC file inside ",(0,t.jsx)(n.code,{children:"package.json"}),". By default,\nIf you don't specify the path of your RC file, and the default\n",(0,t.jsx)(n.code,{children:".athennarc.json"})," cannot be found in the root path of your application,\nAthenna will check if the ",(0,t.jsx)(n.code,{children:"athenna"})," property exists in your ",(0,t.jsx)(n.code,{children:"package.json"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title="package.json"',children:'{\n "athenna": {\n "providers": [\n "@athenna/core/providers/CoreProvider",\n "@athenna/http/providers/HttpRouteProvider",\n "@athenna/http/providers/HttpServerProvider"\n ],\n "directories": {\n "bin": "bootstrap"\n }\n }\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-preloads-property",children:["The ",(0,t.jsx)(n.code,{children:"preloads"})," property"]}),"\n",(0,t.jsx)(n.p,{children:"An array of files that will be loaded when your application\nis bootstrapping. The files are loaded after booting the\nservice providers. You can do anything you want in preload\nfiles. Check the example bellow:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",metastring:'title="say-hello.ts"',children:"import { Log } from '@athenna/logger'\nimport { Config } from '@athenna/core'\n\nLog.info(`Hello from ${Config.get('app.name')} application!`)\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "preloads": [\n "./bin/preloads/say-hello.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-providers-property",children:["The ",(0,t.jsx)(n.code,{children:"providers"})," property"]}),"\n",(0,t.jsx)(n.p,{children:"An array of service providers to load when the application\nis bootstrapping:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "providers": [\n "@athenna/core/providers/CoreProvider",\n "@athenna/http/providers/HttpRouteProvider",\n "@athenna/http/providers/HttpServerProvider"\n ]\n}\n'})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["More information about service providers could be found at\n",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/the-basics/http/controllers",children:"service providers documentation section"}),"."]})}),"\n",(0,t.jsxs)(n.h2,{id:"the-services-property",children:["The ",(0,t.jsx)(n.code,{children:"services"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["This property is responsible to register your application\nservices or from some library inside the service container.\nIn most cases, it is better to simply instantiate your services,\nbut in others you might have different implementations for\nsome interface, using ",(0,t.jsx)(n.a,{href:"https://www.educative.io/answers/what-is-inversion-of-control",children:"inversion of control"}),"\nin these cases could be an exceptional idea to register your\nservices in the container:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "services": [\n "#src/services/AppService",\n "./src/services/OtherService.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-commands-property",children:["The ",(0,t.jsx)(n.code,{children:"commands"})," property"]}),"\n",(0,t.jsx)(n.p,{children:'An object that is responsible to register your application\ncommands and their respective settings. The key of the\ncommands object needs to be exactly your command signature\nwithout any arguments, flags or spaces. Also, the value\nof it could be the command path or an object with the\n"path" key inside:'}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "commands": {\n "make:exception": "@athenna/core/commands/MakeExceptionCommand",\n "make:facade": {\n "path": "@athenna/core/commands/MakeFacadeCommand",\n "env": "local",\n "destination": "./src/providers/facades",\n "loadApp": false,\n "stayAlive": false,\n "loadAllCommands": false,\n "environments": ["console"]\n }\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Depending on the command you are running, it got their\nown configurations. Commands like ",(0,t.jsx)(n.code,{children:"make:..."})," for example,\nreads the ",(0,t.jsx)(n.code,{children:"destination"})," property to the file generated\nfor a different path from it default."]}),"\n",(0,t.jsx)(n.p,{children:"There are properties that you can define whatever your\ncommand. Let's see who they are and what they do:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"path"})})," - Defines the path to your command, this field is mandatory\nif you are using an object to define your command."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"loadApp"})})," - If ",(0,t.jsx)(n.code,{children:"true"}),", the ",(0,t.jsx)(n.code,{children:"Ignite.fire()"})," method will be called\nuntil running your command. The ",(0,t.jsx)(n.code,{children:"Ignite.fire()"})," method is responsible\nto load your env file and configuration files and also boot your\nservice providers."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"env"})})," - Defines which env file will be used to run your command.\nThis field is not required and it will only be relevant when the\n",(0,t.jsx)(n.code,{children:"loadApp"})," property is ",(0,t.jsx)(n.code,{children:"true"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"stayAlive"})})," - If ",(0,t.jsx)(n.code,{children:"true"}),", your command will stay running until the\nevent loop is not in use anymore. Very useful for keep running\nbackground tasks from commands."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"loadAllCommands"})})," - If ",(0,t.jsx)(n.code,{children:"true"}),", all the commands inside the ",(0,t.jsx)(n.code,{children:"commands"}),"\nproperty will be loaded. Useful when you command needs to call other command\nprogrammatically."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"environments"})})," - Only relevant when ",(0,t.jsx)(n.code,{children:"loadApp"})," is ",(0,t.jsx)(n.code,{children:"true"}),". The environments\nset will be used as parameter for ",(0,t.jsx)(n.code,{children:"Ignite.fire()"})," method and will help\nAthenna to select the service providers that should or shouldn't be booted."]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["More information about commands could be found at\n",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/the-basics/cli/commands",children:"cli commands documentation section"}),"."]})}),"\n",(0,t.jsxs)(n.h2,{id:"the-templates-property",children:["The ",(0,t.jsx)(n.code,{children:"templates"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["Map your application commands templates with their respective\npath. The templates mapped in this object will be used by your\n",(0,t.jsx)(n.code,{children:"make"})," commands to generate the resource with some specific\ncode template:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "templates": {\n "exception": "node_modules/@athenna/core/templates/exception.edge",\n "facade": "node_modules/@athenna/core/templates/facade.edge"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-directories-property",children:["The ",(0,t.jsx)(n.code,{children:"directories"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["Map your application directories with their respective\nbase path. The ",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,t.jsx)(n.code,{children:"Path"})}),"\nclass will use the directories mapped in this object to\nresolve the paths of your application:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "directories": {\n "bin": "bin",\n "src": "src",\n "app": "app",\n "bootstrap": "bootstrap",\n "public": "public",\n "static": "public/static",\n "assets": "public/assets",\n "nodeModules": "node_modules",\n "nodeModulesBin": "node_modules/.bin",\n "tests": "tests",\n "stubs": "tests/stubs",\n "fixtures": "tests/fixtures",\n "models": "src/models",\n "services": "src/services",\n "jobs": "src/jobs",\n "workers": "src/workers",\n "exceptions": "src/exceptions",\n "repositories": "src/repositories",\n "console": "src/console",\n "commands": "src/console/commands",\n "http": "src/http",\n "guards": "src/http/guards",\n "controllers": "src/http/controllers",\n "middlewares": "src/http/middlewares",\n "interceptors": "src/http/interceptors",\n "terminators": "src/http/terminators",\n "validators": "src/validators",\n "cron": "src/cron",\n "schedulers": "src/cron/schedulers",\n "config": "src/config",\n "database": "src/database",\n "seeders": "src/database/seeders",\n "migrations": "src/database/migrations",\n "lang": "src/lang",\n "resources": "src/resources",\n "views": "src/resources/views",\n "locales": "src/resources/locales", \n "providers": "src/providers",\n "facades": "src/facades", \n "routes": "src/routes",\n "storage": "src/storage",\n "logs": "src/storage/logs"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["The paths above are the default ones used by Athenna to resolve\nyour application paths. You can change one of them or many\nif you want, your directories defined in ",(0,t.jsx)(n.code,{children:"directories"})," property\nwill always be merged with the defaults."]}),"\n",(0,t.jsxs)(n.p,{children:["Athenna always rely on ",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,t.jsx)(n.code,{children:"Path"})}),"\nclass methods to find files and directories that are used\ninternally by the framework, like configuration file, route\nfiles, entry points and many others. Changing the ",(0,t.jsx)(n.code,{children:"directories"})," property\ncould be very useful when you are building your own project structure."]}),"\n",(0,t.jsxs)(n.h2,{id:"the-controllers-property",children:["The ",(0,t.jsx)(n.code,{children:"controllers"})," property"]}),"\n",(0,t.jsx)(n.p,{children:"An array with the controllers of your application. The\ncontrollers registered in this array will be registered\nin the service container to be accessed easily by your\nRoute facade:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "controllers": [\n "#src/http/controllers/AppController",\n "./src/http/controllers/OtherController.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-middlewares-property",children:["The ",(0,t.jsx)(n.code,{children:"middlewares"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["An array with the middlewares of your application. The\nmiddlewares registered in this array will be registered\nin the service container to be accessed easily by your\n",(0,t.jsx)(n.code,{children:"Route"})," facade:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "middlewares": [\n "#src/http/middlewares/AppMiddleware",\n "./src/http/interceptors/AppInterceptor.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Athenna expects that the middlewares set in this property\nto be annotated with ",(0,t.jsx)(n.code,{children:"@Middleware()"}),", ",(0,t.jsx)(n.code,{children:"@Interceptor()"})," or ",(0,t.jsx)(n.code,{children:"@Terminator()"}),"\nannotations, this is not mandatory, but you will only\nbe able to set the name of the middleware or if it is global or not using\nthe annotations."]}),"\n",(0,t.jsxs)(n.p,{children:["If you are not using TypeScript in your application, you can use the\n",(0,t.jsx)(n.a,{href:"/docs/getting-started/athennarc-file#the-namedmiddlewares-property",children:(0,t.jsx)(n.code,{children:"namedMiddlewares"})}),"\nproperty to register named middlewares and the\n",(0,t.jsx)(n.a,{href:"/docs/getting-started/athennarc-file#the-globalmiddlewares-property",children:(0,t.jsx)(n.code,{children:"globalMiddlewares"})}),"\nproperty to register global middlewares."]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["More information about middlewares could be found at\n",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/rest-api-application/middlewares",children:"http middlewares documentation section"}),"."]})}),"\n",(0,t.jsxs)(n.h2,{id:"the-namedmiddlewares-property",children:["The ",(0,t.jsx)(n.code,{children:"namedMiddlewares"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["Map the named middlewares of your application. Named\nmiddlewares could be configured using the ",(0,t.jsx)(n.code,{children:"@Middleware"}),"\nannotation, but if you are not using TypeScript in your\napplication, you can use this object to map your named\nmiddlewares. Named middlewares are very useful to be used\nin your route declaration:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "namedMiddlewares": {\n "app": "#src/http/middlewares/AppMiddleware",\n "intercept": "./src/http/interceptors/AppInterceptor.js"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-globalmiddlewares-property",children:["The ",(0,t.jsx)(n.code,{children:"globalMiddlewares"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["An array with the global middlewares of your application.\nGlobal middlewares could be configured using the ",(0,t.jsx)(n.code,{children:"@Middleware"}),"\nannotation, but if you are not using TypeScript in your\napplication, you can use this object to map your named\nmiddlewares. Global middlewares are executed every time\nin any request of your application:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "globalMiddlewares": [\n "#src/http/middlewares/AppMiddleware",\n "./src/http/interceptors/AppInterceptor.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"the-artisan-property",children:["The ",(0,t.jsx)(n.code,{children:"artisan"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["An object with a variety of Artisan configurations.\nAt this point the only configurations accepted are ",(0,t.jsx)(n.code,{children:"artisan.child.executor"}),"\nand ",(0,t.jsx)(n.code,{children:"artisan.child.path"}),". Both configurations are used to define\nhow the ",(0,t.jsx)(n.code,{children:"Artisan.callInChild()"})," method will behave when no options\nare set to it as second argument:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "artisan": {\n "child": {\n "executor": "node --inspect",\n "path": "./bin/artisan.ts"\n }\n }\n}\n'})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["Athenna will automatically parse the ",(0,t.jsx)(n.code,{children:"artisan.child.path"})," using\nthe ",(0,t.jsx)(n.code,{children:"Path.ext()"})," method, so you don't need to worry about if the\nextension is ",(0,t.jsx)(n.code,{children:".js"})," or ",(0,t.jsx)(n.code,{children:".ts"}),"."]})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>a});var t=r(6540);const s={},o=t.createContext(s);function i(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/98b8cc29.6c61093b.js b/assets/js/98b8cc29.6c61093b.js
new file mode 100644
index 00000000..a48e2b7f
--- /dev/null
+++ b/assets/js/98b8cc29.6c61093b.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_athenna_docs=self.webpackChunk_athenna_docs||[]).push([[6427],{6557:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>a,toc:()=>c});var t=r(4848),s=r(8453);const o={title:"Athenna RC File",sidebar_position:3,description:"Understand what is the purpose of the .athennarc.json file."},i="Athenna RC File",a={id:"getting-started/athennarc-file",title:"Athenna RC File",description:"Understand what is the purpose of the .athennarc.json file.",source:"@site/docs/getting-started/athennarc-file.mdx",sourceDirName:"getting-started",slug:"/getting-started/athennarc-file",permalink:"/docs/getting-started/athennarc-file",draft:!1,unlisted:!1,editUrl:"https://github.com/AthennaIO/Docs/tree/main/docs/getting-started/athennarc-file.mdx",tags:[],version:"current",sidebarPosition:3,frontMatter:{title:"Athenna RC File",sidebar_position:3,description:"Understand what is the purpose of the .athennarc.json file."},sidebar:"tutorialSidebar",previous:{title:"Installation",permalink:"/docs/getting-started/installation"},next:{title:"Configuration",permalink:"/docs/getting-started/configuration"}},d={},c=[{value:"Introduction",id:"introduction",level:2},{value:"RC file vs Configurations",id:"rc-file-vs-configurations",level:2},{value:"Custom RC file path",id:"custom-rc-file-path",level:2},{value:"Using RC file in package.json
",id:"using-rc-file-in-packagejson",level:2},{value:"RC File properties",id:"rc-file-properties",level:2},{value:"The preloads
property",id:"the-preloads-property",level:3},{value:"The providers
property",id:"the-providers-property",level:3},{value:"The services
property",id:"the-services-property",level:3},{value:"The commands
property",id:"the-commands-property",level:3},{value:"The templates
property",id:"the-templates-property",level:3},{value:"The directories
property",id:"the-directories-property",level:3},{value:"The controllers
property",id:"the-controllers-property",level:3},{value:"The middlewares
property",id:"the-middlewares-property",level:3},{value:"The namedMiddlewares
property",id:"the-namedmiddlewares-property",level:3},{value:"The globalMiddlewares
property",id:"the-globalmiddlewares-property",level:3},{value:"The artisan
property",id:"the-artisan-property",level:3}];function l(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"athenna-rc-file",children:"Athenna RC File"})}),"\n",(0,t.jsx)(n.p,{children:"Understand what is the purpose of the .athennarc.json file."}),"\n",(0,t.jsx)(n.h2,{id:"introduction",children:"Introduction"}),"\n",(0,t.jsxs)(n.p,{children:["Inside the root directory of your project, there is a file\ncalled ",(0,t.jsx)(n.code,{children:".athennarc.json"})," which is responsible for configuring\nthe workspace and certain runtime settings of your Athenna\napplication."]}),"\n",(0,t.jsx)(n.h2,{id:"rc-file-vs-configurations",children:"RC file vs Configurations"}),"\n",(0,t.jsxs)(n.p,{children:["The responsible of the ",(0,t.jsx)(n.code,{children:".athennarc.json"})," is configuring the workspace\nand certain runtime settings to bootstrap your Athenna\napplication properly. Also, when working with ",(0,t.jsx)(n.code,{children:".json"})," files is\nvery easy to manipulate the values of it, making it possible\nto make changes on the file in runtime. Let's see an example\nwhere Athenna manipulates your ",(0,t.jsx)(n.code,{children:".athennarc.json"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"node artisan make:service UserService\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Athenna will create the service file in your project but\nalso register it inside your ",(0,t.jsx)(n.code,{children:".athennarc.json"})," file:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "services": [\n "#src/services/UserService"\n ]\n}\n'})}),"\n",(0,t.jsx)(n.h2,{id:"custom-rc-file-path",children:"Custom RC file path"}),"\n",(0,t.jsxs)(n.p,{children:["You can change the name and the path of your RC file or even\ncreate customized ones for each environment (",(0,t.jsx)(n.code,{children:".athennarc.dev.json"}),",\n",(0,t.jsx)(n.code,{children:".athennarc.prod.json"}),"). To do that you need to set the new\npath to ",(0,t.jsx)(n.code,{children:"Ignite::load()"})," static method:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",metastring:"title=\"Path.bin('dev.ts')\"",children:"import { Ignite } from '@athenna/core'\n\nconst ignite = await new Ignite().load(import.meta.url, {\n athennaRcPath: './bin/athennadevrc.json' \ud83d\udc48\n})\n\nawait ignite.httpServer()\n"})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"Always remember that when using relative paths to set something\nin Athenna, you need to use your project root path as reference,\njust like in the example above."})}),"\n",(0,t.jsxs)(n.h2,{id:"using-rc-file-in-packagejson",children:["Using RC file in ",(0,t.jsx)(n.code,{children:"package.json"})]}),"\n",(0,t.jsxs)(n.p,{children:["You can also use the RC file inside ",(0,t.jsx)(n.code,{children:"package.json"}),". By default,\nIf you don't specify the path of your RC file, and the default\n",(0,t.jsx)(n.code,{children:".athennarc.json"})," cannot be found in the root path of your application,\nAthenna will check if the ",(0,t.jsx)(n.code,{children:"athenna"})," property exists in your ",(0,t.jsx)(n.code,{children:"package.json"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title="package.json"',children:'{\n "athenna": {\n "providers": [\n "@athenna/core/providers/CoreProvider",\n "@athenna/http/providers/HttpRouteProvider",\n "@athenna/http/providers/HttpServerProvider"\n ],\n "directories": {\n "bin": "bootstrap"\n }\n }\n}\n'})}),"\n",(0,t.jsx)(n.h2,{id:"rc-file-properties",children:"RC File properties"}),"\n",(0,t.jsxs)(n.p,{children:["Let's cover all of the ",(0,t.jsx)(n.code,{children:".athennarc.json"})," file properties and\nunderstand how to use each one of them:"]}),"\n",(0,t.jsxs)(n.h3,{id:"the-preloads-property",children:["The ",(0,t.jsx)(n.code,{children:"preloads"})," property"]}),"\n",(0,t.jsx)(n.p,{children:"An array of files that will be loaded when your application\nis bootstrapping. The files are loaded after booting the\nservice providers. You can do anything you want in preload\nfiles. Check the example bellow:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",metastring:'title="say-hello.ts"',children:"import { Log } from '@athenna/logger'\nimport { Config } from '@athenna/core'\n\nLog.info(`Hello from ${Config.get('app.name')} application!`)\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "preloads": [\n "./bin/preloads/say-hello.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"the-providers-property",children:["The ",(0,t.jsx)(n.code,{children:"providers"})," property"]}),"\n",(0,t.jsx)(n.p,{children:"An array of service providers to load when the application\nis bootstrapping:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "providers": [\n "@athenna/core/providers/CoreProvider",\n "@athenna/http/providers/HttpRouteProvider",\n "@athenna/http/providers/HttpServerProvider"\n ]\n}\n'})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["More information about service providers could be found at\n",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/the-basics/http/controllers",children:"service providers documentation section"}),"."]})}),"\n",(0,t.jsxs)(n.h3,{id:"the-services-property",children:["The ",(0,t.jsx)(n.code,{children:"services"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["This property is responsible to register your application\nservices or from some library inside the service container.\nIn most cases, it is better to simply instantiate your services,\nbut in others you might have different implementations for\nsome interface, using ",(0,t.jsx)(n.a,{href:"https://www.educative.io/answers/what-is-inversion-of-control",children:"inversion of control"}),"\nin these cases could be an exceptional idea to register your\nservices in the container:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "services": [\n "#src/services/AppService",\n "./src/services/OtherService.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"the-commands-property",children:["The ",(0,t.jsx)(n.code,{children:"commands"})," property"]}),"\n",(0,t.jsx)(n.p,{children:'An object that is responsible to register your application\ncommands and their respective settings. The key of the\ncommands object needs to be exactly your command signature\nwithout any arguments, flags or spaces. Also, the value\nof it could be the command path or an object with the\n"path" key inside:'}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "commands": {\n "make:exception": "@athenna/core/commands/MakeExceptionCommand",\n "make:facade": {\n "path": "@athenna/core/commands/MakeFacadeCommand",\n "env": "local",\n "destination": "./src/providers/facades",\n "loadApp": false,\n "stayAlive": false,\n "loadAllCommands": false,\n "environments": ["console"]\n }\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Depending on the command you are running, it got their\nown configurations. Commands like ",(0,t.jsx)(n.code,{children:"make:..."})," for example,\nreads the ",(0,t.jsx)(n.code,{children:"destination"})," property to the file generated\nfor a different path from it default."]}),"\n",(0,t.jsx)(n.p,{children:"There are properties that you can define whatever your\ncommand. Let's see who they are and what they do:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"path"})})," - Defines the path to your command, this field is mandatory\nif you are using an object to define your command."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"loadApp"})})," - If ",(0,t.jsx)(n.code,{children:"true"}),", the ",(0,t.jsx)(n.code,{children:"Ignite.fire()"})," method will be called\nuntil running your command. The ",(0,t.jsx)(n.code,{children:"Ignite.fire()"})," method is responsible\nto load your env file and configuration files and also boot your\nservice providers."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"env"})})," - Defines which env file will be used to run your command.\nThis field is not required and it will only be relevant when the\n",(0,t.jsx)(n.code,{children:"loadApp"})," property is ",(0,t.jsx)(n.code,{children:"true"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"stayAlive"})})," - If ",(0,t.jsx)(n.code,{children:"true"}),", your command will stay running until the\nevent loop is not in use anymore. Very useful for keep running\nbackground tasks from commands."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"loadAllCommands"})})," - If ",(0,t.jsx)(n.code,{children:"true"}),", all the commands inside the ",(0,t.jsx)(n.code,{children:"commands"}),"\nproperty will be loaded. Useful when you command needs to call other command\nprogrammatically."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"environments"})})," - Only relevant when ",(0,t.jsx)(n.code,{children:"loadApp"})," is ",(0,t.jsx)(n.code,{children:"true"}),". The environments\nset will be used as parameter for ",(0,t.jsx)(n.code,{children:"Ignite.fire()"})," method and will help\nAthenna to select the service providers that should or shouldn't be booted."]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["More information about commands could be found at\n",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/the-basics/cli/commands",children:"cli commands documentation section"}),"."]})}),"\n",(0,t.jsxs)(n.h3,{id:"the-templates-property",children:["The ",(0,t.jsx)(n.code,{children:"templates"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["Map your application commands templates with their respective\npath. The templates mapped in this object will be used by your\n",(0,t.jsx)(n.code,{children:"make"})," commands to generate the resource with some specific\ncode template:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "templates": {\n "exception": "node_modules/@athenna/core/templates/exception.edge",\n "facade": "node_modules/@athenna/core/templates/facade.edge"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"the-directories-property",children:["The ",(0,t.jsx)(n.code,{children:"directories"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["Map your application directories with their respective\nbase path. The ",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,t.jsx)(n.code,{children:"Path"})}),"\nclass will use the directories mapped in this object to\nresolve the paths of your application:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "directories": {\n "bin": "bin",\n "src": "src",\n "app": "app",\n "bootstrap": "bootstrap",\n "public": "public",\n "static": "public/static",\n "assets": "public/assets",\n "nodeModules": "node_modules",\n "nodeModulesBin": "node_modules/.bin",\n "tests": "tests",\n "stubs": "tests/stubs",\n "fixtures": "tests/fixtures",\n "models": "src/models",\n "services": "src/services",\n "jobs": "src/jobs",\n "workers": "src/workers",\n "exceptions": "src/exceptions",\n "repositories": "src/repositories",\n "console": "src/console",\n "commands": "src/console/commands",\n "http": "src/http",\n "guards": "src/http/guards",\n "controllers": "src/http/controllers",\n "middlewares": "src/http/middlewares",\n "interceptors": "src/http/interceptors",\n "terminators": "src/http/terminators",\n "validators": "src/validators",\n "cron": "src/cron",\n "schedulers": "src/cron/schedulers",\n "config": "src/config",\n "database": "src/database",\n "seeders": "src/database/seeders",\n "migrations": "src/database/migrations",\n "lang": "src/lang",\n "resources": "src/resources",\n "views": "src/resources/views",\n "locales": "src/resources/locales", \n "providers": "src/providers",\n "facades": "src/facades", \n "routes": "src/routes",\n "storage": "src/storage",\n "logs": "src/storage/logs"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["The paths above are the default ones used by Athenna to resolve\nyour application paths. You can change one of them or many\nif you want, your directories defined in ",(0,t.jsx)(n.code,{children:"directories"})," property\nwill always be merged with the defaults."]}),"\n",(0,t.jsxs)(n.p,{children:["Athenna always rely on ",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/digging-deeper/helpers#path",children:(0,t.jsx)(n.code,{children:"Path"})}),"\nclass methods to find files and directories that are used\ninternally by the framework, like configuration file, route\nfiles, entry points and many others. Changing the ",(0,t.jsx)(n.code,{children:"directories"})," property\ncould be very useful when you are building your own project structure."]}),"\n",(0,t.jsxs)(n.h3,{id:"the-controllers-property",children:["The ",(0,t.jsx)(n.code,{children:"controllers"})," property"]}),"\n",(0,t.jsx)(n.p,{children:"An array with the controllers of your application. The\ncontrollers registered in this array will be registered\nin the service container to be accessed easily by your\nRoute facade:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "controllers": [\n "#src/http/controllers/AppController",\n "./src/http/controllers/OtherController.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"the-middlewares-property",children:["The ",(0,t.jsx)(n.code,{children:"middlewares"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["An array with the middlewares of your application. The\nmiddlewares registered in this array will be registered\nin the service container to be accessed easily by your\n",(0,t.jsx)(n.code,{children:"Route"})," facade:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "middlewares": [\n "#src/http/middlewares/AppMiddleware",\n "./src/http/interceptors/AppInterceptor.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Athenna expects that the middlewares set in this property\nto be annotated with ",(0,t.jsx)(n.code,{children:"@Middleware()"}),", ",(0,t.jsx)(n.code,{children:"@Interceptor()"})," or ",(0,t.jsx)(n.code,{children:"@Terminator()"}),"\nannotations, this is not mandatory, but you will only\nbe able to set the name of the middleware or if it is global or not using\nthe annotations."]}),"\n",(0,t.jsxs)(n.p,{children:["If you are not using TypeScript in your application, you can use the\n",(0,t.jsx)(n.a,{href:"/docs/getting-started/athennarc-file#the-namedmiddlewares-property",children:(0,t.jsx)(n.code,{children:"namedMiddlewares"})}),"\nproperty to register named middlewares and the\n",(0,t.jsx)(n.a,{href:"/docs/getting-started/athennarc-file#the-globalmiddlewares-property",children:(0,t.jsx)(n.code,{children:"globalMiddlewares"})}),"\nproperty to register global middlewares."]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["More information about middlewares could be found at\n",(0,t.jsx)(n.a,{href:"https://athenna.io/docs/rest-api-application/middlewares",children:"http middlewares documentation section"}),"."]})}),"\n",(0,t.jsxs)(n.h3,{id:"the-namedmiddlewares-property",children:["The ",(0,t.jsx)(n.code,{children:"namedMiddlewares"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["Map the named middlewares of your application. Named\nmiddlewares could be configured using the ",(0,t.jsx)(n.code,{children:"@Middleware()"}),"\nannotation, but if you are not using TypeScript in your\napplication, you can use this object to map your named\nmiddlewares. Named middlewares are very useful to be used\nin your route declaration:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "namedMiddlewares": {\n "app": "#src/http/middlewares/AppMiddleware",\n "intercept": "./src/http/interceptors/AppInterceptor.js"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"the-globalmiddlewares-property",children:["The ",(0,t.jsx)(n.code,{children:"globalMiddlewares"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["An array with the global middlewares of your application.\nGlobal middlewares could be configured using the ",(0,t.jsx)(n.code,{children:"@Middleware()"}),"\nannotation, but if you are not using TypeScript in your\napplication, you can use this object to map your named\nmiddlewares. Global middlewares are executed every time\nin any request of your application:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "globalMiddlewares": [\n "#src/http/middlewares/AppMiddleware",\n "./src/http/interceptors/AppInterceptor.js"\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.h3,{id:"the-artisan-property",children:["The ",(0,t.jsx)(n.code,{children:"artisan"})," property"]}),"\n",(0,t.jsxs)(n.p,{children:["An object with a variety of Artisan configurations.\nAt this point the only configurations accepted are ",(0,t.jsx)(n.code,{children:"artisan.child.executor"}),"\nand ",(0,t.jsx)(n.code,{children:"artisan.child.path"}),". Both configurations are used to define\nhow the ",(0,t.jsx)(n.code,{children:"Artisan.callInChild()"})," method will behave when no options\nare set to it as second argument:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title=".athennarc.json"',children:'{\n "artisan": {\n "child": {\n "executor": "node --inspect",\n "path": "./bin/artisan.ts"\n }\n }\n}\n'})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["Athenna will automatically parse the ",(0,t.jsx)(n.code,{children:"artisan.child.path"})," using\nthe ",(0,t.jsx)(n.code,{children:"Path.ext()"})," method, so you don't need to worry about if the\nextension is ",(0,t.jsx)(n.code,{children:".js"})," or ",(0,t.jsx)(n.code,{children:".ts"}),"."]})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>a});var t=r(6540);const s={},o=t.createContext(s);function i(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/runtime~main.2bb103db.js b/assets/js/runtime~main.e4720fcb.js
similarity index 97%
rename from assets/js/runtime~main.2bb103db.js
rename to assets/js/runtime~main.e4720fcb.js
index 266ccd48..fa77170f 100644
--- a/assets/js/runtime~main.2bb103db.js
+++ b/assets/js/runtime~main.e4720fcb.js
@@ -1 +1 @@
-(()=>{"use strict";var e,a,c,r,d,f={},t={};function b(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={exports:{}};return f[e].call(c.exports,c,c.exports,b),c.exports}b.m=f,e=[],b.O=(a,c,r,d)=>{if(!c){var f=1/0;for(n=0;n