---
title: "JavaScript (Legacy)"
description: "Connect your browser apps to Gitana with our legacy JavaScript driver. Easy installation and comprehensive support. (Gitana 4.0)"
product: "Gitana"
version: "4.0"
url: "/documentation/gitana/4.0/developers/drivers/javascript-legacy"
---

# JavaScript (Legacy)

Connect your HTML browser applications to Gitana

| Latest Version |  |
| --- | --- |
| Version | 2.0.1 |
| Date | September 25, 2026 |
| GitHub | [https://github.com/gitana/gitana-javascript-driver](https://github.com/gitana/gitana-javascript-driver "https://github.com/gitana/gitana-javascript-driver") |
| NPM | [https://www.npmjs.com/package/gitana/v/2.0.1](https://www.npmjs.com/package/gitana/v/2.0.1 "https://www.npmjs.com/package/gitana/v/2.0.1") |

![JavaScript (Legacy)](/documentation/gitana/4.0/developers/drivers/javascript-legacy/javascript.png)

The Gitana JavaScript driver can be dropped into any web or mobile application running in the browser, within Node.js or any of a host of web frameworks including jQuery, Vue.js, Next.js, Nuxt and many others.

## Loading the Driver

You can load the driver into your web application in one of three ways:

### In the Browser

```
<script type="text/javascript" src="gitana.min.js"></script>
<script>
    Gitana.connect({...}, function() {
        // ...your code
    });
</script>
```

### Using AMD

```
define(["gitana"], function(Gitana) {
    Gitana.connect({...}, function() {
        // ...your code
    });
});
```

### Using Common JS

```
var Gitana = require("gitana");
Gitana.connect({...}, function() {
    // ...your code
});
```

## Installation

You can get the Gitana JavaScript driver using Bower, NPM, via a direct download or you can load it from the Cloud CMS CDN.

### Install using Bower

```
bower install gitana
```

### Install using NPM

```
npm install gitana
```

### Direct Download

- [gitana.js](https://cdn.jsdelivr.net/npm/gitana/lib/gitana.js "gitana.js")
- [gitana.min.js](https://cdn.jsdelivr.net/npm/gitana/lib/gitana.min.js "gitana.min.js")

The Gitana driver comes wrapped with a shim to auto-detect the presence of an AMD and CommonJS loaders. This allows it to be loaded into a segmented namespace via tools like RequireJS within the browser or Node.js on the server-side. The driver is entirely standalone and has no external dependencies.

## Getting Started

To connect to Gitana, you first need to have a set of API Keys. In Gitana, API Keys consist of a client key/secret and a user key/secret. You pass these keys into the `Gitana.connect` method as a JSON object.

You can create as many API Keys as you would like. The basic process for getting your own keys is described in the [API Keys](/documentation/gitana/4.0/developers/apikeys.md). Give that a shot and when you're done, you should have the following:

- `clientKey`
- `clientSecret`
- `username`
- `password`

You can then connect to Gitana using a code block like the one shown below. Make sure to plug in the values for `clientKey`, `clientSecret`, `username` and `password` from the API Keys that you generate.

```
Gitana.connect({
"clientKey": "{clientKey}",
"clientSecret": "{clientSecret}",
"username": "{username}",
"password": "{password}",
"baseURL": "https://api.cloudcms.com"
}, function(err) {

    // here is some sample code of what we might then do

    // create a repository, get master branch
    this.createRepository().readBranch("master").then(function() {

        // create a few nodes
        this.createNode();
        this.createNode({ "title": "My second node" });
        this.createNode({ "title": "My third node", "name": "boo" });

        // query for nodes
        this.queryNodes({ "name": "boo" }).count(function(count) {
            console.log("count = " + count); // 1
        });
    });

    // create then delete a domain
    this.createDomain({
        "title": "Users and Groups"
    }).del();

});
```

## Documentation

The JavaScript driver is a very powerful library that provides access to 100% of the capabilities of Gitana from a programmatic perspective. It is therefore important to first familiarize yourself with the concepts presented in the [Gitana Documentation](/documentation.html "Gitana Documentation").

You should familiarize with the [Gitana REST API](https://api.cloudcms.com/docs "Gitana REST API") which covers HTTP-level information about all of the methods and operations available within Gitana.

Check out our [Gitana JavaScript Cookbook](/documentation/gitana/4.0/developers/cookbooks/javascript.md) for recipes and examples using the JavaScript Driver.

## Fork the Code

The Gitana JavaScript driver is 100% open-source (Apache 2.0) and so you're free to fork it, extend it and dig into it to learn about how it works. We provide hundreds of test files and thousands of unit tests within that demonstrate various code operations. It's really cool.

- [View the Source Code](https://github.com/gitana/gitana-javascript-driver "View the Source Code")

## Bugs / Problems

If you run into a bug, please [create an issue](https://github.com/gitana/gitana-javascript-driver/issues "create an issue") so that we can look at it.  
For production support, please contact us at [support@gitana.io](mailto:support@gitana.io "support@gitana.io") or call us directly.

## Support and Terms of Use

The JavaScript driver is free to use in your applications and projects. It is fully supported by Gitana.
