How no-cash-7970/txnduck works
Project Type and Purpose
• This is a full-stack, web-based GUI built on Next.js (using the new App Router) and React. It is designed as a Progressive Web App (PWA) to help end users build, import/export, sign, and send Algorand transactions via a graphical interface.
• There is no traditional “backend” API layer of your own—most business logic lives in React components and utilities on the client, with occasional server‐side rendering by Next.js. Transaction submission and query happen against an Algorand node (Algod) configured via environment variables.
File Structure Analysis
• Top-level: Dockerfile, docker-compose.yml, CI/CD workflow definitions (.github/workflows), next.config.ts, middleware.ts, .env.* for multiple environments.
• src/app: Next.js App Router directory, with dynamic language subfolders ([lang]) holding pages (page.tsx), components, layouts, error pages.
• src/app/components & nested: Reusable UI atoms/molecules for forms, navbars, dialogs, loading placeholders, theming, notifications.
• src/app/lib: Utility modules for app settings, node configuration, transaction data processing and validation, wallet helper, i18n client setup, and mock/testing helpers.
• src/e2e, jest.config.mjs, playwright.config.ts: End-to-end (Playwright) and unit (Jest) tests.
• Public assets (public/) and static global CSS (globals.css).
• CI/CD: GitHub Actions for build, test, Docker image releases; lefthook.yml for local Git hooks.
Key Architectural Patterns
• Client-Server separation via Next.js: server-side rendering of React pages, client-side hydration for interactivity.
• Component-based UI (React) with atomic design principles (form fields, dialogs, steps, etc.).
• Global state management via Jotai atoms.
• Internationalization using i18next.
• Environment-driven configuration (Algod endpoint, chain parameters).
• PWA features (manifest, service worker via Next.js middleware).
Main System Components
• Browser / PWA Shell
• Next.js–rendered pages (SSR/SSG)
• React components—UI, form builders, dialogs.
• Jotai state store and i18next client for multilingual support.
• algosdk (or REST calls) to Algod node.
• File input/output for import/export of txn files.
• Next.js Application
• App Router (routes under src/app/[lang]).
• Server components for SSR of static and dynamic pages.
• Middleware for PWA caching, internationalization routing.
• Build pipeline (Gulp, PostCSS, Tailwind CSS).
• External Services
• Algorand Node (Algod REST API) – configurable endpoint via ENV.
• Optional indexer or other blockchain explorers (if extended).
• DevOps / CI
• GitHub Actions workflows for testing, building, and publishing Docker images.
• Docker Compose for local development (simulating Algod and hosting).
• Testing Frameworks
• Jest for unit/component tests.
• Playwright for end-to-end flow testing.
Relationships and Data Flows
• User interacts with PWA/UI → triggers React components → updates Jotai state.
• UI compiles transaction parameters → sends REST calls to Algod node directly from the browser or via Next.js server.
• Server-side rendering uses .env settings to prefetch any necessary configuration (e.g., default node URLs).
• Transaction export downloads a .txn.msgpack file; import reads and hydrates state.
• CI pipelines watch code changes, run Jest/Playwright, then build and deploy Docker image to Vercel (or other host).