### Install and Start Development Server Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/coin-gated/README.md Install project dependencies and start the development server for the coin-gated example. ```bash npm install npm run dev ``` -------------------------------- ### Navigate and Start Example App Source: https://github.com/audiusproject/apps/blob/main/packages/sdk/src/sdk/examples/README.md Navigate to the example directory and start the application using npm. ```sh cd npm start ``` -------------------------------- ### Install and Run Expo OAuth Example Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/auth-sign-in/README.md Instructions to set up and run the Expo OAuth example from the repository root. This includes installing dependencies, building the SDK, and starting the Expo development server. ```bash npm install npm run build -w @audius/sdk cd packages/mobile/examples/auth-sign-in cp .env.example .env # Edit .env: set EXPO_PUBLIC_AUDIUS_API_KEY to your API key npm install npx expo start ``` -------------------------------- ### Initialize Upload Example Environment Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/upload/README.md Commands to install dependencies and prepare the mobile upload example project. ```bash npm install npm run build -w @audius/sdk cd packages/mobile/examples/upload cp .env.example .env # Edit .env: EXPO_PUBLIC_AUDIUS_API_KEY npm install npx expo start ``` -------------------------------- ### Run Vite Development Server Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/trending/README.md Navigate to the example directory, install its dependencies, and start the Vite development server. ```bash cd packages/web/examples/trending npm install npm run dev ``` -------------------------------- ### Install and Run Audius Like/Repost Example Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/like-repost/README.md Steps to install dependencies, build the SDK, and run the example application. ```bash npm install npm run build -w @audius/sdk cd packages/mobile/examples/like-repost cp .env.example .env # Edit .env: EXPO_PUBLIC_AUDIUS_API_KEY npm install npx expo start ``` -------------------------------- ### Build SDK and start server Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/upload-server/README.md Commands to install dependencies, build the SDK, and start the backend server. ```bash npm install npm run build -w @audius/sdk cd packages/web/examples/upload/server cp .env.example .env # Edit .env: AUDIUS_API_KEY, AUDIUS_BEARER_TOKEN npm install npm start ``` -------------------------------- ### Expo App: SDK Setup and Trending Tracks Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/README.md Example demonstrating SDK setup and fetching trending tracks within an Expo app. Navigate to the 'trending' example directory and start the Expo development server. ```bash cd packages/mobile/examples/trending && npx expo start ``` -------------------------------- ### Install SDK and Run Server Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/update-profile/README.md Install dependencies, build the SDK, and start the Express server. Ensure your .env file is configured with API keys. ```bash npm install npm run build -w @audius/sdk cd packages/web/examples/update-profile/server cp .env.example .env # Edit .env: AUDIUS_API_KEY, AUDIUS_BEARER_TOKEN (from audius.co/settings) npm install npm start ``` -------------------------------- ### Run Expo Trending Example Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/trending/README.md Commands to install dependencies and start the Expo development server for the trending tracks example. Ensure you are in the example's directory. ```bash cd packages/mobile/examples/trending npm install npx expo start ``` -------------------------------- ### Install Dependencies and Build SDK Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/README.md Installs project dependencies, builds the Audius SDK, and navigates to the trending example directory. ```bash npm install npm run build -w @audius/sdk cd packages/web/examples/trending npm install npm run dev ``` -------------------------------- ### Run Mobile OAuth Example with npm Script Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/auth-sign-in/README.md A convenience npm script to run the mobile OAuth example after initial setup. ```bash npm run mobile:example:auth-sign-in ``` -------------------------------- ### Create Audius App Interactively Source: https://github.com/audiusproject/apps/blob/main/packages/create-audius-app/README.md Run this command to start an interactive project setup. You will be prompted for your project name, and dependencies will be installed automatically. ```bash npx create-audius-app ``` -------------------------------- ### Run Client Application Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/update-profile/README.md Install dependencies and start the Vite development server for the client application. Configure environment variables for API keys and the write server URL. ```bash cd packages/web/examples/update-profile cp .env.example .env # Edit .env: VITE_AUDIUS_API_KEY (same as server), VITE_WRITE_SERVER_URL=http://localhost:3001 npm install npm run dev ``` -------------------------------- ### Start Postgres Instance Source: https://github.com/audiusproject/apps/wiki/Discovery-Node:-Configuration-Details Starts a Postgres container with pre-configured user and database settings. ```bash docker run -d --network=disc-prov \ --name=disc-prov-postgres \ -p 4432:5432 \ -e "POSTGRES_USER=postgres" \ -e "POSTGRES_DB=discovery_provider" \ -v postgres_data:/var/lib/postgresql/data/ \ postgres:11.1 ``` -------------------------------- ### Clone and Run Examples Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/community-projects/go-sdk/index.html Commands to clone the repository and execute the transaction subscriber example. ```bash git clone https://github.com/alecsavvy/gaudius.gitmake example tx-subscriber ``` -------------------------------- ### Install and Build Audius SDK Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/examples/trending/README.md Commands to install dependencies and build the Audius SDK from the repository root. This is a prerequisite for running the example. ```bash npm install npm run build -w @audius/sdk ``` -------------------------------- ### Full Example: Upload Audio, Cover Art, and Create Track Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/sdk/uploads/index.html Demonstrates the complete workflow of uploading an audio file and cover art, then creating a track with the associated CIDs. The audio upload can optionally include a preview start time. Metadata for the track can be spread directly from the audio upload result. ```typescript import fs from 'fs' // Step 1: Upload the audio file const trackBuffer = fs.readFileSync('path/to/track.mp3') const audioUpload = audiusSdk.uploads.createAudioUpload({ file: { buffer: Buffer.from(trackBuffer), name: 'track.mp3', type: 'audio/mpeg', }, previewStartSeconds: 30, }) const audioResult = await audioUpload.start() // Step 2: Upload cover art const coverArtBuffer = fs.readFileSync('path/to/cover-art.png') const imageUpload = audiusSdk.uploads.createImageUpload({ file: { buffer: Buffer.from(coverArtBuffer), name: 'cover-art.png', type: 'image/png', }, }) const coverArtCid = await imageUpload.start() // Step 3: Create the track using the CIDs from the uploads. // The audio upload result fields (trackCid, previewCid, origFileCid, etc.) // match the metadata field names, so you can spread them directly. const { data } = await audiusSdk.tracks.createTrack({ userId: '7eP5n', metadata: { title: 'Monstera', description: 'Dedicated to my favorite plant', genre: 'Metal', mood: 'Aggressive', ...audioResult, coverArtCid: coverArtCid, }, }) ``` -------------------------------- ### Install Gaudius Go SDK Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/community-projects/go-sdk/index.html Use the go get command to add the Gaudius library to your Go project. ```bash go get github.com/alecsavvy/gaudius ``` -------------------------------- ### Run example script Source: https://github.com/audiusproject/apps/blob/main/packages/fixed-decimal/README.md Command to execute an example file using tsx. ```bash npx tsx examples/audio.ts ``` -------------------------------- ### Start Redis Instance Source: https://github.com/audiusproject/apps/wiki/Discovery-Node:-Configuration-Details Starts a Redis container and maps the default port to the host. ```bash docker run -d --network=disc-prov \ --name=disc-prov-redis \ -p 4379:6379 \ redis:5.0.4 ``` -------------------------------- ### Configure and Run Project Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/upload/README.md Commands to set up environment variables and start the development server. ```bash cp .env.example .env # Edit .env and set VITE_AUDIUS_API_KEY to your developer app API key # Get one at audius.co/settings → Developer Apps npm install npm run build -w @audius/sdk npm run dev ``` -------------------------------- ### Get Favorites Response Example Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/api/get-favorites/index.html Example JSON response structure for the GET /users/:id/favorites endpoint. ```json { "data": [ { "favorite_item_id": "string", "favorite_type": "string", "user_id": "string", "created_at": "string" } ] } ``` -------------------------------- ### Clone and Build SDK Examples Source: https://github.com/audiusproject/apps/blob/main/packages/docs/docs/pages/sdk/community-projects/go-sdk.mdx Clone the SDK repository from GitHub and use 'make' to build example applications, such as the transaction subscriber. ```bash git clone https://github.com/alecsavvy/gaudius.git make example tx-subscriber ``` -------------------------------- ### Full Node.js Example Source: https://github.com/audiusproject/apps/blob/main/packages/docs/docs/pages/sdk/index.mdx A complete example demonstrating initialization, fetching a track, and favoriting a track in a Node.js environment. ```javascript import { sdk } from '@audius/sdk' const audiusSdk = sdk({ apiKey: 'Your API Key goes here', bearerToken: 'Your Bearer Token goes here', }) const track = await audiusSdk.tracks.getTrack({ trackId: 'D7KyD' }) console.log(track, 'Track fetched!') const userId = ( await audiusSdk.users.getUserByHandle({ handle: 'Your Audius handle goes here', }) ).data?.id await audiusSdk.tracks.favoriteTrack({ trackId: 'D7KyD', userId, }) console.log('Track favorited!') ``` -------------------------------- ### Bulk Get Subscribers JSON Response Example Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/api/bulk-get-subscribers-via-json-request/index.html Example JSON response structure for the bulk subscriber retrieval endpoint. ```json { "latest_chain_block": 0, "latest_indexed_block": 0, "latest_chain_slot_plays": 0, "latest_indexed_slot_plays": 0, "signature": "string", "timestamp": "string", "version": { "service": "string", "version": "string" }, "data": [ { "user_id": "string", "subscriber_ids": [ "string" ] } ] } ``` -------------------------------- ### Full Example: Upload and Create a Track Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/sdk/uploads/index.html Demonstrates the complete workflow of uploading audio and cover art, then creating a track with the obtained CIDs. ```APIDOC ## Workflow Example: Upload and Create Track ### Description This example shows how to upload an audio file and a cover art image, then use their respective CIDs to create a new track. ### Steps 1. **Upload Audio File**: Use `createAudioUpload` to upload the audio. 2. **Upload Cover Art**: Use `createImageUpload` to upload the cover art. 3. **Create Track**: Use `audiusSdk.tracks.createTrack` with the metadata including the CIDs from the uploads. ### Code Example ```javascript import fs from 'fs'; // Step 1: Upload the audio file const trackBuffer = fs.readFileSync('path/to/track.mp3'); const audioUpload = audiusSdk.uploads.createAudioUpload({ file: { buffer: Buffer.from(trackBuffer), name: 'track.mp3', type: 'audio/mpeg', }, previewStartSeconds: 30, }); const audioResult = await audioUpload.start(); // Step 2: Upload cover art const coverArtBuffer = fs.readFileSync('path/to/cover-art.png'); const imageUpload = audiusSdk.uploads.createImageUpload({ file: { buffer: Buffer.from(coverArtBuffer), name: 'cover-art.png', type: 'image/png', }, }); const coverArtCid = await imageUpload.start(); // Step 3: Create the track using the CIDs from the uploads const { data } = await audiusSdk.tracks.createTrack({ userId: '7eP5n', metadata: { title: 'Monstera', description: 'Dedicated to my favorite plant', genre: 'Metal', mood: 'Aggressive', ...audioResult, // Spreads trackCid, previewCid, origFileCid, etc. coverArtCid: coverArtCid, }, }); console.log('Track created:', data); ``` ``` -------------------------------- ### Full HTML and JavaScript SDK Implementation Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/sdk/index.html A complete HTML file example demonstrating how to load the SDK via CDN and initialize it within a script tag. ```html

Example content

``` -------------------------------- ### GET /tracks/trending Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/api/index.html Example request to fetch trending tracks from the Audius platform. ```APIDOC ## GET /tracks/trending ### Description Retrieves a list of currently trending tracks on Audius. ### Method GET ### Endpoint https://api.audius.co/v1/tracks/trending ### Request Example curl -X GET "https://api.audius.co/v1/tracks/trending" -H "Authorization: Bearer " ``` -------------------------------- ### Full HTML + JS Example Source: https://github.com/audiusproject/apps/blob/main/packages/docs/docs/pages/sdk/index.mdx A complete example for frontend usage, including SDK inclusion, initialization, and fetching a track within an async function. ```html

Example content

``` -------------------------------- ### Get all events API response example Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/api/get-all-events/index.html This is an example of the JSON response structure when retrieving all events. It includes details such as event ID, type, user ID, entity information, dates, and event-specific data. ```json { "data": [ { "event_id": "string", "event_type": "remix_contest", "user_id": "string", "entity_type": "track", "entity_id": "string", "end_date": "string", "is_deleted": true, "created_at": "string", "updated_at": "string", "event_data": {} } ] } ``` -------------------------------- ### Full Node.js Example with Read and Write Operations Source: https://github.com/audiusproject/apps/blob/main/packages/libs/README.md A complete Node.js example demonstrating initialization with API key and secret, fetching a track, retrieving a user ID by handle, and favoriting a track. ```javascript import { sdk } from '@audius/sdk' const audiusSdk = sdk({ apiKey: 'Your API Key goes here', apiSecret: 'Your API Secret goes here' }) const track = await audiusSdk.tracks.getTrack({ trackId: 'D7KyD' }) console.log(track, 'Track fetched!') const userId = ( await audiusSdk.users.getUserByHandle({ handle: 'Your Audius handle goes here' }) ).data?.id const track = await audiusSdk.tracks.favoriteTrack({ trackId: 'D7KyD', userId }) console.log('Track favorited!') ``` -------------------------------- ### Setup Harmony ThemeProvider Source: https://github.com/audiusproject/apps/blob/main/packages/harmony/README.md Wrap your application with HarmonyThemeProvider to provide the theme context. The 'day' theme is used as an example. ```tsx import { ThemeProvider as HarmonyThemeProvider } from '@audius/harmony' const App = () => { return ... } ``` -------------------------------- ### Run iOS Application Source: https://github.com/audiusproject/apps/blob/main/packages/mobile/README.md Commands for bundling, starting the server, and launching the iOS simulator or device. ```bash # Create the ios bundle. Should only have to run once. npm run bundle:ios # Start the react-native server npm run mobile # Run a simulator using a prod configuration npm run ios # Run a simulator using a stage configuration npm run ios:stage # Run a simulator using a dev configuration npm run ios:dev # Run the app on a device npm run ios:device "Raymond's iPhone" # To see available devices xcrun xctrace list devices ``` -------------------------------- ### Build DDEX entrypoint for production Source: https://github.com/audiusproject/apps/blob/main/packages/distro/README.md Compiles the application for production deployment. ```bash npm run build:prod ``` -------------------------------- ### Run Protocol Stack Locally Source: https://github.com/audiusproject/apps/blob/main/CLAUDE.md Starts the Audius protocol stack locally. This command requires Docker to be installed and running. ```bash npm run protocol ``` -------------------------------- ### SDK Setup in Vite App Source: https://github.com/audiusproject/apps/blob/main/packages/web/examples/coin-gated/README.md Example of setting up the Audius SDK as a singleton in a Vite + React application, including necessary node polyfills. ```typescript importkring from '@audiusproject/sdk' const getSDK = () => { return kring.getSDK({ apiKey: config.VITE_AUDIUS_API_KEY, environment: config.VITE_AUDIUS_ENVIRONMENT, redirectUri: window.location.origin + '/callback', }) } export const sdk = getSDK() ``` -------------------------------- ### Setup Cron Job for Automatic Claims Source: https://github.com/audiusproject/apps/blob/main/packages/sp-actions/README.md Set up a cron job to run the claim utility every 6 hours. Replace `` with the output of 'npm config get prefix' and provide your `spOwnerWallet` and `privateKey`. ```bash # 3. Setup a cron job with the following command: (NOTE: replace with the output from 'npm config get prefix') (crontab -l 2>/dev/null; echo "0 */6 * * * /bin/claim claim-rewards ") | crontab - ``` -------------------------------- ### Install Audius SDK with npm Source: https://github.com/audiusproject/apps/blob/main/packages/docs/build/developers/guides/log-in-with-audius/index.html Install the necessary packages for the Audius JavaScript SDK. This command installs both 'web3' and '@audius/sdk'. ```bash npm install web3 @audius/sdk ``` -------------------------------- ### Run Application with Environment Source: https://github.com/audiusproject/apps/blob/main/packages/protocol-dashboard/README.md Start the application by specifying the desired environment (e.g., development, staging, production). ```bash npm run start: ``` -------------------------------- ### Full HTML + JS Example Source: https://github.com/audiusproject/apps/blob/main/packages/libs/README.md An example of a complete HTML file that includes the web3 and Audius SDKs, initializes the SDK, and fetches a track. ```html

Example content

```