{"id":13881024,"url":"https://github.com/fauna/vscode","last_synced_at":"2025-04-25T05:30:36.235Z","repository":{"id":37992712,"uuid":"236746941","full_name":"fauna/vscode","owner":"fauna","description":"FaunaDB extension for VS Code","archived":false,"fork":false,"pushed_at":"2024-08-23T17:26:11.000Z","size":7749,"stargazers_count":43,"open_issues_count":11,"forks_count":11,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-04-03T16:45:06.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fauna.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-28T13:55:50.000Z","updated_at":"2024-08-23T17:26:16.000Z","dependencies_parsed_at":"2023-12-13T20:12:43.827Z","dependency_job_id":"f20a2af6-acc7-44e2-8d63-f978e9dd3c56","html_url":"https://github.com/fauna/vscode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Fvscode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Fvscode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Fvscode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Fvscode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fauna","download_url":"https://codeload.github.com/fauna/vscode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250760556,"owners_count":21482826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T08:03:48.360Z","updated_at":"2025-04-25T05:30:35.089Z","avatar_url":"https://github.com/fauna.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# [Fauna extension for VS Code](https://marketplace.visualstudio.com/items?itemName=fauna.fauna)\n\nSource code for the [Fauna VS Code extension](https://marketplace.visualstudio.com/items?itemName=fauna.fauna).\n\nThis [extension](https://marketplace.visualstudio.com/items?itemName=fauna.fauna) allows users to view individual Fauna databases and run [FQL queries](https://docs.fauna.com/fauna/current/api/fql/) directly inside VS Code.\n\n**Note: This extension does not yet support auto-complete, which is planned for a future release. Alternatively, please feel free to submit a PR to help out!**\n\n## Getting started\n\n### Prerequisites\n\n1. Create a [Fauna account](https://dashboard.fauna.com/accounts/register)\n\n2. Install [VS Code](https://code.visualstudio.com/Download)\n\n3. Install the [Fauna extension](https://marketplace.visualstudio.com/items?itemName=fauna.fauna) in VS Code.\n\n### 1. Set your secret key\n\nYou can persist a Fauna secret using either a `.faunarc` file in your project or using the settings in the VS Code IDE.\n\nPersisting a secret in VS Code settings sets the key at a global level for all projects. A project can override the global key by including a `.faunarc` config file in the root of the project.\n\n#### Using a `.faunarc` file for a project\n\n1. **IMPORTANT:** Add `.faunarc` to your `.gitignore`.\n2. Create a file `.faunarc` in your project root folder.\n3. Add `FAUNA_KEY=your-secret-key` to the `.faunarc` file.\n\nAdditionally, the config file supports these optional parameters:\n\n```\nFAUNA_DOMAIN=db.fauna.com\nFAUNA_SCHEME=https\nFAUNA_PORT=443\nFAUNA_GRAPHQL_HOST=https://graphql.fauna.com\n```\n\n#### Using VS Code to store a database key\n\n1. The VS Code extension allows you to work in the context of a single database, for which you need to provide a key. You can do this by generating a key with the \"admin\" role from the database \"Security\" tab in the Fauna Dashboard.\n\n\u003e Note that you'll need to update the Fauna domain in the extension settings (or `.faunarc` file) as needed to match the database Region Group; see [the Region Group documentation](https://docs.fauna.com/fauna/current/learn/understanding/region_groups#how-to-use-region-groups) for more details.\n\n2. Copy the secret and paste it in the Fauna extension settings. You can find the Fauna extension settings by either:\n\n- Selecting `View \u003e Extensions` to open the Extensions pane, scrolling down in the list of installed extensions until you see Fauna, then clicking the cog icon in the lower right to open the extension settings.\n\n- Selecting `Code \u003e Preferences \u003e Settings \u003e Extensions \u003e Fauna` from the VS Code menu.\n\n3. Restart VS Code after setting or changing your secret.\n\n![Extension settings](media/extension-settings.png)\n\n- `fauna.adminSecretKey`: The secret for a specific database.\n- `fauna.domain`: The Fauna domain for the database [Region Group](https://docs.fauna.com/fauna/current/learn/understanding/region_groups#how-to-use-region-groups) or `localhost` when using a local Fauna Dev Docker instance.\n- `fauna.scheme`: One of `https` or `http`. Only set to `http` when using a local Fauna Dev Docker instance.\n- `fauna.port`: The port number for the Fauna endpoint. When using a Fauna Dev Docker instance, use the port passed to the `docker run` command - usually `8443`.\n- `fauna.graphqlHost`: The full URL for the Fauna GraphQL API. The default is `https://graphql.fauna.com`. See [GraphQL Endpoints](https://docs.fauna.com/fauna/current/api/graphql/endpoints) for Region Group-specific URLs.\n\n\u003e **WARNING**: Be careful! To avoid exposing this secret, do not commit it to your local `.vscode` configuration.\n\n### 2. Browse database\n\n1. Click on the Fauna bird icon in the Activity bar on the far left. If you do not see the Activity Bar, select `View \u003e Appearance \u003e Show Activity Bar` from the VS Code menu.\n2. You should see a pane listing all of the database contents, which includes child databases, indexes, collections, documents, and functions.\n\n**Note: Browsing is read-only at this time, but you can edit all of your data by running queries (see next section).**\n\n![Browse your database data](media/browse-feature.png)\n\n### 3. Run queries\n\n1. If you are on a Mac, open the command palette with the keyboard shortcut `Cmd` + `Shift` + `P`. If you are on a PC, use `Ctrl` + `Shift` + `P`.\n\n2. Create a new file from which to run your [FQL queries](https://docs.fauna.com/fauna/current/api/fql/) by either:\n\n- Typing `Fauna: Create query` to select that command from the command palette dropdown menu. This opens a new tab with the `Paginate(Collections())` query already included.\n\n- Creating a new file with the `.fql` file extension.\n\n3. Open the command palette again using `Cmd` + `Shift` + `P`, but this time start typing `Fauna: Run query` to select that command from the dropdown menu.\n\n4. The Output panel should open from the bottom of the VS Code window and display the query results.\n\n![Run queries](media/query-feature.gif)\n\n5. If your file contains multiple FQL expressions, you can trigger them individually by highlighting the expression you want to execute.\n\n![Run selection query](media/selection-query.gif)\n\n### 4. Upload GraphQL Schema\n\n1. Open a `.graphql` or `.gql` file containing your GraphQL schema as described in the [Fauna specification](https://docs.fauna.com/fauna/current/api/graphql).\n\n2. If you are on a Mac, open the command palette with the keyboard shortcut `Cmd` + `Shift` + `P`. If you are on a PC, use `Ctrl` + `Shift` + `P`.\n\n3. Fauna provides commands for uploading schemas, depending on [modes](https://docs.fauna.com/fauna/current/api/graphql/endpoints#modes):\n\n- Enter `Fauna: Upload GraphQL Schema` to upload in the default `merge` mode.\n\n- Enter `Fauna: Merge GraphQL Schema` to explicitly upload in `merge` mode.\n\n- Enter `Fauna: Override GraphQL Schema` to upload in `override` mode.\n\n\u003e **WARNING**: `override` mode causes data loss for any previous GraphQL schema. Collections, indexes, or documents that are not involved in GraphQL are not affected.\n\n![Upload GraphQL schema](media/upload-schema-cmd.gif)\n\n## Features\n\n**Commands**\n\n- Fauna: Create query\n- Fauna: Run query\n- Fauna: Upload GraphQL Schema\n- Fauna: Merge GraphQL Schema\n- Fauna: Override GraphQL Schema\n\n![Fauna commands](media/fauna-commands.png)\n\n## Built With\n\n- [Fauna](https://fauna.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffauna%2Fvscode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffauna%2Fvscode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffauna%2Fvscode/lists"}