{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1894,"path":"application-development/building-applications-source-code.md","title":"Building applications in source code","bundle":null,"doc_type":null,"release":"australia","body":"\n# Building applications in source code\n\nCreate and develop custom applications in source code using familiar development tools and processes.\n\n## Overview of development in source code\n\nYou can create applications in code using the ServiceNow IDE on the ServiceNow AI Platform or locally in Visual Studio Code Desktop with the ServiceNow SDK.\n\nIn either development environment, you use ServiceNow Fluent, a domain-specific programming language, to define the metadata that makes up applications. ServiceNow Fluent includes APIs for defining the different types of metadata.\n\nWith the ServiceNow IDE or ServiceNow SDK, you can also create JavaScript modules and use third-party libraries in your application to optimize code reuse in scripts within an application scope.\n\nDeveloping and maintaining applications in source code enables you to work in familiar development environments, create and modify complex applications, manage code in source control more easily, and catch errors at build time.\n\n<table id=\"table_hmf_wtt_3bc\" class=\"nav-card\"><tbody><tr><td>\n\n[ServiceNow IDE\\[Omitted image \"servicenow-ide-logo.png\"\\] Alt text:Develop applications in code in an IDE on the ServiceNow AI Platform.](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-ide-family-release/servicenow-ide-landing.md)\n\n</td><td>\n\n[ServiceNow SDK\\[Omitted image \"servicenow-sdk-logo.png\"\\] Alt text:Develop applications in code locally and upload changes to an instance.](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/servicenow-sdk-landing.md)\n\n</td></tr></tbody>\n</table>## Comparison of the ServiceNow IDE and the ServiceNow SDK\n\n<table id=\"table_tqv_dfc_jbc\"><thead><tr><th>\n\nFeature\n\n</th><th>\n\nServiceNow IDE\n\n</th><th>\n\nServiceNow SDK\n\n</th></tr></thead><tbody><tr><td>\n\nDevelopment environment\n\n</td><td>\n\nOnline ServiceNow instance\n\n</td><td>\n\nLocal development and the ability to work offline\n\n</td></tr><tr><td>\n\nUser interface\n\n</td><td>\n\nIDE based on Visual Studio Code for the Web\n\n</td><td>\n\nVisual Studio Code Desktop\n\n</td></tr><tr><td>\n\nCollaboration\n\n</td><td>\n\nView any user's changes in real time in code or embedded ServiceNow AI Platform user interfaces.Collaborate with other developers on applications in source control.\n\n</td><td>\n\nDownload changes from an instance and install local changes to an instance using the ServiceNow SDK CLI to collaborate with other users. Collaborate with other developers on applications in source control.\n\n</td></tr><tr><td>\n\nSource control\n\n</td><td>\n\nSupports the most common Git functionality and integrating with a Git provider of your choice.One concurrent branch per repository per instance\\(or developer sandbox\\).\n\n</td><td>\n\nFull support\n\n</td></tr><tr><td>\n\nApplication conversion\n\n</td><td>\n\nSupport for converting existing applications not created with the ServiceNow IDE or ServiceNow SDK.\n\n</td><td>\n\nSupport for converting existing applications not created with the ServiceNow IDE or ServiceNow SDK.\n\n</td></tr><tr><td>\n\nServiceNow Fluent\n\n</td><td>\n\nFull supportThe ServiceNow Fluent Language server is included with the ServiceNow IDE.\n\n</td><td>\n\nFull supportThe ServiceNow Fluent Language server can be installed from the Visual Studio Code Extension Marketplace.\n\n</td></tr><tr><td>\n\nJavaScript modules and third-party libraries\n\n</td><td>\n\nFull support\n\n</td><td>\n\nFull support\n\n</td></tr><tr><td>\n\nServiceNow Otto for Code\n\n</td><td>\n\nCode auto-complete support for scripts.For information about activation, see [ServiceNow Otto for Code](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/scripts/now-assist-code-landing.md).\n\n</td><td>\n\nNot supported\n\n</td></tr><tr><td>\n\nBuild Agent\n\n</td><td>\n\nFull support. Build Agent is accessed from a chat panel in the ServiceNow IDE.For information about activation, see [Build Agent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/build-agent.md).\n\n</td><td>\n\nBuild Agent skills are available beginning with ServiceNow SDK version 4.6.0.\n\n</td></tr></tbody>\n</table>## Application structure\n\nApplications created or converted with the ServiceNow IDE or ServiceNow SDK include source code files and metadata XML files. The `package.json` and `now.config.json` files define the application structure, which is similar to that of Node.js applications or Node Package Manager \\(npm\\) packages.\n\n\\[Omitted image \"servicenow-ide-app-structure.png\"\\] Alt text: Structure of an application created in the ServiceNow IDE\n\nBy default, applications include the following directories and files. You can modify certain aspects of the application structure to suit your needs in the `now.config.json` file.\n\n<table id=\"table_ws5_flw_53c\"><thead><tr><th>\n\nDirectory or file\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n.vscode\n\n</td><td>\n\nDirectory containing recommended Visual Studio Code extensions.\n\n</td></tr><tr><td>\n\ndist\n\n</td><td>\n\nDirectory containing the build artifacts for packaging. This directory includes the following subdirectories:-   `app`: Directory containing the built metadata XML files.\n-   `static`: Directory containing the built static asset files.\n\n</td></tr><tr><td>\n\nmetadata\n\n</td><td>\n\nDirectory containing the application metadata \\(XML\\) of the application, such as table schemas and business rules, organized in the same directory structure as existing ServiceNow applications.\n\n **Note:** Application metadata shouldn't be edited from the XML files. Edit application metadata in the source code or on the ServiceNow AI Platform.\n\n</td></tr><tr><td>\n\nnode\\_modules\n\n</td><td>\n\nDirectory containing the third-party Node.js modules on which your application depends.\n\n</td></tr><tr><td>\n\nsrc\n\n</td><td>\n\nDirectory containing the source code of your application. This directory includes the following subdirectories:-   `client`: Directory containing the client-side files for developing user interfaces.\n-   `fluent`: Directory containing ServiceNow Fluent code in `.now.ts` files. The `generated` subdirectory contains the application files converted to ServiceNow Fluent.\n-   `server`: Directory containing JavaScript module code in `.js` or `.ts` files.\n\n</td></tr><tr><td>\n\ntarget\n\n</td><td>\n\nDirectory containing an installable package \\(`.zip` file\\) to upload to an instance.\n\n</td></tr><tr><td>\n\n.eslintrc\n\n</td><td>\n\nFile containing the ESLint configuration. ESLint helps identify and fix issues in the application code.\n\n</td></tr><tr><td>\n\n.gitignore\n\n</td><td>\n\nFile containing a list of directories or files for Git to ignore. These files aren't tracked in source control.\n\n</td></tr><tr><td>\n\nnow.config.json\n\n</td><td>\n\nFile containing the ServiceNow application configuration. The `now.config.json` file must be in the base directory for an application. You can configure aspects of an application by adding support parameters. For more information, see [Custom application configuration in source code](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-config-source-code.md).\n\n</td></tr><tr><td>\n\nnow.prebuild.mjs\n\n</td><td>\n\nAuto-updated file containing complete information about dependencies and their versions. This file is only available with the ServiceNow SDK.\n\n</td></tr><tr><td>\n\npackage-lock.json\n\n</td><td>\n\nAuto-updated file containing complete information about dependencies and their versions. This file is only available with the ServiceNow SDK.\n\n</td></tr><tr><td>\n\npackage.json\n\n</td><td>\n\nFile containing information about your application and custom or third-party module dependencies. The `package.json` file must be in the base directory for an application. On an instance, the `package.json` path is specified in the **Package JSON** field of the custom application record \\[sys\\_app\\] in the format `<scope>/<package-name>/<version>/package.json`.\n\n</td></tr></tbody>\n</table>## Related applications and features\n\n-   **[JavaScript APIs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/api-reference.md)**\n\n    Use JavaScript APIs in scripts that you write to change the functionality of applications or when you create applications.\n\n\n**Related topics**  \n\n\n[ServiceNow Fluent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-fluent.md)\n\n[JavaScript modules and third-party libraries](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/javascript-modules-third-party-libraries.md)\n\n[User interface development with React](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/ui-development-react.md)\n\n[Custom application configuration in source code](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/app-config-source-code.md)\n\n"}}