Pay-as-you-go file storage experience powered by the Aptick SDK. Users can connect their Aptos wallet, upload files, and have their usage billed against an Aptick escrow account.
The UI surfaces the effective billing configuration so you can confirm which environment variables are active in the current deployment.
npm install
npm run devThen open http://localhost:3000. The landing page renders the live configuration and the FileStorageService component.
- Connect an Aptos wallet (Petra, Pontem, etc.) via the Connect button.
- If your escrow balance is below the configured minimum, submit a deposit right inside the app. The form signs a
deposittransaction with your wallet and credits the configured billing ID on-chain. - Upload a file from the drag-and-drop panel (or the Choose file button). The sample mimics an upload, calculates the storage size, and tries to bill the usage through Aptick. Usage is rounded up to whole-GB billing units for this demo so the on-chain contract can process it. If the transaction fails (for example, when running without a provider account), the UI gracefully falls back to a simulated debit so the demo flow can continue.
Tip: To see true on-chain billing, connect with the provider wallet that registered the billing profile. If you connect with a different account, uploads still work but charges run in simulation mode so you can explore the flow without provider keys.
Account stats auto-refresh every ~20 seconds, and you can trigger an immediate refresh with the Refresh button in the "Your Account" card.
All wallet interactions stay in-app—no external deposit portal is required. Simulated debits are highlighted in the file history so you can distinguish them from real on-chain charges.
The file storage integration reads its values from public environment variables that are safe to expose to the browser. Copy .env.local.example to .env.local (or configure these variables in your deployment environment):
| Variable | Description | Default |
|---|---|---|
NEXT_PUBLIC_APTICK_BILLING_ID |
Aptick billing profile ID used to record usage. | 3 |
NEXT_PUBLIC_APTICK_NETWORK |
Target Aptos network (devnet, testnet, mainnet). |
devnet |
NEXT_PUBLIC_APTICK_PRICE_PER_GB |
Price in APT billed per GB of storage. | 0.001 |
NEXT_PUBLIC_APTICK_MIN_BALANCE |
Minimum escrow balance (APT) required before uploads are allowed. | 0.01 |
Updating these values automatically changes the behaviour of the sample app without additional code changes. The home page displays the active configuration so operators can quickly verify their deployment.
| Command | Description |
|---|---|
npm run dev |
Start the development server with Turbopack. |
npm run build |
Create an optimized production build. |
npm run lint |
Run ESLint. |
src/app/page.tsx– Landing page that renders the active configuration and theFileStorageServiceexperience.src/components/FileStorageService.tsx– Client component integrating Aptick usage tracking and file uploads.src/config/fileStorage.ts– Environment-aware configuration shared between the UI and Aptick client setup.
Use your preferred Next.js hosting platform (Vercel, Netlify, etc.). Remember to configure the public environment variables above in each environment before deploying.