👋 Welcome! This demo app was created to help you learn how to build on Flow.
- Kitty Items is a complete NFT marketplace built with Cadence, Flow's resource-oriented smart contract programming language.
- Learn how to deploy contracts, mint NFTs, and integrate user wallets with the Flow Client Library (FCL).
Check out the live demo of Kitty Items, deployed on the Flow Testnet.
Before you start, install the Flow command-line interface (CLI).
flow-cli v0.15.0
or above.
git clone https://github.com/onflow/kitty-items.git
You'll need a Testnet account to work on this project. Here's how to make one:
Generate a new key pair with the Flow CLI:
flow keys generate
Go to the Flow Testnet Faucet to create a new account. Use the public key from the previous step.
After your account has been created, save the address and private key to the following environment variables:
# Replace these values with your own!
export FLOW_ADDRESS=0xabcdef12345689
export FLOW_PRIVATE_KEY=xxxxxxxxxxxx
flow project deploy --network=testnet
After the contracts are deployed, follow the Kitty Items API instructions to install and run the Kitty Items API. This backend service is responsible for initializing accounts, minting NFTs, and processing events.
Lastly, follow the Kitty Items Web instructions to launch the Kitty Items front-end React app.
Above is a basic diagram of the parts of this project contained in each folder, and how each part interacts with the others.
1. Web App (Static website) | kitty-items/web
A true dapp, client-only web app. This is a complete web application built with React that demonstrates how to build a static website that can be deployed to an environment like IPFS and connects directly to the Flow blockchain using @onflow/fcl
. No servers required. @onflow/fcl
handles authentication and authorization of Flow accounts, signing transactions, and querying data using using Cadence scripts.
2. Look Ma, a Web Server! | kitty-items/api
We love decentralization, but servers are still very useful, and this one's no exception. The code in this project demonstrates how to connect to Flow using Flow JavaScript SDK from a Node JS backend. It's also chalk-full of handy patterns you'll probably want to use for more complex and feature-rich blockchain applications, like storing and querying events using a SQL database (Postgres). The API demonstrates how to send transactions to the Flow Blockchain, specifically for minting Kibbles (fungible tokens) and Kitty Items (non-fungible tokens).
3. Cadence Code | kitty-items/cadence
Cadence smart contracts, scripts & transactions for your viewing pleasure. This folder contains all of the blockchain logic for the marketplace application. Here you will find examples of fungible token and non-fungible token (NFT) smart contract implementations, as well as the scripts and transactions that interact with them. It also contains examples of how to test your Cadence code (tests written in Golang).
Items are hats for your cats, but under the hood they're non-fungible tokens (NFTs) stored on the Flow blockchain.
Items can be purchased from the marketplace with fungible tokens. In the future you'll be able to add them to Ethereum CryptoKitties with ownership validated by an oracle.
- Chat with the team on the Flow Discord server
- Ask questions on the Flow community forum
🚀 Happy Hacking!