This is Part 1 of our guide to building a Cardano transaction application with Next.js and Weld. In this section, you'll set up the project structure and dependencies.
Introduction
In this first part, we'll create a Next.js application and configure it to work with Anvil API. By the end of this section, you'll have a working development environment ready for wallet integration.
Prerequisites
Before you begin, ensure you have:
Node.js 18+ installed
Basic familiarity with React and Next.js
An Anvil API key (sign up at TODO: Add public URL)
Project Creation
1. Create a new Next.js project
Start by creating a new Next.js application using the create-next-app tool:
npx create-next-app@latest my-basic-transaction-app
cd my-basic-transaction-app
When prompted for options, select the following:
TypeScript: Yes
ESLint: Yes
Tailwind CSS: Yes
src/ directory: Yes
App Router: Yes
Use TurboPack: (Optional)
Custom Import Alias (@/*): No
2. Install Required Dependencies
Next, install Weld and other required dependencies:
npm install @ada-anvil/weld
The @ada-anvil/weld package includes all the necessary functionality for wallet integration. The React-specific hooks are exported from the package via the /react subpath: @ada-anvil/weld/react.
3. Environment Configuration
Create a .env.example file to document the required environment variables for other developers:
In Part 1 (this guide), we'll focus on setting up the basic Next.js application structure, configuring environment variables, and adding styles. The implementation of specific components and API routes will come in Parts 2 and 3.
5. Basic Styling
Create a consistent look and feel by adding basic styles to your src/app/globals.css file:
We are using custom styles for the paper, button, and custom-rounded classes. You can modify these styles to match your desired design.
Or you can use Tailwind's built-in utilities to create your own styles. For now, copy the following code into your src/app/globals.css file:
This single package includes everything needed for the client-side wallet integration. Other dependencies (e.g., Next.js, Tailwind CSS) should already be installed as part of the project creation. See the for more information.
Now that you have a basic Next.js application set up, you're ready to integrate the Weld wallet connector. In , we'll implement the wallet connection functionality.