DEV Community

Cover image for Build Linera dApps Fast with This Next.js Template
uratmangun Subscriber for kirodotdev

Posted on

Build Linera dApps Fast with This Next.js Template

If you're looking to build decentralized applications on Linera blockchain, setting up the development environment from scratch can be tedious. That's why I created Linera Dynamic Template β€” a production-ready Next.js starter that handles all the boilerplate for you.

What is Linera?

Linera is a next-generation blockchain platform designed for scalability through its unique microchain architecture. Unlike traditional blockchains, Linera enables parallel execution across multiple chains, making it ideal for high-throughput applications.

The Problem

Getting started with Linera development involves:

  • Configuring SharedArrayBuffer support (COOP/COEP headers)
  • Setting up WASM smart contract compilation
  • Integrating wallet authentication
  • Managing cross-origin policies for browser execution

This template eliminates all that friction.

Features

  • πŸ” Dynamic wallet authentication β€” Easy login integration
  • ⛓️ Linera blockchain interaction β€” Pre-configured client adapter
  • ⚑ Next.js 16 + React 19 β€” Latest framework features
  • 🎨 Tailwind CSS β€” Modern styling out of the box
  • πŸ“¦ Example counter contract β€” Rust/WASM smart contract included
  • πŸ› οΈ CLI scripts β€” Wallet and contract management tools

Quick Start

# Clone with GitHub CLI
gh repo create my-linera-app --template uratmangun/linera-dynamic-template --clone
cd my-linera-app
pnpm install

# Configure environment
cp .env.example .env.local
# Add your Dynamic environment ID

# Start developing
pnpm dev
Enter fullscreen mode Exit fullscreen mode

Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/           # Next.js app router pages
β”‚   └── lib/           # Linera adapter and utilities
β”œβ”€β”€ contracts/         # Rust smart contracts (WASM)
β”œβ”€β”€ scripts/           # CLI scripts for wallet/contract management
└── public/            # Static assets
Enter fullscreen mode Exit fullscreen mode

Available Scripts

Command Description
pnpm dev Start development server
pnpm wallet:init Initialize Linera wallet
pnpm wallet:show Show wallet info
pnpm contract:build Build smart contract
pnpm contract:deploy Deploy smart contract

Tech Stack

  • Next.js 16 β€” React framework with app router
  • Dynamic β€” Wallet authentication provider
  • Linera β€” Blockchain platform
  • Rust β€” Smart contract language
  • Tailwind CSS β€” Utility-first styling
  • TypeScript β€” Type safety throughout

Key Technical Details

The template handles the tricky COOP/COEP headers required for SharedArrayBuffer support in browsers:

// next.config.ts
async headers() {
  return [{
    source: "/(.*)",
    headers: [
      { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
      { key: "Cross-Origin-Embedder-Policy", value: "credentialless" },
      { key: "Cross-Origin-Resource-Policy", value: "cross-origin" },
    ],
  }];
}
Enter fullscreen mode Exit fullscreen mode

This is essential for Linera's WASM client to function properly in the browser.

Get Started

Check out the template on GitHub: uratmangun/linera-dynamic-template

Click "Use this template" to create your own Linera dApp in seconds!


Have questions or feedback? Drop a comment below or open an issue on GitHub. Happy building! πŸš€

Demo

Top comments (16)

Collapse
 
divyasinghdev profile image
Divya kirodotdev

Did you get bonus prize for all the articles you wrote for the Code with Kiro Hackathon?

Collapse
 
uratmangun profile image
uratmangun kirodotdev

not yet wby?

Collapse
 
divyasinghdev profile image
Divya kirodotdev

I was just asking tbh.
Thank you for the info.

Thread Thread
 
uratmangun profile image
uratmangun kirodotdev

ah no problem but you also win the bonus prize for kiro?

Thread Thread
 
divyasinghdev profile image
Divya kirodotdev

I didn't participate last time, asking for this time- the ongoing hackathon.

Thread Thread
 
uratmangun profile image
uratmangun kirodotdev

ah i see i thought you won last time as well hopefully you win this time you have access to kirodotdev? you need to ask the mod in discord for access so you can write here as well

Thread Thread
 
divyasinghdev profile image
Divya kirodotdev

Thank you
I didn't participate last time btw.
Didn't know i needed Mod's permission.
Thank you for this info

Collapse
 
divyasinghdev profile image
Divya kirodotdev

But the results were announced long ago. It's still not clarified if you'll be getting the bonus prize for articles?

Thread Thread
 
uratmangun profile image
uratmangun kirodotdev

i dont know as well lol hopefully sooner but yeah i think you need to ask kiro organizer if you winning as well but im waiting patiently

Thread Thread
 
divyasinghdev profile image
Divya kirodotdev

Didn't participate honestly.
But thank you for the response.

Thread Thread
 
uratmangun profile image
uratmangun kirodotdev

ask corey kiro in discord and ask for access to write in kirodotdev so you can participate in this bonus blog post prize

Thread Thread
 
divyasinghdev profile image
Divya kirodotdev

Gotcha!
Thank you Uratmangun

Collapse
 
gravitate profile image
Gravitate

Thanks for the useful information.

Collapse
 
uratmangun profile image
uratmangun kirodotdev

always pleasure to help

Some comments may only be visible to logged-in visitors. Sign in to view all comments.