Skip to main content
Before you can follow our TypeScript and Node.js how-to guides, you need to set up your development environment. This guide will walk you through creating a new project, installing essential packages, and configuring your environment.

1. Initialize Your TypeScript Project

First, create a new directory for your project and initialize it:
Next, install TypeScript and initialize the TypeScript configuration:
This will create a tsconfig.json file with default settings, which you can customize as needed.

2. Install Core Dependencies

Now, install the core dependencies required for most interactions with the Bags API and for running your TypeScript code with Node.js.
Also, install the necessary development dependencies:

3. Set Up Environment Variables

Create a .env file in your project root to store your Bags API key, Solana RPC URL, and other secrets:
You can get your API key from dev.bags.fm. Some guides might require additional variables like your wallet’s private key for signing transactions.
Never commit your .env file to version control. Add it to your .gitignore file to keep your secrets safe.

4. Project Structure

Your project structure should look like this:
Make sure to add .env to your .gitignore file:
You are now ready to follow our how-to guides! Each guide will include the complete setup code needed to initialize the SDK and run the examples.