---
name: Get started
description: Explore the different options for getting started with the JavaScript Maps SDK.
keywords:
 - Get started
 - CDN
 - npm
 - install
 - build
 - access token
 - authentication
 - Web components
 - components
 - React
 - Angular
 - Vite
 - Vue
 - TypeScript
---

# Get started

The ArcGIS Maps SDK for JavaScript includes a [core API](/references/core/) and a set of [web component](https://developer.mozilla.org/docs/Web/API/Web_components) libraries that encapsulate the API's functionality into ready-to-use UI elements. Depending on your application's needs, you can use components from any of the six component libraries: [Map](/references/map-components/), [Charts](/references/charts-components/), [AI](/references/ai-components/) (beta), [Embeddable](/references/embeddable-components/), [Coding](/references/coding-components/) and [Common](/references/common-components/) components.

The SDK also integrates with Esri's [Calcite Design System](https://developers.arcgis.com/calcite-design-system/) for a consistent and accessible user experience. Calcite provides a complete UI toolkit, including a rich library of [web components](https://developers.arcgis.com/calcite-design-system/components/), [icons](https://developers.arcgis.com/calcite-design-system/icons/), [color schemes](https://developers.arcgis.com/calcite-design-system/foundations/colors/), and [design patterns](https://developers.arcgis.com/calcite-design-system/foundations/).

The best way to start with the JavaScript Maps SDK depends on your goals and requirements:

- **Build with vanilla JavaScript and HTML app** without installing local packages — see [Create an app with the ArcGIS CDN](/get-started/#create-an-app-with-the-arcgis-cdn)
- **Create a project from a template** — see [Create an app with npm](/get-started/#create-an-app-with-npm).

> [!NOTE]
> Using an AI coding assistant? Follow [Create a new app with AI](/ai-assisted-development/create-a-new-app/) to start from a template and verify the result. This is an optional workflow, not a different SDK installation method.

## Prerequisites

To use the ArcGIS Maps SDK for JavaScript to access content, services, or an organization, you need an ArcGIS Location Platform account, ArcGIS Online account, or ArcGIS Enterprise account. The type of account, user type, and role you need depends on the resources you need to access and the operations you wish to undertake.

If you do not have an account, select one of the options below:

> [!NOTE]
> **ArcGIS Accounts**
>
> Create an [ArcGIS Location Platform](https://location.arcgis.com/sign-up/) or [ArcGIS Online](https://www.esri.com/en-us/arcgis/products/arcgis-online/trial) account.

### Access tokens

> [!NOTE]
> Developers with an ArcGIS Online or ArcGIS Enterprise account may choose to omit authentication in public apps if the application only accesses items and resources with a sharing level of **Everyone (public)**.

Access tokens are required to access secure ArcGIS resources, such as
routing and places. Visit your
portal to create an access token using one of the supported authentication methods:
OAuth 2.0 user authentication,
app authentication, or
API key authentication.

See the [Authentication guide](/authentication/access-tokens/) to understand which authentication method is best suited for your application and use case.

## Create an app with the ArcGIS CDN

This section covers manual setup. If you prefer a starter project, use the [CDN template](https://github.com/Esri/jsapi-resources/tree/main/templates/js-maps-sdk-cdn).

The JavaScript Maps SDK can be integrated into a vanilla JavaScript and HTML application using the ArcGIS CDN.
This approach leverages optimized cloud caching, removes local build requirements, and makes it easier to stay up to date with the latest SDK versions.

### Setup

To get started, include the ArcGIS CDN `<script>` in the `<head>` section of a basic HTML file.
This is the main entry point for adding the core API library, all component packages, and the CSS to your application. The CDN is available in `MAJOR.MINOR` format, and patch-specific versions are available in `MAJOR.MINOR.PATCH` format. See the Release Notes for the [latest patch version](/release-notes/#patch-fixes).

```html label=index.html
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
```

### Configure CSS

Add custom CSS so that components will be visible in your application. This needs to be the last item in the `<head>` section, after importing the ArcGIS libraries from the CDN:

```html label=index.html
<style>
  html,
  body {
    height: 100%;
    margin: 0;
  }
</style>
```

Choose a light or dark [theme](/javascript/latest/building-your-ui/#light-and-dark-modes) through [Calcite modes](https://developers.arcgis.com/calcite-design-system/core-concepts/#modes).

> [!NOTE]
> If you haven't migrated to the SDK's components yet and are still using [widgets](/references/core/widgets/Widget/), consider [migrating to components](/components-transition-plan/) today.
> If you use widgets and/or programmatically initialize a [MapView](/references/core/views/MapView/) or [SceneView](/references/core/views/SceneView/), you must still manually include the core API CSS stylesheet:
>
> ```html label=index.html
> <!-- Load the CSS for the widgets -->
> <link rel="stylesheet" href="https://js.arcgis.com/5.2/esri/themes/light/main.css" />
> ```

### Create a layout

Add the 2D [Map component](/references/map-components/components/arcgis-map/), or 3D [Scene component](/references/map-components/components/arcgis-scene/), to the `<body>` of your HTML and assign it an optional `item-id` if using a [WebMap](/references/core/WebMap/) or [WebScene](/references/core/WebScene/) from ArcGIS Online or ArcGIS Enterprise portal. Use the [Map](/references/map-components/components/arcgis-map/#slots) or [Scene's slots](/references/map-components/components/arcgis-scene/#slots) to position other components, like [Zoom](/references/map-components/components/arcgis-zoom/), within the map or scene.

```html label=index.html
<!-- There is no need to programmatically set the basemap, extent or zoom -->
<!-- All this information comes from the WebMap -->
<arcgis-map item-id="02b37471d5d84cacbebcccd785460e94">
  <arcgis-zoom slot="top-left"></arcgis-zoom>
</arcgis-map>
```

Alternatively, you can set the `basemap`, `center` and `zoom` attributes manually on the Map or Scene components if you're not using a WebMap or WebScene.

### Add core API modules

You can [set properties](/programming-patterns/#attributes-and-properties), [watch for changes](/watch-for-changes/), and add custom JavaScript logic using the core API in a `<script>` tag at the bottom but within the `<body>` of your HTML.
Ensure the script is marked as `<script type="module">`.

Modules from the core API can be loaded via the global `$arcgis.import()` method. The method accepts a module path or an array of module paths, and returns a promise that resolves with the requested modules.
You can find the module identifier at the top of each API reference page. See [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) for reference.

> [!NOTE]
> The `$arcgis.import()` method is exclusive to the ArcGIS Maps SDK for JavaScript when used via CDN and is not a native
> feature of the standard ES module system.

The code below will wait for the map's [View](/references/core/views/View/) to be ready.
Once the View is ready, more functionality can be added.

```html label=index.html
<script type="module">
  const Graphic = await $arcgis.import("@arcgis/core/Graphic.js");
  const viewElement = document.querySelector("arcgis-map");
  // Wait for the view to be ready before adding additional functionality
  await viewElement.viewOnReady();

  // ...

  // Create a graphic and add the geometry and symbol to it
  const pointGraphic = new Graphic({
    geometry: point, // A point geometry
    symbol: markerSymbol, // A symbol for drawing the point
  });
  viewElement.graphics.add(pointGraphic);
</script>
```

## Create an app with npm

When working with local builds, you can install the JavaScript Maps SDK manually, use the @arcgis/create CLI tool, or visit the [`Esri/jsapi-resources`](https://github.com/Esri/jsapi-resources/tree/main) GitHub repository to download application templates. The repository contains a variety of templates for quickly scaffolding your first application. These templates demonstrate working with the SDK's core API, components, OAuth, and Calcite.

### Manually install

To use Map components in your project, install the [`@arcgis/map-components`](https://www.npmjs.com/package/@arcgis/map-components) package and its dependencies:

```bash
npm install @arcgis/map-components @arcgis/common-components @arcgis/core @esri/calcite-components
```

```bash
yarn add @arcgis/map-components @arcgis/common-components @arcgis/core @esri/calcite-components
```

```bash
pnpm add @arcgis/map-components @arcgis/common-components @arcgis/core @esri/calcite-components
```

For additional configuration information on framework and tooling setup, see the following guide topics:

- [Vite setup](/vite/)
- [Configuring TypeScript](/typescript/)
- [React setup](/react/)
- [Angular setup](/angular/)

### Use @arcgis/create

The [@arcgis/create](https://www.npmjs.com/package/@arcgis/create) CLI tool can be used with either [npm init](https://docs.npmjs.com/cli/v8/commands/npm-init) or [npx](https://docs.npmjs.com/cli/v8/commands/npx). Before you start, make sure you are using the latest long-term support (LTS) version of [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).

Run `npm init @arcgis` or `npx @arcgis/create` to quickly scaffold a new mapping application.

When using `npx`, you can also pass CLI options to skip all interactive prompts:

```bash
# CLI options:
#   -n, --name <name>          Name of the project
#   -t, --template <template>  Template to use

# Vite app template with SDK integration
npx @arcgis/create -n my-arcgis-app -t vite
```

Other templates include:

```bash
# React app template with SDK integration
npx @arcgis/create -n my-arcgis-app -t react
```

```bash
# Angular app template with SDK integration
npx @arcgis/create -n my-arcgis-app -t angular
```

```bash
# Vue app template with SDK integration
npx @arcgis/create -n my-arcgis-app -t vue
```

```bash
# Webpack app template with SDK integration
npx @arcgis/create -n my-arcgis-app -t webpack
```

```bash
# Vanilla JavaScript setup using the ArcGIS CDN
npx @arcgis/create -n my-arcgis-app -t cdn
```

```bash
# The SDK's core API only, no UI components
npx @arcgis/create -n my-arcgis-app -t node
```

## Additional information

Please refer to these additional links for further information:

- [Tutorials](/tutorials/)
- [Programming patterns](/programming-patterns/)
- [Samples](/sample-code/)
- [References](/references/)
- [MDN - JavaScript modules](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Modules)
- [Web Reference - Module Bundlers in JavaScript](https://webreference.com/javascript/advanced/module-bundlers/)
- [MDN - Using custom elements](https://developer.mozilla.org/docs/Web/API/Web_components/Using_custom_elements)
- [MDN - Client-side tooling overview](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)
- [MDN - Package management basics](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Package_management)
- [MDN - Introducing a complete toolchain](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Introducing_complete_toolchain)