Client application quick start
Fauna supports drivers in several popular programming languages for programmatic management and manipulation of Fauna databases. To get started, complete the prerequisites and then select a language.
For a complete list of supported drivers, see Drivers. |
Prerequisites
To use a Fauna driver, you must have:
-
A Fauna account. Sign up at https://dashboard.fauna.com/accounts/register.
-
A database with an access key.
-
Sign up for a free account
Sign up at https://dashboard.fauna.com/accounts/register.
-
Create a database
Click NEW DATABASE. Select the
Classic
region group. -
Create an access key
Click SECURITY in the left-side navigation menu. Create a new key for your database. Be sure to save the key’s secret in a safe place, as it is only displayed once.
For a more detailed description of the signup and database creation steps, see the Dashboard quick start. |
When you’re ready with a database and an access key, select a language to get started with a driver.
Choose a language
JavaScript
For complete JavaScript driver information, see the driver page.
-
Install the driver
Enter the following at the command line:
terminalCopied!npm install --save faunadb
-
Create a program file
With your preferred text editor, create a new file called
app.js
. We’ll use this file to run a Fauna query which creates a new collection namedmyCollection
.Add the following lines to your file:
-
Run the program
Run the following command in a terminal window, in the directory where you created the program file. Be sure to replace
YOUR_FAUNA_SECRET
with the secret that you created at the beginning of this guide.terminalCopied!FAUNADB_SECRET=YOUR_FAUNA_SECRET node app.js
You should see the result of your
CreateCollection
query:{ ref: Collection("myCollection"), ts: 1633458045000000, history_days: 30, name: 'myCollection' }
-
Learn more
Fauna’s query model relies on indexes to support all query patterns which do not involve looking up documents directly by their Reference. An understanding of index creation and usage is crucial for effective Fauna development.
See the Index tutorials for more information.
To learn more about Fauna, Fauna Query Language, and the JavaScript driver, explore the documentation:
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!