### Install Dependencies and Run Development Server Source: https://github.com/ethyca/fides/blob/main/clients/sample-app/README.md Installs project dependencies and starts the development server for the Fides Sample App. Ensure Docker is running locally for the database setup. ```bash npm install npm run dev ``` -------------------------------- ### Example: Install React in Admin UI Workspace Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/overview.md Demonstrates how to install the 'react' package specifically into the 'admin-ui' workspace. This command should be executed from the 'clients' directory. ```sh npm install react --workspace=admin-ui ``` -------------------------------- ### Install and Start Redis Source: https://github.com/ethyca/fides/blob/main/IMPLEMENTATION-REPORT.md Install the redis-server package and start the Redis service. This is necessary as Fides uses Redis for caching, locks, and rate limiting. ```bash sudo apt-get install -y redis-server sudo service redis-server start ``` -------------------------------- ### Install PostgreSQL Source: https://github.com/ethyca/fides/blob/main/IMPLEMENTATION-REPORT.md Install PostgreSQL and its client, then start the service. This is a prerequisite for running Fides tests locally. ```bash sudo apt-get update sudo apt-get install -y postgresql postgresql-client sudo service postgresql start ``` -------------------------------- ### Install Fides with uv Source: https://github.com/ethyca/fides/blob/main/README.md Use uv to install the Fides package and manage virtual environments. Ensure uv is installed first. ```bash uv pip install ethyca-fides ``` -------------------------------- ### Extended GET /connection List Response Example Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/system-integration-link/02-technical-design.md Illustrates the JSON response structure for the GET /api/v1/connection list endpoint, now including a 'linked_systems' field for each connection configuration. ```json { "items": [ { "key": "my_postgres", "name": "My Postgres", "connection_type": "postgres", "linked_systems": [ { "fides_key": "my_system", "name": "My System" } ], ... } ] } ``` -------------------------------- ### Install Local Dependencies Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/privacy_center.md Run this command in the root `client` directory to install local dependencies for the Privacy Center. ```bash npm install ``` -------------------------------- ### Example Credentials Section Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/config/index.md Shows an example of the credentials section in a Fides TOML configuration file, including a database connection string. ```toml [credentials] app_postgres = {connection_string="postgresql+psycopg2://postgres:fides@fides-db:5432/fides"} ``` -------------------------------- ### Run Development Server Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/privacy_center.md Navigate to the `privacy-center` directory and run this command to build and start the development server. ```bash cd privacy-center turbo run dev ``` -------------------------------- ### Run Admin UI in Development Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/admin_ui.md Navigate to the admin-ui directory and start the development server. Access the UI at http://localhost:3000/. ```sh cd clients npm install cd admin-ui turbo run dev ``` -------------------------------- ### Install Fides with MSSQL Support Source: https://github.com/ethyca/fides/blob/main/README.md Use this command to install Fides with all optional libraries, including those required for Microsoft SQL Server support. This requires prior installation of system dependencies like freetds and openssl. ```zsh uv pip install "ethyca-fides[all]" ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/code_style.md Install git pre-commit hooks to automatically run CI checks before pushing changes. This command should be run once after installing `dev-requirements.txt`. ```bash pre-commit install ``` -------------------------------- ### Fides String Example (All Parts) Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesOptions.md Provides a complete example of the fides_string format, including TC, AC, GPP, and Notice Consent strings. ```string "CPzHq4APzHq4AAMABBENAUEAALAAAEOAAAAAAEAEACACAAAA,2~61.70~dv.33,DBABLA~BVAUAAAAAWA.QA,eyJkYXRhX3NhbGVzX2FuZF9zaGFyaW5nIjowLCJhbmFseXRpY3MiOjF9" ``` -------------------------------- ### Run Cypress with Production Build Source: https://github.com/ethyca/fides/blob/main/clients/admin-ui/cypress/README.md Start the web application in a production-like test mode for faster execution, then open Cypress in UI mode. ```bash turbo run cy:start turbo run cy:open ``` -------------------------------- ### Full Development and Test Setup Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/privacy_center.md Run these commands in separate terminals for a complete development and testing environment, including the Privacy Center and Cypress. ```bash cd privacy-center && turbo run dev cd privacy-center && turbo run cy:open ``` -------------------------------- ### Run Cypress with Development Build Source: https://github.com/ethyca/fides/blob/main/clients/admin-ui/cypress/README.md Start the web application in development mode and then open Cypress in UI mode for interactive testing. ```bash turbo run start turbo run cy:open ``` -------------------------------- ### Identity Example Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Example of the identity object, which contains user identification values, specifically a copy of the fides user device ID. ```json { "fides_user_device_id": "1234-" } ``` -------------------------------- ### Install Development Libraries for MSSQL on macOS Source: https://github.com/ethyca/fides/blob/main/README.md These commands install the necessary development libraries (freetds and openssl) for Microsoft SQL Server support on macOS using Homebrew. Ensure you have Homebrew installed. ```zsh brew install freetds openssl ``` -------------------------------- ### Run Interactive Test Interface Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/privacy_center.md Start the interactive test interface for the Privacy Center by running this command. ```bash turbo run test ``` -------------------------------- ### Test Production Admin UI Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/admin_ui.md Start the Fides development environment and visit the specified URL to test the production-ready Admin UI. ```sh nox -s dev ``` -------------------------------- ### Example Celery Configuration Section Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/config/index.md Illustrates how to configure Celery settings within the Fides TOML configuration file. These settings are passed through to the Celery deployment. ```toml [celery] event_queue_prefix = "fides_worker" task_default_queue = "fides" task_always_eager = true ``` -------------------------------- ### Verify Fides installation Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/developing_fides.md Checks if the `fides` package is installed in the current environment. This is a useful verification step after installation or troubleshooting. ```shell pip list | grep fides ``` -------------------------------- ### Fides String Example (GPP Only) Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesOptions.md Shows the fides_string format when only the GPP string is present. Note the leading commas. ```string ",,DBABLA~BVAUAAAAAWA.QA" ``` -------------------------------- ### Example Regions Configuration Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesExperienceConfig.md Illustrates the format for specifying applicable regions for a privacy experience. This array of strings corresponds to predefined region codes. ```typescript [ "us_ca", "us_co", "us_ct", "us_ut", "us_va", "us_or", "us_tx" ] ``` -------------------------------- ### Fides String Example (TC and AC Only) Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesOptions.md Demonstrates the fides_string format when only TC and AC strings are present. ```string "CPzHq4APzHq4AAMABBENAUEAALAAAEOAAAAAAEAEACACAAAA,2~61.70~dv.33" ``` -------------------------------- ### Geolocation Example Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md An example of the structure for the detected geolocation object, which Fides uses to tailor the user experience. ```json { "country": "ca", "location": "ca-on", "region": "on" } ``` -------------------------------- ### FidesEvent Preference Examples Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesEvent.md Examples demonstrating the structure of the `preference` object for different types of consent changes, including notices, TCF purposes, and TCF vendors. ```typescript preference: { key: "advertising", type: "notice" } ``` ```typescript preference: { key: "tcf_purpose_consent_4", type: "tcf_purpose_consent" } ``` ```typescript preference: { key: "gvl.2", type: "tcf_vendor_consent", vendor_id: "gvl.2", vendor_list: "gvl", vendor_list_id: "2", vendor_name: "Captify" } ``` -------------------------------- ### Fides String Example (Notice Consent Only) Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesOptions.md Illustrates the fides_string format when only the Notice Consent string is present. Note the leading commas. ```string ",,,eyJkYXRhX3NhbGVzX2FuZF9zaGFyaW5nIjowLCJhbmFseXRpY3MiOjF9" ``` -------------------------------- ### Verify PostgreSQL Connection Source: https://github.com/ethyca/fides/blob/main/IMPLEMENTATION-REPORT.md Test the connection to the local PostgreSQL instance using the created user and password. This confirms the database setup is correct. ```bash PGPASSWORD=fides psql -h 127.0.0.1 -U postgres -d fides_test -c "SELECT 1;" ``` -------------------------------- ### Listening for FidesUpdated Event Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesEvent.md Example of how to listen for the `FidesUpdated` event and check the `consentMethod` from the `extraDetails`. ```javascript window.addEventListener("FidesUpdated", (evt) => { if (evt.detail.extraDetails?.consentMethod === "accept") { console.log("Current user clicked the 'Accept' button!"); } }); ``` -------------------------------- ### Get help for a specific Nox session Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/developing_fides.md To understand the usage and parameters of a specific Nox session, use the `usage` session followed by the session name. This provides detailed documentation for the session. ```shell nox -s usage -- build ``` -------------------------------- ### Create Changelog Entry Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/releases.md Example of a changelog entry file in YAML format. This file should be placed in the `changelog/` directory and named after the PR number or a descriptive slug. ```yaml type: Added description: Added editable GPC translation fields to privacy experience configuration pr: 7137 labels: [] ``` -------------------------------- ### Example Resurface Behavior Configuration Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesExperienceConfig.md Demonstrates how to configure when the consent banner should resurface after user interaction. Options include resurfacing on 'reject', 'dismiss', both, or null for default behavior. ```typescript ["reject"] // Resurface only on reject ``` ```typescript ["dismiss"] // Resurface only on dismiss ``` ```typescript ["reject", "dismiss"] // Resurface on both ``` ```typescript null // Default behavior (no resurfacing) ``` -------------------------------- ### Checkout Latest Release Tag (Combined) Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/releases.md Combines fetching the latest tag and checking it out into a single command. This is a convenient way to start working from the most recent release. ```sh # fides on main git checkout $(git describe --abbrev=0 --tags) #=> Note: switching to '1.2.3'. # # You are in 'detached HEAD' state. You can look around, make experimental # changes and commit them, and you can discard any commits you make in this # state without impacting any branches by switching back to a branch. # # If you want to create a new branch to retain commits you create, you may # do so (now or later) by using -c with the switch command. Example: # # git switch -c # # Or undo this operation with: # # git switch - # # Turn off this advice by setting config variable advice.detachedHead to false # # HEAD is now at 0123abcd Commit Message ``` -------------------------------- ### Manual State Management (Before Migration) Source: https://github.com/ethyca/fides/blob/main/clients/admin-ui/src/features/common/table/hooks/README.md Example of manual state management for a table before migrating to hooks. This includes separate state variables for pagination, selection, and other table-related configurations, which can become cumbersome for complex tables. ```tsx const [pageIndex, setPageIndex] = useState(1); const [pageSize, setPageSize] = useState(25); const [selectedRows, setSelectedRows] = useState([]); // ... 100+ lines of state management ``` -------------------------------- ### Configure Environment Variables for MSSQL Development Source: https://github.com/ethyca/fides/blob/main/README.md Add these lines to your shell configuration file (e.g., .zshrc) to set environment variables for the compiler to find the freetds and openssl libraries. Update paths and versions to match your local installation. ```zsh export LDFLAGS="-L/opt/homebrew/opt/freetds/lib -L/opt/homebrew/opt/openssl/lib" export CFLAGS="-I/opt/homebrew/opt/freetds/include" ``` -------------------------------- ### Get Latest Release Tag Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/releases.md Fetches the name of the most recent tag in the repository. This is useful for identifying the starting point for a patch release. ```sh # fides on main git describe --abbrev=0 --tags #=> 1.2.3 ``` -------------------------------- ### Serve Fides Documentation Locally Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/documentation.md Run this command to build and serve the Fides documentation locally. The documentation will be available at `localhost:8080/fides` and will hot-reload on changes. ```bash nox -s docs_serve ``` -------------------------------- ### Install Fides in development mode Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/developing_fides.md If `fides` is not properly installed when running `nox -s dev`, this command installs it in editable mode within the container. This is a common fix for `importlib.metadata.PackageNotFoundError`. ```shell nox -s dev -- shell ``` ```shell uv pip install -e . ``` -------------------------------- ### Docstring Examples Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/code_style.md Docstrings are required for functions, classes, and methods to provide additional context beyond type hints and parameter names. The 'Good' example shows descriptive context, while the 'Bad' example is too brief. ```python # Bad def execute_evaluation(taxonomy: Taxonomy) -> Evaluation: """ Execute an evaluation. """ # Good def execute_evaluation(taxonomy: Taxonomy) -> Evaluation: """ Check the stated constraints of each Privacy Policy's rules against each system's privacy declarations. """ ``` -------------------------------- ### Startup Task Logic for Envelope Encryption Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/encryption/implementation-plan.md Illustrates the logic flow for initializing envelope encryption on application startup. It handles first-time bootstrap, normal operation, and KEK rotation scenarios by interacting with a key provider and the encryption_keys table. ```python startup_envelope_encryption(): config = get_config() if config.security.key_provider == "none": return # legacy mode, nothing to do provider = _build_key_provider(config.security) row = read active row from encryption_keys table if row is None: # --- First-time bootstrap --- # Wrap the existing app_encryption_key with the configured KEK # and insert the first row. After this deploy succeeds, # app_encryption_key can be removed from the environment. wrapped_blob = provider.wrap(config.security.app_encryption_key) insert row: wrapped_dek=wrapped_blob, kek_id_hash=provider.kek_id_hash(), provider=... return if row.kek_id_hash == provider.kek_id_hash(): # --- Normal operation --- # KEK hasn't changed, nothing to do. return # --- KEK rotation detected --- # The row was wrapped with a different KEK than the current one. # Cache the DEK immediately (using the old KEK) so no request # fails during the re-wrap. old_kek = config.security.key_encryption_key_previous # local provider dek = provider.unwrap_with(row.wrapped_dek, old_kek) _cache_dek(dek) # warm the cache before re-wrapping # Re-wrap with the current KEK and update the row. new_blob = provider.wrap(dek) update row: wrapped_dek=new_blob, kek_id_hash=provider.kek_id_hash() ``` -------------------------------- ### Create PostgreSQL Databases and User Source: https://github.com/ethyca/fides/blob/main/IMPLEMENTATION-REPORT.md Set up the 'postgres' user password and create the 'fides' and 'fides_test' databases. These are required for Fides to operate and run tests. ```bash sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'fides';" sudo -u postgres psql -c "CREATE DATABASE fides;" sudo -u postgres psql -c "CREATE DATABASE fides_test;" ``` -------------------------------- ### Deploy Fides Sample Project Source: https://github.com/ethyca/fides/blob/main/README.md Deploy the bundled Fides sample project, which includes a server, privacy center, and sample application for testing data subject requests. ```bash uv run fides deploy up ``` -------------------------------- ### Locale Example Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Example of the locale string, representing the detected i18n locale used by Fides to set the user-facing language. ```string "en" ``` -------------------------------- ### Get Specific Database Row Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/development_tips.md Retrieve a single row from a table based on a specific condition using the `get()` method. ```python user = db.query(User).get(User.email == "admin@fides.app") ``` -------------------------------- ### Set Database Host via Environment Variable Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/config/index.md Demonstrates how to set a TOML configuration value using an environment variable. Environment variables follow the pattern FIDES____. ```sh EXPORT FIDES__DATABASE__HOST=config_example ``` -------------------------------- ### Fides.js Initialization and Event Handling Source: https://github.com/ethyca/fides/blob/main/clients/privacy-center/public/fides-js-demo.html This script initializes Fides.js and sets up event listeners for 'FidesReady', 'FidesUpdated', and 'FidesUIShown'. It logs initialization status, updates consent display, and logs performance metrics when the UI is shown. Ensure Fides.js is loaded before this script. ```javascript (() => { const hasFides = typeof Fides === "object"; document.getElementById("has-fides").textContent = String(hasFides); if (!hasFides) { return; } const onInitialized = () => { console.log("Fides has been initialized!"); document.getElementById("consent-json").textContent = JSON.stringify( Fides.consent, null, 2, ); if (Fides.experience && Object.keys(Fides.experience).length > 10) { const tree = jsonview.create(Fides.experience); jsonview.render(tree, document.getElementById("consent-experience")); } else { document.getElementById("consent-experience").textContent = JSON.stringify(Fides.experience, null, 2); } document.getElementById("consent-geolocation").textContent = JSON.stringify(Fides.geolocation, null, 2); document.getElementById("consent-options").textContent = JSON.stringify( Fides.options, null, 2, ); document.getElementById("property-id").textContent = JSON.stringify( Fides.config.propertyId, null, 2, ); Fides.meta({ consent: Fides.consent.tracking, dataUse: Fides.consent.data_sales, }); }; if (Fides.initialized) { onInitialized(); } else { window.addEventListener("FidesReady", onInitialized); } window.addEventListener("FidesUpdated", () => { console.log("Fides has been updated"); document.getElementById("consent-json").textContent = JSON.stringify( Fides.consent, null, 2, ); }); window.addEventListener("FidesUIShown", () => { const fidesLoaded = performance .getEntriesByType("resource") .find((entry) => entry.name.includes("fides")); const fidesEvents = performance .getEntriesByType("mark") .filter((entry) => entry.name.includes("Fides")); const fidesTiming = {}; fidesTiming[ `fides.js (${(fidesLoaded.encodedBodySize / 1000).toFixed(2)} kB)` ] = { "Time (ms)": parseFloat(fidesLoaded.responseEnd.toFixed(2)), }; fidesEvents.map((entry) => { const name = entry.name; fidesTiming[name] = { "Time (ms)": parseFloat(entry.startTime.toFixed(2)), }; }); console.table(fidesTiming); }); })(); ``` -------------------------------- ### Launch Fides Test Environment Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/testing.md Use this command to launch the complete Fides testing environment, including the server, UI, databases, and sample applications. Read terminal output for details and customize environment variables by editing the `.env` file. ```bash nox -s "fides_env(test)" ``` -------------------------------- ### Register Backfill in post_upgrade_backfill.py Source: https://github.com/ethyca/fides/blob/main/src/fides/api/migrations/backfill_scripts/README.md Import and include your backfill function in the `run_all_backfills` function to ensure it is executed after an upgrade. ```python from fides.api.migrations.backfill_scripts.backfill_my_column import backfill_my_column def run_all_backfills(...): results.append(backfill_my_column(db, batch_size, batch_delay_seconds)) ``` -------------------------------- ### Build Privacy Center Application Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/privacy_center.md Execute this command to build the Privacy Center application. Build artifacts are output to the `.next` directory. ```bash turbo run build ``` -------------------------------- ### Custom Exception Handling in Python Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/development_tips.md Example of defining and raising a custom exception by inheriting from a built-in exception class. ```python class SomeException(ValueError): "a docstring" def some_method(): raise SomeException("a message") ``` -------------------------------- ### SQL Update Statement Generation Source: https://github.com/ethyca/fides/blob/main/src/fides/api/service/connectors/query_configs/README.md An example of the generated SQLAlchemy Update object, translated into a BigQuery SQL UPDATE statement. ```sql UPDATE `project_id.dataset_id.table_name` SET profile = { "name": "John Doe", "email": "REDACTED", "preferences": { "theme": "dark", "notifications": null }, "tags": [] } WHERE user_id = 123 ``` -------------------------------- ### Set System Links Response (200 OK) Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/system-integration-link/02-technical-design.md A successful response for setting system links returns a flat list of link objects, including `system_fides_key`, `system_name`, and `created_at`. ```json [ { "system_fides_key": "my_system", "system_name": "My System", "created_at": "2026-02-18T12:00:00Z" } ] ``` -------------------------------- ### Install Package in Specific Workspace Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/overview.md Add a new package to a specific workspace within the monorepo. Ensure you are in the 'clients' directory when running this command. ```sh npm install --workspace= ``` -------------------------------- ### Accessing Fides API Documentation Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/api/index.md You can view the live, interactive API documentation for Fides by visiting the `/docs` endpoint on a running Fides instance. This allows for direct experimentation with the APIs using Swagger's built-in 'Try it out' functionality. ```APIDOC ## Accessing the API ### Description To access the live, interactive API documentation for Fides, navigate to the `/docs` endpoint on a running Fides instance. This interface, powered by Swagger, allows you to directly experiment with the API endpoints. ### Endpoint `/docs` ### Notes - The embedded API documentation on this page serves as a reference and does not connect to a live instance, so 'Try it out' and 'Authorize' buttons will not function. - All API routes support both with and without a trailing slash (e.g., `/api/v1/config` and `/api/v1/config/` are equivalent). ``` -------------------------------- ### init() Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Initializes FidesJS with an initial configuration object. It can be called manually to delay initialization or to reinitialize FidesJS with updated options. ```APIDOC ## init() ### Description Initializes FidesJS with an initial configuration object. It can be called manually to delay initialization or to reinitialize FidesJS with updated options. ### Method `init` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config** (any) - Optional configuration object for FidesJS. ### Request Example ```html ``` ```html ``` ### Response #### Success Response (200) `Promise` #### Response Example None ``` -------------------------------- ### Run the default Nox session Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/developing_fides.md Executing `nox` without any arguments runs the default session, which typically opens the project's documentation page. ```shell nox ``` -------------------------------- ### Fides Consent String Example Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Logs the user's current consent string, which combines TCF, AC, GPP, and Notice Consent strings. ```typescript console.log(Fides.fides_string); // "CPzHq4APzHq4AAMABBENAUEAALAAAEOAAAAAAEAEACACAAAA,2~61.70~dv.33,DBABLA~BVAUAAAAAWA.QA,eyJkYXRhX3NhbGVzX2FuZF9zaGFyaW5nIjowLCJhbmFseXRpY3MiOjF9" ``` -------------------------------- ### Build Admin UI for Production Export Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/ui/admin_ui.md Build the Admin UI files for deployment with backend FidesOps. The output will be placed in a location accessible by backend deployments. ```sh cd clients npm install cd admin-ui turbo run prod-export ``` -------------------------------- ### Instantiate Database Session Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/development/development_tips.md Import the database session and instantiate the interaction object using `get_db_session`. ```python SessionLocal = get_db_session(config) db = SessionLocal() ``` -------------------------------- ### setIdentity Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Sets identity fields on the Fides consent cookie. This is useful for associating consent decisions with specific users, for example, by providing a custom user ID. ```APIDOC ## setIdentity(identity) ### Description Sets identity fields on the Fides consent cookie (e.g. a custom user ID). Call after [Fides.init](Fides.md#init); the values are persisted in the cookie and included in subsequent save/API requests (e.g. in `browser_identity.external_id`). Only `external_id` is supported today. Reserved keys (e.g. `fides_user_device_id`) and verified keys (e.g. `email`, `phone_number`) cannot be set and will throw; support for custom and verified identity keys is planned on the roadmap. Empty or whitespace-only `external_id` throws; omit the key to leave identity unchanged. ### Method `setIdentity(identity: { external_id?: string }) => Promise` ### Parameters #### Path Parameters - **identity** (object) - Required - Object with optional `external_id` string (trimmed before use; empty/whitespace-only throws) - **external_id** (string) - Optional - The external identifier for the user. ### Returns `Promise` - Promise that resolves when the cookie has been updated. ### Throws If Fides is not initialized, if external_id is empty or whitespace-only, or if an unsupported/reserved/verified key is provided. ### Examples Set a custom external ID after the user logs in: ```ts await Fides.setIdentity({ external_id: "user-123" }); ``` In HTML, call setIdentity when your app knows the user (e.g. after login): ```html ``` ``` -------------------------------- ### Build Go Shared Library Source: https://github.com/ethyca/fides/blob/main/pbac/README.md Build the Go shared library for the policy engine. This command should be run once before executing evaluations. ```bash cd policy-engine && go build -buildmode=c-shared -o libpbac.dylib ./cmd/libpbac/ && cd .. ``` -------------------------------- ### Business Logic Hook Example Source: https://github.com/ethyca/fides/blob/main/clients/admin-ui/src/features/common/table/hooks/README.md Encapsulates table logic, actions, and column definitions using `useTableState` and `useAntTable`. Use `antTable.selectedRows` and `antTable.resetSelections()` for bulk actions. ```tsx // hooks/useMyTable.tsx export const useMyTable = ({ filters }: Config) => { const tableState = useTableState({ // ...config }); const antTable = useAntTable(tableState, { // ...config }); // Business actions const handleBulkAction = useCallback(async () => { // Use antTable.selectedRows, antTable.resetSelections() }, [antTable.selectedRows]); return { ...antTable, searchQuery: tableState.searchQuery, updateSearch: tableState.updateSearch, handleBulkAction, columns: useMemo(() => [...], []), // Memoize columns }; }; ``` -------------------------------- ### Configure FidesJS Options Before Loading Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/FidesOptions.md Set FidesJS configuration options using the `window.fides_overrides` object before the Fides.js tag is loaded. This is useful for initial setup and customization. ```html ``` -------------------------------- ### View Configuration via CLI Source: https://github.com/ethyca/fides/blob/main/docs/fides/docs/config/index.md Command to view all current Fides configuration variables, including sensitive ones, printed as TOML. ```sh fides view config ``` -------------------------------- ### Pin Python Version with uv Source: https://github.com/ethyca/fides/blob/main/IMPLEMENTATION-REPORT.md Install and pin Python 3.13 for uv to use. This is required because uv defaulted to Python 3.14, causing build issues with snowflake-connector-python. ```bash uv python install 3.13 uv run --python 3.13 pytest ... ``` -------------------------------- ### Basic Shopify Integration with Fides.js Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Include the Fides.js script in your site's head and call the `Fides.shopify()` function to initialize the Shopify integration. ```html ``` -------------------------------- ### Fides Consent Object Example (Boolean) Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Represents user consent preferences for various privacy notices. Boolean values indicate opt-in (true) or opt-out (false). ```typescript { "data_sales_and_sharing": false } ``` ```typescript { "analytics": true, "marketing": false } ``` -------------------------------- ### Fides.js Initialization and Event Handling Source: https://github.com/ethyca/fides/blob/main/clients/privacy-center/public/fides-js-components-demo.html Sets up event listeners for Fides initialization and updates. It logs initialization messages and populates the page with Fides consent, experience, geolocation, options, and property ID details. This code should be placed after Fides.js is loaded. ```javascript (() => { const hasFides = typeof Fides === "object"; document.getElementById("has-fides").textContent = String(hasFides); if (!hasFides) { return; } const onInitialized = () => { console.log("Fides has been initialized!"); document.getElementById("consent-json").textContent = JSON.stringify( Fides.consent, null, 2, ); document.getElementById("consent-experience").textContent = JSON.stringify(Fides.experience, null, 2); document.getElementById("consent-geolocation").textContent = JSON.stringify(Fides.geolocation, null, 2); document.getElementById("consent-options").textContent = JSON.stringify( Fides.options, null, 2, ); document.getElementById("property-id").textContent = JSON.stringify( Fides.config.propertyId, null, 2, ); Fides.meta({ consent: Fides.consent.tracking, dataUse: Fides.consent.data_sales, }); }; if (Fides.initialized) { onInitialized(); } else { window.addEventListener("FidesInitialized", onInitialized); } window.addEventListener("FidesUpdated", () => { document.getElementById("consent-json").textContent = JSON.stringify( Fides.consent, null, 2, ); }); })(); ``` -------------------------------- ### Get Localized Modal Link Text Source: https://github.com/ethyca/fides/blob/main/clients/fides-js/docs/interfaces/Fides.md Retrieve the privacy link text in the user's current locale. To use the default locale, set `disableLocalization` to true. ```typescript console.log(Fides.getModalLinkLabel()); // "Tus preferencias de privacidad" ``` ```typescript console.log(Fides.getModalLinkLabel({ disableLocalization: true })); // "Your Privacy Choices" ```