How to Build a dApp on Aptos, Step by Step
Aptos dApps pair Move smart contracts with a wallet-connected frontend. Here is the stack, the seven build steps and how to test on devnet first.
On this page
Short answer
A dApp on Aptos is an application whose logic lives in Move smart contracts on the Aptos blockchain and whose interface is a web or mobile app that connects to a user's wallet. The contract stores the state and enforces the rules, the wallet signs transactions, and the frontend reads on-chain data to display it. Aptos suits dApps needing fast finality and parallel execution.
What is a dApp on Aptos?
A dApp on Aptos is an application that runs its core logic on the Aptos blockchain instead of on a company server. The smart contract, written in the Move language, holds the data and the rules. The frontend is a normal web app that talks to the chain through an SDK and asks the user's wallet to sign transactions.
A typical Aptos dApp has three parts. The Move module defines the resources and the functions that change them. The frontend, usually built with React and the Aptos TypeScript SDK, reads state and builds transactions. The wallet, such as Petra or Martian, holds the user's keys and signs each transaction. The chain itself orders the transactions and executes them, using parallel execution for transactions that do not touch the same state.
This is different from building only a smart contract, which is covered in how to develop and deploy an Aptos smart contract. That article covers writing and deploying a module. This one covers the whole dApp: contract, wallet connection, frontend wiring and testing.
A dApp development team can help with the parts you do not want to build yourself.
What do you need before you start?
Before writing code, set up the five pieces of the Aptos stack. Each one is free to install, and getting them working first saves hours of debugging later.
| Piece | What it does | Notes |
|---|---|---|
| Aptos CLI | Compiles, tests and publishes Move modules | Install it and run aptos --version to check |
| Move language | Writes the smart contracts | Resource-based, so assets cannot be copied by accident |
| TypeScript SDK | Lets the frontend read state and submit transactions | Use the official Aptos SDK |
| Wallet | Petra or Martian holds keys and signs transactions | Users install it as a browser extension |
| Devnet and faucet | Free test network with free test tokens | Never test with real funds |
You also need a code editor, Node.js for the frontend, and an Aptos account on devnet funded from the faucet. Keep the project in two folders, one for the Move package and one for the frontend, so the contract and the interface stay separate.
How to build a dApp on Aptos in 7 steps
Building an Aptos dApp follows a fixed order: contract first, then wallet, then frontend. Skipping ahead to the interface before the contract works is the most common way to waste a week.
- Define the state. List the resources the contract must hold, such as a poll with options and vote counts, and write them as Move structs.
- Write the Move module. Add functions to create the state, change it, and read it. Keep each function small and test it as you go.
- Test locally. Run the Aptos CLI unit tests for every function, including the failure cases, before you publish anything.
- Publish to devnet. Deploy the module to devnet with the CLI and fund a test account from the faucet.
- Connect the wallet. Add the wallet adapter to the frontend so users can connect Petra or Martian and see their address.
- Wire the frontend. Use the SDK to read contract state for display and to build, sign and submit transactions for actions.
- Test the full flow. Walk through every action as a real user would, on devnet, and fix the places where the interface and the contract disagree.
Do not move to mainnet until the devnet flow works end to end and the contract has been reviewed. A contract on mainnet cannot be changed easily, so the cost of a mistake there is much higher than on devnet.
How do wallets and transactions work in an Aptos dApp?
Wallets and transactions work in an Aptos dApp through a simple pattern: the frontend builds a transaction, the wallet signs it, and the chain executes it. The user never gives the dApp their private key.
When a user clicks an action such as voting, the frontend builds a transaction that calls the contract function with the right arguments. The wallet shows the user what will happen and the gas fee, and the user approves or rejects it. Once signed, the SDK submits the transaction and waits for it to be confirmed, then the frontend refreshes the displayed state.
Two details matter. First, gas on Aptos is paid in APT and is usually a fraction of a cent, but the frontend should still show the fee before the user signs. Second, a transaction can fail after signing, for example if the state changed first, so the frontend must handle the failure and explain it in plain words rather than showing a raw error.
How do you test on devnet before mainnet?
You test an Aptos dApp on devnet by running the same flows a real user will run, with test tokens and test accounts, and by checking the three layers separately: contract, wallet and frontend.
Test the contract with the CLI unit tests and with direct calls on devnet, including the cases that should fail. Test the wallet flow with a fresh browser profile and a new wallet, because your own setup hides onboarding problems. Test the frontend by clicking through every action, refreshing the page mid-flow, and trying the dApp with an empty wallet and with a wallet that has no test tokens.
Keep a short checklist and run it before every deploy: contract tests pass, devnet flow works end to end, wallet connect and disconnect work, failed transactions show a clear message, and no real funds are involved. If any item fails, fix it before moving on.
Example: a voting dApp on Aptos
Example (hypothetical): a community of 200 members wants a simple voting dApp on Aptos. Each member can vote three times, once per proposal, and each vote is a transaction. The contract stores the proposals and the vote counts, and the frontend shows the results live.
The arithmetic is straightforward. With 200 members voting three times each, the dApp processes 600 transactions. At a gas cost of about 0.000005 APT per vote, the total gas for all 600 votes is 0.003 APT, which is a tiny fraction of one APT. Even if every member votes twice as often, the cost stays negligible.
The team builds the contract first, tests it with the CLI, publishes to devnet, and connects a Petra wallet to a simple React frontend. The whole flow, from writing the first Move function to a working devnet demo, takes about two weeks for one developer who already knows TypeScript. The mainnet launch adds an audit and a review of the contract, which is where the extra time goes.
What are the common mistakes?
The most common mistakes when building a dApp on Aptos are starting with the frontend, skipping contract tests, and assuming a transaction that was signed will always succeed.
- Frontend first. Building the interface before the contract works means rebuilding it when the contract changes. Contract first, always.
- No unit tests for the contract. A Move module without tests is a guess. Test the failure cases, not just the happy path.
- Assuming signed means done. Transactions can fail after signing. The frontend must handle failures and explain them.
- Testing only with your own wallet. A fresh wallet and a fresh browser profile reveal onboarding problems you cannot see.
- Hardcoding devnet addresses. Contract addresses differ between devnet and mainnet. Keep them in configuration, not in code.
- Skipping the audit. A contract that holds user funds needs a review before mainnet, even if it looks simple.
Key takeaways
- An Aptos dApp pairs Move contracts with a wallet-connected frontend
- Build the contract first, then the wallet connection, then the interface
- Test on devnet with fresh wallets before thinking about mainnet
- Gas per transaction is a fraction of a cent, so cost is rarely the blocker
- A signed transaction can still fail, so the frontend must handle failures
Frequently asked questions
Is Aptos better than Solana for building a dApp?
Neither is better in general. Aptos uses Move, which makes it hard to copy assets by accident, and it executes independent transactions in parallel. Solana has a larger ecosystem and more existing tools. Choose based on your team's language, your users' wallets and the libraries you need.
Do I need to learn Move to build an Aptos dApp?
Yes, for the contract part. Move is the language Aptos contracts are written in, and its resource model is central to how assets are handled. The frontend can be built in TypeScript with the Aptos SDK, so a web developer only needs Move for the contract layer.
What wallet should users have for an Aptos dApp?
Petra and Martian are the most widely used Aptos wallets, and both work as browser extensions. Support at least one of them at launch, and use the wallet adapter so users can choose. Test the connect flow with a fresh wallet install.
How much does it cost to run an Aptos dApp?
Gas on Aptos is low, usually a fraction of a cent per transaction, and reading state is free. The real costs are development time, hosting the frontend, and the security review before mainnet. The chain fees are rarely the deciding factor.
Can I test my Aptos dApp for free?
Yes. Devnet is a free test network and the faucet gives you test APT. You can build, publish and test the whole dApp without spending real money. Only move to mainnet when the devnet flow works end to end.
How long does it take to build a simple Aptos dApp?
A simple dApp, such as voting or a basic marketplace, takes about two weeks for one developer who already knows TypeScript and is learning Move. The mainnet launch adds time for a security review and for fixing what it finds.