Skip to content

Cookbook

Practical, copy-pasteable recipes for common problems. Each recipe is a standalone solution you can drop into your project and adapt.

How to Use

  1. Find the recipe that matches your problem
  2. Copy the code into your project
  3. Adjust names, URLs, and styles to fit your app

TIP

Every recipe uses real AkashJS APIs. If something looks unfamiliar, check the API Reference for the full details.

Recipes

RecipeWhat You'll Build
AuthenticationLogin flow, protected routes, token refresh, role-based access
Dark ModeTheme toggle, system preference sync, CSS variables, transitions
Infinite ScrollSentinel-based loading, cursor pagination, error retry, scroll restore
ModalsPortal-based modals, focus trap, stacked modals, animated enter/exit
Data FetchingcreateResource, createAction, caching, optimistic updates, retry
Advanced FormsMulti-step wizard, dynamic fields, Zod schema, file inputs
Real-Time UpdatesWebSocket chat, collaborative state, presence, reconnection
File UploadDrag-and-drop, progress tracking, chunked upload, image preview
Drag and DropSortable lists, Kanban board, FLIP animations, drop zones
Keyboard ShortcutsCmd+K search, scoped shortcuts, help dialog, vim navigation

Prerequisites

All recipes assume you have an AkashJS project set up:

bash
npx @akashjs/cli new my-app
cd my-app
npm run dev

INFO

Recipes show the essential code. Production apps should add error handling, loading states, and accessibility attributes beyond what is shown here.

Released under the MIT License.