--- title: Basic project setup using NPM and Parcel layout: doc.hbs --- # Introduction Modern JavaScript works best when using and authoring modules. The recommended way of using OpenLayers is installing the [`ol`](https://npmjs.com/package/ol) package. This tutorial walks you through setting up a simple dev environment, which requires [node](https://nodejs.org) for everything to work. In this tutorial, we will be using [Parcel](https://parceljs.org) to bundle our application. There are several other options, some of which are linked from the [README](https://npmjs.com/package/ol). ## Initial steps Create a new empty directory for your project and navigate to it by running `mkdir new-project && cd new-project`. Initialize your project using `npm init` and answer the questions asked. Add OpenLayers as dependency to your application with npm install ol At this point you can ask NPM to add required development dependencies by running npm install --save-dev parcel-bundler ## Application code and index.html Place your application code in `index.js`. Here is a simple starting point: ```js import 'ol/ol.css'; import {Map, View} from 'ol'; import TileLayer from 'ol/layer/Tile'; import OSM from 'ol/source/OSM'; const map = new Map({ target: 'map', layers: [ new TileLayer({ source: new OSM() }) ], view: new View({ center: [0, 0], zoom: 0 }) }); ``` You will also need an `index.html` file that will use your bundle. Here is a simple example: ```html