### Execute Elixir Quickstart Example Source: https://github.com/geldata/gel/blob/master/docs/intro/clients.rst Command to run the Elixir quickstart example from the terminal. ```bash $ mix run -e GelQuickstart.run ``` -------------------------------- ### Interactive prompt example Source: https://github.com/geldata/gel/blob/master/docs/reference/using/cli/gel_migration/gel_migration_create.rst Example of an interactive prompt during migration creation, showing options for confirming, rejecting, listing DDL, listing EdgeQL, reverting, saving, quitting, or getting help. ```bash did you create object type 'default::User'? [y,n,l,c,b,s,q,?] ? y - confirm the prompt, use the DDL statements n - reject the prompt l - list the DDL statements associated with prompt c - list already confirmed EdgeQL statements b - revert back to previous save point, perhaps previous question s - stop and save changes (splits migration into multiple) q - quit without saving changes h or ? - print help ``` -------------------------------- ### Install and Configure Gel Client Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/trpc.rst Install the Gel client and create an instance for database interaction. ```bash $ pnpm add gel $ # or yarn add gel $ # or npm install gel $ # or bun add gel ``` ```typescript import { createClient } from 'gel'; const gelClient = createClient(); export default gelClient; ``` -------------------------------- ### Install Gel Client Library Source: https://github.com/geldata/gel/blob/master/docs/intro/clients.rst Commands to install the Gel client library for Node.js, Python, Rust, Go, and .NET. For Deno, no explicit installation is required as it uses URLs. ```bash $ npm install gel # npm $ yarn add gel # yarn ``` ```txt n/a ``` ```bash $ pip install gel ``` ```toml # Cargo.toml [dependencies] gel-tokio = "0.5.0" # Additional dependency tokio = { version = "1.28.1", features = ["macros", "rt-multi-thread"] } ``` ```bash $ go get github.com/geldata/gel-go ``` ```bash $ dotnet add package Gel.Net.Driver ``` -------------------------------- ### Start Next.js Development Server Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/nextjs_pages_router.rst Navigate into the project directory and start the development server to view the application locally. Hot-reloading is enabled by default. ```bash cd nextjs-blog yarn dev ``` -------------------------------- ### Enable and Start Gel Systemd Unit Source: https://github.com/geldata/gel/blob/master/docs/reference/running/deployment/bare_metal.rst Enable the Gel server systemd unit to start automatically on boot and start it immediately. ```bash $ sudo systemctl enable --now gel-server-6 ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_flask.rst Create a Python virtual environment, activate it, and install the necessary dependencies including Gel, Flask, and httpx. ```bash $ python -m venv myvenv $ source myvenv/bin/activate $ pip install gel flask 'httpx[cli]' ``` -------------------------------- ### Install the vectorstore extension Source: https://github.com/geldata/gel/blob/master/docs/reference/ai/extvectorstore.rst Install the extension package using the `extension` CLI command. This is the first step to enable vectorstore functionalities. ```bash $ gel extension install vectorstore ``` -------------------------------- ### Install gel Python Package Source: https://github.com/geldata/gel/blob/master/docs/reference/using/python/index.rst Install the gel client package using pip or uv. ```bash $ pip install gel ``` ```bash $ uv add gel ``` -------------------------------- ### Install Gel Client Library Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/nextjs_pages_router.rst Installs the official Gel client library for Node.js using npm. ```bash $ npm install gel ``` -------------------------------- ### Elixir: Query Single Value Source: https://github.com/geldata/gel/blob/master/docs/intro/clients.rst Example of starting a Gel client and executing a single query in Elixir. Ensure the Gel library is installed. ```elixir defmodule GelQuickstart do def run do {:ok, client} = Gel.start_link() result = Gel.query_single!(client, "select random()") IO.inspect(result) end end ``` -------------------------------- ### Create Schema with Default Property Value in EdgeDB Migrations Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/1_0_a7.rst Example of starting a migration to create a new type with a property that has a default value. This demonstrates the initial setup for schema changes. ```edgeql-repl db> start migration to { ... module default { ... type Foo { ... property val -> str { ... default := 'n/a' ... } ... } ... } ... }; ``` -------------------------------- ### Set up GEL Project and Install Dependencies Source: https://github.com/geldata/gel/blob/master/docs/reference/using/js/index.rst Create a new project directory, initialize an npm project, install GEL and its generator, and initialize a GEL project non-interactively. ```bash $ mkdir gel-js-example $ cd gel-js-example $ npm init -y $ npm install gel $ npm install --save-dev @gel/generate $ npx gel project init --non-interactive $ touch index.mjs ``` -------------------------------- ### Install and Initialize Gel CLI Source: https://context7.com/geldata/gel/llms.txt Install the Gel CLI for managing local instances, migrations, and connections. Then, initialize a new project and access the REPL. ```bash # Install Gel CLI on Linux/macOS curl --proto '=https' --tlsv1.2 -sSf https://geldata.com/sh | sh # Install on Windows (PowerShell) iwr https://geldata.com/ps1 -useb | iex # Initialize a new project (creates gel.toml and dbschema/) gel project init # Open the EdgeQL REPL gel # Check current instance status gel instance status ``` -------------------------------- ### GET Request Example Source: https://github.com/geldata/gel/blob/master/docs/reference/using/http.rst Example of an EdgeQL query using the HTTP GET method. Fields are passed as URL query parameters. ```APIDOC ## GET /branch//edgeql ### Description Executes an EdgeQL query using the HTTP GET method. All parameters are passed as URL query parameters. ### Method GET ### Endpoint /branch//edgeql ### Query Parameters - **query** (string) - Required - The EdgeQL query string. - **variables** (JSON) - Optional - A JSON object containing query parameters. - **globals** (JSON) - Optional - A JSON object for global variables. - **config** (JSON) - Optional - A JSON object for configuration options. ### Request Example ```bash curl -G https://:/branch/main/edgeql \ --data-urlencode "query=select Person {*};" \ --data-urlencode "variables={"name": "John"}" ``` ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/chatgpt_bot.rst Change into the newly created project directory to begin configuration. ```bash cd docs-chatbot ``` -------------------------------- ### GraphQL GET Request Example Source: https://github.com/geldata/gel/blob/master/docs/reference/using/graphql/index.rst GraphQL queries can also be sent using GET requests, with parameters included in the URL. ```APIDOC ### GET request ```bash $ curl \ -H application/x-www-form-urlencoded \ -X GET http://localhost:10787/branch/main/graphql \ ``` ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/graphql_apis_with_strawberry.rst Clone the example repository and navigate to the strawberry-gql directory to begin. ```bash git clone git@github.com:geldata/gel-examples.git cd gel-examples/strawberry-gql ``` -------------------------------- ### Initialize a project with a Gel Cloud instance Source: https://github.com/geldata/gel/blob/master/docs/cloud/index.rst Initialize your local project and link it to a Gel Cloud instance. Ensure the instance is already created. ```bash $ gel project init \ --server-instance / ``` -------------------------------- ### st_startpoint Source: https://github.com/geldata/gel/blob/master/docs/reference/stdlib/postgis.rst Gets the starting point of a linestring or circularstring. ```APIDOC ## st_startpoint ### Description Gets the starting point of a linestring or circularstring. ### Signature `ext::postgis::geometry st_startpoint(ext::postgis::geometry a0)` ``` -------------------------------- ### Install Gel CLI with Nixpkgs Source: https://github.com/geldata/gel/blob/master/docs/intro/install_table.rst Install the Gel CLI using Nixpkgs. This command ensures a reproducible environment. ```bash $ nix-shell -p gel ``` -------------------------------- ### Initialize a new Gel project Source: https://github.com/geldata/gel/blob/master/docs/intro/projects.rst Run `gel project init` in a new directory to set up a Gel project, create a `gel.toml` file, and link it to a Gel instance. ```bash $ gel project init No `gel.toml` found in this repo or above. Do you want to initialize a new project? [Y/n] > Y Specify the name of Gel instance to use with this project [default: my_instance]: > my_instance Checking Gel versions... Specify the version of Gel to use with this project [default: x.x]: > # (left blank for default) ... Successfully installed x.x+cc4f3b5 Initializing Gel instance... Applying migrations... Everything is up to date. Revision initial Project initialized. To connect to my_instance, run `gel` ``` -------------------------------- ### GraphQL GET Request Example Source: https://github.com/geldata/gel/blob/master/docs/reference/using/graphql/index.rst Send a GET request to the GraphQL endpoint. Query parameters are used for passing query and other options. ```bash $ curl \ -H application/x-www-form-urlencoded \ -X GET http://localhost:10787/branch/main/graphql \ ``` -------------------------------- ### Install Gel Client Library Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/nextjs_app_router.rst Installs the Gel client library for Node.js environments using npm, yarn, pnpm, or bun. ```bash $ npm install gel # or 'yarn add gel' or 'pnpm add gel' or 'bun add gel' ``` -------------------------------- ### Create Async Client and Execute Query Source: https://github.com/geldata/gel/blob/master/docs/reference/using/python/client.rst Demonstrates how to create an asynchronous client instance and execute a simple query. ```python client = gel.create_async_client() await client.query('SELECT {1, 2, 3}') ``` -------------------------------- ### Bash Command to GET All Events Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_fastapi.rst Example bash command using httpx to send a GET request to the '/events' endpoint to retrieve all events. ```bash $ httpx -m GET http://localhost:5001/events ``` -------------------------------- ### Install Gel CLI and Initialize Project Source: https://github.com/geldata/gel/blob/master/README.md Installs the Gel command-line interface using curl and initializes a new Gel project. This is the first step for local development. ```bash $ curl --proto '=https' --tlsv1.2 -sSf https://geldata.com/sh | sh $ edgedb project init $ edgedb ``` -------------------------------- ### Get Statement Start Datetime Source: https://github.com/geldata/gel/blob/master/docs/reference/stdlib/datetime.rst Retrieve the date and time when the current statement started. This function is non-volatile and can be used in schema-defined computed properties. ```edgeql-repl select datetime_of_statement(); ``` -------------------------------- ### Get Transaction Start Datetime Source: https://github.com/geldata/gel/blob/master/docs/reference/stdlib/datetime.rst Retrieve the date and time when the current transaction started. This function is non-volatile and can be used in schema-defined computed properties. ```edgeql-repl select datetime_of_transaction(); ``` -------------------------------- ### Initialize Searchbot Project with uv Source: https://github.com/geldata/gel/blob/master/docs/intro/tutorials/ai_fastapi_searchbot.rst Create a new project named 'searchbot' using uv and navigate into the project directory. This sets up the basic project structure. ```bash $ uv init searchbot \ && cd searchbot ``` -------------------------------- ### Initialize Gel Project Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/graphql_apis_with_strawberry.rst Initialize a new Gel project and instance. This command prompts for the instance name and whether to start it automatically on login. ```bash gel project init ``` -------------------------------- ### Release Savepoint Example Source: https://github.com/geldata/gel/blob/master/docs/reference/reference/edgeql/tx_sp_release.rst This example demonstrates the usage of 'release savepoint' within a transaction. It starts a transaction, declares a savepoint, releases it, and then rolls back the transaction. ```edgeql start transaction; # ... declare savepoint f1; # ... release savepoint f1; # ... rollback; ``` -------------------------------- ### Initialize Gel Client and AI Instance (Python) Source: https://github.com/geldata/gel/blob/master/docs/intro/guides/ai/python.rst Set up the Gel client and create an AI instance for interacting with Gel's AI functionalities. This is the first step before performing any AI-related operations in Python. ```python import gel import gel.ai gel_client = gel.create_client() gel_ai = gel.ai.create_rag_client(client) ``` -------------------------------- ### Full SSE Response Example (Text) Source: https://github.com/geldata/gel/blob/master/docs/reference/ai/http.rst An example of a complete Server-Sent Events (SSE) response stream, showing the sequence of events from message start to message stop. ```text event: message_start data: {"type": "message_start", "message": {"id": "chatcmpl-9MzuQiF0SxUjFLRjIdT3mTVaMWwiv", "role": "assistant", "model": "gpt-4-0125-preview", "usage": {"prompt_tokens": 10}}} event: content_block_start data: {"type": "content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": "The"}, "logprobs": null} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": " skies"}, "logprobs": null} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": " on"}, "logprobs": null} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": " Mars"}, "logprobs": null} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": " are"}, "logprobs": null} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": " red"}, "logprobs": null} event: content_block_delta data: {"type": "content_block_delta","index":0,"delta":{"type": "text_delta", "text": "."}, "logprobs": null} event: content_block_stop data: {"type": "content_block_stop","index":0} event: message_delta data: {"type": "message_delta", "delta": {"stop_reason": "stop"}, "usage": {"completion_tokens": 7, "total_tokens": 17}} event: message_stop data: {"type": "message_stop"} ``` -------------------------------- ### Bash Command to GET Event by Name Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_fastapi.rst Example bash command using httpx to send a GET request to the '/events' endpoint with a 'name' query parameter to retrieve a specific event. ```bash $ httpx -m GET http://localhost:5001/events \ -p 'name' 'Resuscitation' ``` -------------------------------- ### Initialize Gel Project Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/trpc.rst Run this command to initialize a new Gel project and set up a schema. ```bash $ pnpm dlx gel project init # or `npx gel project init` ``` -------------------------------- ### Create Gel Client and Execute Query (Go) Source: https://github.com/geldata/gel/blob/master/docs/intro/clients.rst Initializes a Gel client with default options and executes a query to select a random number. The client automatically connects to the linked project instance. Includes context management and error handling. ```go // hello.go package main import ( "context" "fmt" "log" "github.com/geldata/gel-go" ) func main() { ctx := context.Background() client, err := gel.CreateClient(ctx, gel.Options{}) if err != nil { log.Fatal(err) } defer client.Close() var result float64 err = client. QuerySingle(ctx, "select random();", &result) if err != nil { log.Fatal(err) } fmt.Println(result) } ``` -------------------------------- ### HTTP GET Request for Version Check Source: https://github.com/geldata/gel/blob/master/docs/reference/using/cli/network.rst This example shows the structure of an HTTP GET request made by the CLI to check for version updates. The User-Agent header is minimal, and platform details are inferred from the URL. ```http GET /archive/.jsonindexes/linux-x86_64.json HTTP/1.1 host: packages.geldata.com content-length: 0 user-agent: gel ``` -------------------------------- ### Initialize Project with Gel v7.0 Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/7_x.rst Use this command to initialize a new project, specifying version 7.0. Pre-release versions are not automatically suggested. ```bash $ gel project init --server-version 7.0 ``` -------------------------------- ### Test Fetching All Books with cURL Source: https://github.com/geldata/gel/blob/master/docs/intro/tutorials/gel_drizzle_booknotes.rst Example cURL command to test the GET endpoint for fetching all books. ```bash $ curl -X GET http://localhost:3000/api/books ``` -------------------------------- ### Find Index of Sub-value (find) Source: https://github.com/geldata/gel/blob/master/docs/reference/stdlib/generic.rst Use 'find' to get the starting index of the first occurrence of a 'needle' within a 'haystack' (string, bytes, or array). For arrays, an optional 'from_pos' can specify the search start. Returns -1 if not found. ```edgeql-repl db> select find('qwerty', 'we'); {1} ``` ```edgeql-repl db> select find(b'qwerty', b'42'); {-1} ``` ```edgeql-repl db> select find([2, 5, 7, 2, 100], 2); {0} ``` ```edgeql-repl db> select find([2, 5, 7, 2, 100], 2, 1); {3} ``` -------------------------------- ### Call a standard library function Source: https://github.com/geldata/gel/blob/master/docs/reference/reference/edgeql/functions.rst Demonstrates calling the `len` function to get the length of a string. This is a basic example of a positional argument. ```edgeql-repl select len('foo'); { 3 } ``` -------------------------------- ### Initialize Local Project with Gel Cloud Instance Source: https://github.com/geldata/gel/blob/master/docs/cloud/cli.rst Initialize a local project and link it to a Gel Cloud instance using the --server-instance option. Alternatively, run without the option and provide the instance name when prompted. ```bash $ gel project init \ --server-instance / ``` ```bash $ gel project init \ --server-instance / ``` -------------------------------- ### Start a New Chat (curl) Source: https://github.com/geldata/gel/blob/master/docs/intro/tutorials/ai_fastapi_searchbot.rst Example `curl` command to initiate a new chat session for a user named 'charlie'. The response includes the chat ID. ```bash $ curl -X 'POST' \ 'http://127.0.0.1:8000/chats?username=charlie' \ -H 'accept: application/json' \ -d '' { "id": "20372a1a-ded5-11ef-9a08-b329b578c45c", "new_chat_id": "544ef3f2-ded8-11ef-ba16-f7f254b95e36" } ``` -------------------------------- ### Initialize Gel Project Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_fastapi.rst Initialize a new Gel project instance, specifying its name and version. This creates the necessary configuration files. ```bash gel project init > Y > fastapi_crud > 2.7 ``` -------------------------------- ### Update User Name with Pattern Matching Source: https://github.com/geldata/gel/blob/master/docs/reference/reference/edgeql/update.rst This example demonstrates updating a property based on a pattern match. It appends a '*' to the names of all users whose names start with 'Bob'. ```edgeql with module example update User filter .name like 'Bob%' set { name := User.name ++ '*' }; ``` -------------------------------- ### Initialize New EdgeDB Project with `gel project init` Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/1_0_b2.rst Illustrates the interactive process of initializing a new EdgeDB project using the `gel project init` command. It guides the user through setting up instance credentials, schema directories, and selecting an EdgeDB version. ```bash $ gel project init No `edgedb.toml` found in `/home/username/dev/hw` or above Do you want to initialize a new project? [Y/n] > Y Specify the name of EdgeDB instance to use with this project [default: myproject]: > myproject Type a number to select an option: How would you like to run EdgeDB for this project? 1. Local (docker) > 1 Checking EdgeDB versions... Specify the version of EdgeDB to use with this project [default: 1-beta2]: > 1-beta2 ┌─────────────────────┬──────────────────────────────────────────┐ │ Project directory │ /home/username/dev/myproject │ │ Project config │ /home/username/dev/myproject/edgedb.toml │ │ Schema dir (empty) │ /home/username/dev/myproject/dbschema │ ``` -------------------------------- ### Custom Scalar Type with Expression Constraint Source: https://github.com/geldata/gel/blob/master/docs/reference/stdlib/constraints.rst Define a custom scalar type that enforces a condition on its string value using an expression. This example creates a type that must start with 'A'. ```sdl scalar type StartsWithA extending str { constraint expression on (__subject__[0] = 'A'); } ``` -------------------------------- ### Initialize Gel Project Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_flask.rst Initialize a new Gel project using the 'gel project init' command and provide a name for the Gel instance. ```bash $ gel project init Initializing project... Specify the name of Gel instance to use with this project [default: flask_crud]: > flask_crud Do you want to start instance automatically on login? [y/n] > y Checking Gel versions... ``` -------------------------------- ### Test Fetch RAG Endpoint with cURL Source: https://github.com/geldata/gel/blob/master/docs/intro/quickstart/ai/fastapi.rst This example demonstrates how to test the '/fetch_rag' endpoint using cURL. It sends a GET request with a sample query to the local FastAPI server. ```bash $ curl -X 'GET' \ 'http://localhost:8000/fetch_rag?query=what%20cheese%20smells%20like%20feet' \ -H 'accept: application/json' ``` -------------------------------- ### Connect and Query with EdgeDB JavaScript Driver Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/1_0_a2.rst Example of connecting to an EdgeDB instance and executing a simple query using the new JavaScript driver. Ensure you have the driver installed and an EdgeDB instance running. ```javascript const edgedb = require("edgedb"); async function main() { const conn = await edgedb.connect({ user: "edgedb", host: "127.0.0.1", }); try { console.log(await conn.fetchOne("select 1 + 1")); } finally { await conn.close(); } } main(); ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_flask.rst Clone the Gel examples repository and navigate to the flask-crud directory to begin. ```bash $ git clone git@github.com:geldata/gel-examples.git $ cd gel-examples/flask-crud ``` -------------------------------- ### Start Next.js Development Server Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/nextjs_app_router.rst Navigate to the newly created Next.js project directory and start the development server using npm, yarn, pnpm, or bun. ```bash cd nextjs-blog npm dev # or yarn dev or pnpm dev or bun run dev ``` -------------------------------- ### Gel Rust Client Global Variable Setup (Incomplete) Source: https://github.com/geldata/gel/blob/master/docs/reference/datamodel/access_policies.rst This Rust code snippet shows the import of necessary types for working with Gel, including Uuid and EnumValue. It is a starting point for setting global variables in the Rust client. ```rust use gel_protocol::{ model::Uuid, value::EnumValue }; ``` -------------------------------- ### Initialize Local Gel Instance Source: https://github.com/geldata/gel/blob/master/docs/intro/localdev.rst Run this command in your project root to create a database tied to the current directory and gel.toml file. This simplifies connection configuration. ```bash $ gel init ``` -------------------------------- ### Install Gel 6 on Debian/Ubuntu Source: https://github.com/geldata/gel/blob/master/docs/resources/upgrading.rst Installs Gel 6 on Debian/Ubuntu systems by adding the Gel package repository and then installing the `gel-6` package. ```bash $ echo deb [signed-by=/usr/local/share/keyrings/gel-keyring.gpg] \ https://packages.geldata.com/apt \ $(grep "VERSION_CODENAME=" /etc/os-release | cut -d= -f2) main \ | sudo tee /etc/apt/sources.list.d/gel.list $ sudo apt-get update && sudo apt-get install gel-6 ``` -------------------------------- ### Initialize Project Database with Migration Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/1_0_b1.rst Initializes the project database and creates the first migration file using the CLI. Follow the interactive prompts to confirm schema changes. ```bash $ gel -I chatapp create-migration --schema-dir app_schema did you create object type 'default::User'? [y,n,l,c,b,s,q,?] ? y - confirm the prompt, use the DDL statements n - reject the prompt l - list the DDL statements associated with prompt c - list already confirmed EdgeQL statements b - revert back to previous save point, perhaps previous question s - stop and save changes (splits migration into multiple) q - quit without saving changes h or ? - print help did you create object type 'default::User'? [y,n,l,c,b,s,q,?] y did you create object type 'default::Message'? [y,n,l,c,b,s,q,?] y Created app_schema/migrations/00001.edgeql, id: m1ufwaxcqiwcq3ttcujnxv6f3jewhfrywc442z6gjk3sm3e5fgyr4q ``` -------------------------------- ### Install tRPC Dependencies Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/trpc.rst Install the necessary tRPC server and client packages. Optionally install the React Query wrapper for React projects. ```bash $ pnpm add @trpc/server @trpc/client $ # or yarn add @trpc/server @trpc/client $ # or npm install @trpc/server @trpc/client $ # or bun add @trpc/server @trpc/client ``` ```bash $ pnpm add @trpc/react-query $ # or yarn add @trpc/react-query $ # or npm install @trpc/react-query $ # or bun add @trpc/react-query ``` -------------------------------- ### Install Dependencies Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/graphql_apis_with_strawberry.rst Set up a Python 3.10 virtual environment and install the necessary project dependencies including Gel, FastAPI, Strawberry GraphQL, and Uvicorn. ```bash python3.10 -m venv .venv source .venv/bin/activate pip install gel fastapi strawberry-graphql uvicorn[standard] ``` -------------------------------- ### Install EdgeDB 5 on CentOS/RHEL Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/5_x.rst Install EdgeDB 5.0 on CentOS/RHEL systems using yum. This command installs the EdgeDB 5 package from the configured repositories. ```bash sudo yum install edgedb-5 ``` -------------------------------- ### Manage Gel Instances Source: https://context7.com/geldata/gel/llms.txt Use these commands to create, start, stop, destroy, list, and view logs for Gel instances. ```bash gel instance create my-instance # create local instance ``` ```bash gel instance start my-instance # start instance ``` ```bash gel instance stop my-instance # stop instance ``` ```bash gel instance destroy my-instance # delete instance ``` ```bash gel instance list # list all instances ``` ```bash gel instance logs my-instance # tail instance logs ``` -------------------------------- ### Install Standalone Extension CLI Source: https://github.com/geldata/gel/blob/master/docs/reference/datamodel/extensions.rst Install a standalone extension, such as 'postgis', using the 'gel extension install' command. This process includes downloading and applying the extension. ```bash $ gel extension install postgis ``` -------------------------------- ### Install EdgeDB 5 on Debian/Ubuntu Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/5_x.rst Install EdgeDB 5.0 on Debian/Ubuntu systems after configuring the APT repository. This command fetches and installs the latest EdgeDB 5 package. ```bash sudo apt-get update && sudo apt-get install edgedb-5 ``` -------------------------------- ### Start Gel Container with PostgreSQL Source: https://github.com/geldata/gel/blob/master/docs/reference/running/deployment/azure_flexibleserver.rst Creates and starts a Gel container using Azure Container Instances. It configures the container with database connection details and environment variables. ```bash $ PG_HOST=$( \ az postgres flexible-server list \ --resource-group $GROUP \ --query "[?name=='$PG_SERVER_NAME'].fullyQualifiedDomainName | [0]" \ --output tsv \ ) $ DSN="postgresql://gel_admin:$PASSWORD@$PG_HOST/postgres?sslmode=require" $ az container create \ --registry-username $DOCKER_USER \ --registry-password $DOCKER_PASSWORD \ --registry-login-server index.docker.io \ --os-type Linux \ --cpu 1 \ --memory 1 \ --resource-group $GROUP \ --name gel-container-group \ --image geldata/gel \ --dns-name-label geldb \ --ports 5656 \ --secure-environment-variables \ "GEL_SERVER_PASSWORD=$PASSWORD" \ "GEL_SERVER_BACKEND_DSN=$DSN" \ --environment-variables \ GEL_SERVER_TLS_CERT_MODE=generate_self_signed ``` -------------------------------- ### Clone FastAPI Starter Template and Initialize Project Source: https://github.com/geldata/gel/blob/master/docs/intro/quickstart/setup/fastapi.rst Clone the FastAPI starter template, set up a Python virtual environment, install requirements, and initialize the Gel project. Ensure you activate the virtual environment before running the initialization command. ```sh $ git clone \ git@github.com:geldata/quickstart-fastapi.git \ flashcards $ cd flashcards $ python -m venv venv $ source venv/bin/activate # or venv\Scripts\activate on Windows $ pip install -r requirements.txt $ uvx gel project init ``` -------------------------------- ### Insert Person Example Source: https://github.com/geldata/gel/blob/master/docs/reference/datamodel/triggers.rst Example of inserting a Person object into the database. ```edgeql-repl db> insert Person {name := 'Quincey Morris'}; {default::Person {id: e4a55480-d2de-11ed-93bd-9f4224fc73af}} ``` ```edgeql-repl db> insert Person {name := 'Dracula'}; {default::Person {id: e7f2cff0-d2de-11ed-93bd-279780478afb}} ``` -------------------------------- ### Start Gel REPL Source: https://github.com/geldata/gel/blob/master/docs/intro/quickstart/setup/fastapi.rst Start the Gel REPL from the project root to explore the empty database. This command allows you to interact with your Gel instance and run queries. ```sh $ uvx gel ``` -------------------------------- ### Install @gel/generate Dev Dependency Source: https://github.com/geldata/gel/blob/master/docs/reference/using/js/interfaces.rst Install the '@gel/generate' package as a dev dependency. ```bash $ npm install @gel/generate --save-dev # npm users $ yarn add @gel/generate --dev # yarn users $ pnpm add --dev @gel/generate # pnpm users $ bun add --dev @gel/generate # bun users $ deno add --dev npm:@gel/generate # deno users ``` -------------------------------- ### Install GEL Client and Generator Packages Source: https://github.com/geldata/gel/blob/master/docs/reference/using/js/index.rst Install the GEL database client and the optional generator package using npm, yarn, pnpm, bun, or deno. ```bash $ npm install --save-prod gel # database client $ npm install --save-dev @gel/generate # generators ``` ```bash $ yarn add gel # database client $ yarn add --dev @gel/generate # generators ``` ```bash $ pnpm add --save-prod gel # database client $ pnpm add --save-dev @gel/generate # generators ``` ```bash $ bun add gel # database client $ bun add --dev @gel/generate # generators ``` ```bash $ deno add npm:gel # database client $ deno add --dev npm:@gel/generate # generators ``` -------------------------------- ### Install Gel Package (CentOS/RHEL) Source: https://github.com/geldata/gel/blob/master/docs/reference/running/deployment/bare_metal.rst Install the Gel package using yum. ```bash $ sudo yum install gel-6 ``` -------------------------------- ### Create Development Directory and Clone Repository Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/contributing/code.rst Sets up the project directory and clones the Gel repository with all submodules. This is the initial step for local development. ```bash $ mkdir ~/dev $ cd ~/dev $ git clone --recursive https://github.com/geldata/gel.git ``` -------------------------------- ### Install Gel Source: https://github.com/geldata/gel/blob/master/docs/intro/tutorials/gel_drizzle_booknotes.rst Installs the Gel library for database access within the project. ```bash npm i gel ``` -------------------------------- ### Build Gel and Install Development Tools Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/contributing/code.rst Compiles Gel and installs development tools like 'edb' and '|gelcmd|' into the active Python virtual environment. This command also installs testing libraries. ```bash $ cd gel $ pip install -v -e ".[test]" ``` -------------------------------- ### Initialize Gel Project Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/nextjs_app_router.rst Initialize a new Gel project from the application's root directory using the npx gel command. This sets up the project configuration and instance. ```bash npx gel project init No `gel.toml` found in `~/nextjs-blog` or above Do you want to initialize a new project? [Y/n] > Y Specify the name of Gel instance to use with this project [default: nextjs_blog]: > nextjs_blog Checking Gel versions... Specify the version of Gel to use with this project [default: x.x]: > ┌─────────────────────┬──────────────────────────────────────────────┐ │ Project directory │ ~/nextjs-blog │ │ Project config │ ~/nextjs-blog/gel.toml │ │ Schema dir (empty) │ ~/nextjs-blog/dbschema │ │ Installation method │ portable package │ │ Start configuration │ manual │ │ Version │ x.x │ │ Instance name │ nextjs_blog │ └─────────────────────┴──────────────────────────────────────────────┘ Initializing Gel instance... ``` -------------------------------- ### Handle Sign-up and Sign-in Routes Source: https://github.com/geldata/gel/blob/master/docs/reference/auth/email_password.rst Sets up basic HTTP server routes for user sign-up and sign-in. This is a foundational part of handling authentication requests from a custom UI. ```javascript const server = http.createServer(async (req, res) => { const requestUrl = getRequestUrl(req); switch (requestUrl.pathname) { case "/auth/signup": { await handleSignUp(req, res); break; } case "/auth/signin": { await handleSignIn(req, res); ``` -------------------------------- ### Start Migration Transaction Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/migrations/guide.rst Initiates a migration process by starting a transaction with the target schema. ```edgeql-repl db> start migration to { }; ``` -------------------------------- ### Install Gel Generator Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/nextjs_app_router.rst Install the Gel code generator as a development dependency in your project. ```bash $ npm install --save-dev @gel/generate $ # or yarn add --dev @gel/generate $ # or pnpm add --dev @gel/generate $ # or bun add --dev @gel/generate ``` -------------------------------- ### Initialize a new EdgeDB project Source: https://github.com/geldata/gel/blob/master/docs/resources/changelog/4_x.rst Use this command to set up a new EdgeDB project. Ensure the CLI is installed first. ```bash $ edgedb project init ``` -------------------------------- ### Install Gel Package Source: https://github.com/geldata/gel/blob/master/docs/reference/using/js/interfaces.rst Install the 'gel' package using your preferred package manager. ```bash $ npm install gel # npm users $ yarn add gel # yarn users $ pnpm add gel # pnpm users $ bun add gel # bun users $ deno add npm:gel # deno users ``` -------------------------------- ### Launch Gel UI Source: https://github.com/geldata/gel/blob/master/docs/intro/quickstart/modeling/nextjs.rst Start the built-in Gel UI to visualize the data model and inspect the created object types and links in the database. ```sh $ npx gel ui ``` -------------------------------- ### Install Gel Package (Debian/Ubuntu) Source: https://github.com/geldata/gel/blob/master/docs/reference/running/deployment/bare_metal.rst Update your package list and install the Gel package. ```bash $ sudo apt-get update && sudo apt-get install gel-6 ``` -------------------------------- ### Initialize a New Gel Project Source: https://github.com/geldata/gel/blob/master/docs/reference/using/projects.rst Run `gel project init` in your codebase's root directory to create a new Gel project. This command prompts for Gel version and instance name, links the directory to the instance, and sets up necessary schema files. ```bash $ gel project init No `gel.toml` found in this repo or above. Do you want to initialize a new project? [Y/n] > Y Checking Gel versions... Specify the version of Gel to use with this project [6.4]: > # left blank for default Specify the name of Gel instance to use with this project: > my_instance Initializing Gel instance... Bootstrap complete. Server is up and running now. Project initialialized. ``` -------------------------------- ### Install @gel/ai Package Source: https://github.com/geldata/gel/blob/master/docs/reference/ai/javascript.rst Install the @gel/ai package using your preferred package manager. ```bash $ npm install @gel/ai ``` ```bash $ yarn add @gel/ai ``` ```bash $ pnpm add @gel/ai ``` ```bash $ bun add @gel/ai ``` -------------------------------- ### EdgeQL Code Block Example Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/contributing/documentation.rst Example of rendering an EdgeQL code block for queries. ```rst .. code-block:: edgeql select BlogPost filter .id = $blog_id; ``` -------------------------------- ### Clone and Initialize Next.js Project Source: https://github.com/geldata/gel/blob/master/docs/intro/quickstart/setup/nextjs.rst Clone the Next.js starter template, install dependencies, and initialize the Gel project. This sets up your local environment for building the application. ```sh $ git clone \ git@github.com:geldata/quickstart-nextjs.git \ flashcards $ cd flashcards $ npm install $ npx gel project init ``` -------------------------------- ### Create Project Directory Source: https://github.com/geldata/gel/blob/master/docs/resources/guides/tutorials/rest_apis_with_fastapi.rst Set up a new directory for your FastAPI and Gel project. ```bash mkdir fastapi-crud cd fastapi-crud ```