Build Your First PROJECT

Learn Ayisha.js by building a complete blog step by step. From basics to advanced features, master reactive programming with hands-on practice.

10 Interactive Steps
Live Code Examples
1

Setup & Basic HTML Structure

Let's start by creating the basic HTML structure for our blog. We'll include Ayisha.js and set up the initial layout.

🎯 Live Demo - Basic Setup

<script src="ayisha.js"></script> <init> state.blogTitle = 'My Amazing Blog'; state.author = 'Your Name'; </init>

by

πŸ“‹ Code Example

by

✨ @text directive displays dynamic content and @model creates two-way data binding!

2

Adding State & Reactivity

Now let's add some interactive elements to our blog. We'll create a visitor counter and a welcome message.

🎯 Live Demo - Interactive Elements

Welcome to !

Visitors:

Current visitor count:

πŸ“‹ Code Example

Welcome to !

Visitors:

✨ @click directive executes JavaScript when elements are clicked. State updates trigger automatic re-renders!

3

Creating Dynamic Lists

Let's create a simple blog post list. We'll use the @for directive to iterate over an array of posts.

🎯 Live Demo - Blog Post List

No posts yet. Add your first post above! πŸ“

πŸ“‹ Code Example




No posts yet. Add your first post above! πŸ“

✨ @for creates dynamic lists and @key ensures optimal performance. @if conditionally renders elements!

4

Conditional Rendering & User Interactions

Let's add more sophisticated interactions. We'll implement post editing and show/hide functionality.

🎯 Live Demo - Interactive Posts

πŸ“‹ Code Example

✨ @if conditionally shows/hides elements. Complex expressions work perfectly for interactive UIs!

5

Loading Data from APIs

Let's load real blog posts from JSONPlaceholder API. We'll use the @fetch directive to make HTTP requests.

🎯 Live Demo - API Integration

Posts from JSONPlaceholder API:

Click the button above to load posts from the API! πŸš€

πŸ“‹ Code Example




Posts from JSONPlaceholder API:

User ID: | Post ID:

✨ @fetch:click makes HTTP requests on user interaction. @result stores the response data!

6

Dynamic User Loading

Let's load user information dynamically based on user selection. We'll combine multiple API calls.

🎯 Live Demo - User Selection

Email:

Website:

Company:

Posts by :

πŸ“‹ Code Example




Email:

Website:

✨ URL interpolation with {variable} syntax allows dynamic API calls!

7

Form Validation

Let's add a contact form with validation. We'll use the @validate directive to ensure data quality.

🎯 Live Demo - Contact Form

Validation Status:

Name valid:

Email valid:

Phone valid:

Message valid:

πŸ“‹ Code Example

✨ @validate provides real-time validation. Check _validate object for validation results!

8

Search & Filter Functionality

Let's add search functionality to filter blog posts. We'll use JavaScript's array methods within Ayisha.js.

🎯 Live Demo - Search Posts

Found posts matching ""

First load some posts from Step 5 to use the search! πŸ”

πŸ“‹ Code Example



Found posts matching ""

Post ID:

✨ @input triggers on every keystroke. Complex filtering logic works seamlessly!

9

Comments System

Let's build a comments system for our blog posts. We'll load comments from the API and allow users to add new ones.

🎯 Live Demo - Post Comments

Comments for this post:

by

Add a Comment:

πŸ“‹ Code Example


            
          

          

Comments for this post:

by

Add a Comment:

✨ Nested API calls and dynamic list manipulation create rich, interactive experiences!

10

Advanced Features & State Management

Let's wrap up with advanced features: state watching, animations, and a complete blog dashboard.

🎯 Live Demo - Blog Dashboard

Total Posts

Average Likes

Total Visitors

Your Blog Posts:

Debug State:

πŸ“‹ Code Example

Total Posts

Average Likes

Total Visitors

Likes: |

✨ @watch monitors state changes, @animate adds smooth transitions, and @state helps with debugging!

πŸŽ‰ Congratulations!

You've completed the Ayisha.js blog tutorial!
You now know how to:

  • βœ… Create reactive user interfaces
  • βœ… Handle user interactions and events
  • βœ… Work with APIs and external data
  • βœ… Implement form validation
  • βœ… Build dynamic search and filtering
  • βœ… Manage complex application state
  • βœ… Create engaging user experiences
More Examples Full Documentation
// Tutorial state state.currentStep = 1; // Blog basic info state.blogTitle = 'My Amazing Blog'; state.author = 'Your Name'; state.visitors = 42; // Posts management state.posts = []; state.newPostTitle = ''; // API data state.apiPosts = []; state.selectedUserId = ''; state.selectedUser = null; state.userPosts = []; // Comments state.selectedPostId = ''; state.postComments = []; state.newCommentName = ''; state.newCommentEmail = ''; state.newCommentBody = ''; // Contact form state.contactName = ''; state.contactEmail = ''; state.contactPhone = ''; state.contactMessage = ''; // Search state.searchQuery = ''; state.filteredPosts = []; // Dashboard stats state.totalPosts = 0; state.avgLikes = 0; _currentPage = 'tutorial';