### Install Framer API Node Package Source: https://www.framer.com/developers/server-api-quick-start/index Installs the Framer Server API Node.js package using npm. This is the first step to integrating the API into your project. ```bash npm i framer-api ``` -------------------------------- ### Connect to Framer Server API (JavaScript/TypeScript) Source: https://www.framer.com/developers/server-api-quick-start/index Establishes a connection to the Framer Server API using an API key and project URL. It demonstrates fetching project information and properly disconnecting from the API. ```javascript import { connect } from "framer-api" const framer = await connect( "https://framer.com/projects/", // Can be project id or url process.env.FRAMER_API_KEY // Your previously created API key ) const projectInfo = await framer.getProjectInfo() console.log(`Project: ${projectInfo.name}`) // Closes down the server API. // If you don't do this, your script won't finish executing. await framer.disconnect() ``` -------------------------------- ### Publish and Deploy Changes with Framer API (JavaScript) Source: https://www.framer.com/developers/server-api-quick-start/index Connects to the Framer API, retrieves changed paths, publishes a new preview, and deploys the changes to production. Requires project URL and API key. ```javascript import { connect } from "framer-api" // Make a connection based on your credentials const framer = await connect(projectUrl, process.env.FRAMER_API_KEY) // Get a list of current changes compared to the last publish const changes = await framer.getChangedPaths() console.log(changes) // { added: ..., removed: ..., modified: ... } // Publish a new preview link with all the changes const result = await framer.publish() console.log(result) // { deployment: ..., hostnames: ... } // If everything looks good promote that version to production await framer.deploy(result.deployment.id) ``` -------------------------------- ### Connect to Framer Server API with 'using' syntax (TypeScript 5.2+) Source: https://www.framer.com/developers/server-api-quick-start/index Demonstrates connecting to the Framer Server API using the 'using' syntax available in TypeScript 5.2+, which automatically handles disconnection. ```typescript using framer = await connect( "https://framer.com/projects/", process.env.FRAMER_API_KEY ) // No need to call framer.disconnect() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.