Cohorts
  • Discover
  • About Us
  • Blog
  • Patika.dev
  • Web3

NEAR Developer Course

NEAR Certified Developer Final Project
What Does a Successful Project Look Like?
The Course Outline
NEAR CLI (Command Line Interface)
NEAR Explorer

What is Assembly Script?
Contract
File Structure
Imports
Practice I

Assert
Models
Context
Storage
Practice II

Collections
Arrays
Iteration
Classes

Introduction
Keys
Identity
Money

Smart Contract Overview
Account Model
View & Change Methods
Serde
NEAR Wallet
Practice: NEAR Academy-Meme Museum

Previous successful projects
Example: Thanks
Example: Guest Book
Example: Sample Lottery
Example: CRUD dApp
Develop project ideas
Submit and build your project plan

Loom video
Documentation and explanations
How to submit

Models

At the most basic level, a model is a custom data container that defines a new type not currently available (as opposed to primitive types like integers, strings and bool which are always available)

@nearBindgen
export class TextMessage {
  sender: string;
  text: string;
  number: u64;
  isRead: bool;
}
// see https://github.com/near/near-sdk-as/blob/master/assembly/__tests__/runtime/model.ts

@nearBindgen is a decorator made for the serialization of custom classes before they are saved to storage onto the blockchain. @nearBindgen does not support class inheritance.

Models can build on top of one another as with the sample below, taken from CryptoCorgis (like Pokemon), which includes 3 models:

  • CorgiMetaData which wraps an array of strings
  • the Corgi model which includes strings, an integer and also uses CorgiMetaData
  • and finally a CorgiArray which includes an array of Corgis and maintains the length of that array as well
@nearBindgen
export class CorgiMetaData {
  dna: Array<string>;
}

export class Corgi {
  owner: string;
  sender: string;
  message: string;
  dna: string;
  name: string;
  color: string;
  backgroundColor: string;
  rate: string;
  sausage: string;
  quote: string;
  level: i32;
  metadata: CorgiMetaData;
}

export class CorgiArray {
  corgis: Array<Corgi>;
  len: i32;
}
// see https://github.com/nearprotocol/corgis/blob/master/assembly/model.ts

Since models are just AssemblyScript classes, they support custom constructors and behavior, not just data, as with the example here:

@nearBindgen
export class Greeter {
  text: string;

  constructor(text: string) {
    this.text = text;
  }

  greet(userId: string): string {
    return "Hello, " + userId;
  }
}
// see https://github.com/nearprotocol/blockbuster/blob/master/assembly/model.ts

Quiz

Answer the questions to check your understanding.

This lesson includes a short quiz.

Previous
Next

Lesson discussion

Swap insights and ask questions about “NEAR Developer Course”.

Enroll to participate
Start the course to unlock the discussion. Enrolling helps us keep conversations relevant to learners.
Cohorts
WebsiteDiscoverBlogPatika.devRise In
CoursesCircleRustSoliditySolanaWeb3 FundamentalsBlockchain Basics
CompanyAbout UsTerms of UsePrivacy PolicyGDPR NoticeCookies
Don't miss any update!

Disclaimer: The information, programs, and events provided on https://cohorts.patika.dev is strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice, nor do we make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://cohorts.patika.dev disclaims any responsibility for financial decisions made by users based on the information provided here.

© 2026 Cohorts, All rights reserved