JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 99
  • Score
    100M100P100Q92980F
  • License MIT

Bun-native full-stack framework with generative AI, fintech compliance, and real-time performance - built for Tanzanian digital economy

Package Exports

  • @africode/core
  • @africode/core/components
  • @africode/core/components/accordion.js
  • @africode/core/components/alert.js
  • @africode/core/components/auth.js
  • @africode/core/components/avatar.js
  • @africode/core/components/badge.js
  • @africode/core/components/base.d.ts
  • @africode/core/components/base.js
  • @africode/core/components/button.js
  • @africode/core/components/card.js
  • @africode/core/components/cultural-card.js
  • @africode/core/components/divider.js
  • @africode/core/components/dropdown.js
  • @africode/core/components/error-boundary.js
  • @africode/core/components/form.js
  • @africode/core/components/grid.js
  • @africode/core/components/hero.js
  • @africode/core/components/icon.js
  • @africode/core/components/index.js
  • @africode/core/components/input.js
  • @africode/core/components/kanga-card.js
  • @africode/core/components/language-switcher.js
  • @africode/core/components/loader.js
  • @africode/core/components/modal.js
  • @africode/core/components/motion.js
  • @africode/core/components/navbar.js
  • @africode/core/components/pattern-showcase.js
  • @africode/core/components/progress.js
  • @africode/core/components/react.js
  • @africode/core/components/section.js
  • @africode/core/components/select.js
  • @africode/core/components/sidebar.js
  • @africode/core/components/skeleton.js
  • @africode/core/components/table.js
  • @africode/core/components/tabs.js
  • @africode/core/components/theme-toggle.js
  • @africode/core/components/toast.js
  • @africode/core/components/tooltip.js
  • @africode/core/core/a2ui-schema-manager.js
  • @africode/core/core/a2ui.js
  • @africode/core/core/actions.js
  • @africode/core/core/bun-runtime.js
  • @africode/core/core/cli/commands/add.js
  • @africode/core/core/cli/commands/audit.js
  • @africode/core/core/cli/commands/build.js
  • @africode/core/core/cli/commands/create-plugin.js
  • @africode/core/core/cli/commands/dev.js
  • @africode/core/core/cli/commands/lint.js
  • @africode/core/core/cli/commands/test.js
  • @africode/core/core/cli/migrator.js
  • @africode/core/core/cli/ui.js
  • @africode/core/core/compliance.js
  • @africode/core/core/config.js
  • @africode/core/core/db-advanced.js
  • @africode/core/core/db.js
  • @africode/core/core/enhanced-hmr.js
  • @africode/core/core/errors.js
  • @africode/core/core/file-router.js
  • @africode/core/core/heartbeat.js
  • @africode/core/core/hmr-client.js
  • @africode/core/core/hmr.js
  • @africode/core/core/html.d.ts
  • @africode/core/core/html.js
  • @africode/core/core/hydration.js
  • @africode/core/core/lipa-namba-journey.js
  • @africode/core/core/logging.js
  • @africode/core/core/middleware.js
  • @africode/core/core/motion.js
  • @africode/core/core/nida-cig-middleware.js
  • @africode/core/core/patterns.d.ts
  • @africode/core/core/patterns.js
  • @africode/core/core/plugins/index.js
  • @africode/core/core/request-identity.js
  • @africode/core/core/router.js
  • @africode/core/core/sdk-client.js
  • @africode/core/core/sdk.d.ts
  • @africode/core/core/sdk.js
  • @africode/core/core/seo.js
  • @africode/core/core/server/auth-endpoints.js
  • @africode/core/core/server/auth.js
  • @africode/core/core/server/csrf.js
  • @africode/core/core/server/db.js
  • @africode/core/core/server/middleware.js
  • @africode/core/core/server/rate-limit.js
  • @africode/core/core/server/render.js
  • @africode/core/core/server/router.js
  • @africode/core/core/session-store.js
  • @africode/core/core/shim.js
  • @africode/core/core/state.d.ts
  • @africode/core/core/state.js
  • @africode/core/core/store.d.ts
  • @africode/core/core/store.js
  • @africode/core/core/validation.d.ts
  • @africode/core/core/validation.js
  • @africode/core/core/websocket.js
  • @africode/core/styles

Readme

🌍 AfriCode v5.0.0 β€” The Design System of Sovereignty

Autonomous Framework for African Digital Economy
Bridging AI safety, fintech compliance, and cultural heritage through high-performance web architecture.

Version: 5.0.0 Status: Cloud Ready AMD AI Cloud: $100 Credits Alibaba Cloud: Free Tier License: MIT

Overview

AfriCode v5.0.0 is an autonomous full-stack framework that "owns" the application lifecycle. Built on Bun runtime with TypeScript-first architecture, it provides AI-safe component generation, comprehensive fintech compliance, and zero-downtime infrastructure for the African digital economy.

Strategic Vision: From Tanzania to the Continent

Following the rollout framework, AfriCode v5.0.0 implements a phased Pan-African expansion:

  • Phase 1 (Months 1-4): Silicon Dar foundation with TIPS integration
  • Phase 2 (Months 5-9): East African Corridor (Kenya, Uganda, Rwanda)
  • Phase 3 (Months 10-15): West African Hub (Nigeria, Ghana)
  • Phase 4 (Months 16-24): Continental governance and sustainability

✨ Autonomous Features

πŸ€– AI-Safe Architecture (A2UI Protocol)

  • Robot-First Manifest: Machine-readable component catalog prevents hallucinations
  • Ethnomathematical Patterns: Procedural generation of Kente, Ndebele, Shuka motifs
  • Schema Validation: Pre-approved components with usage hints and constraints

πŸ” Fintech Compliance "Hardening"

  • NIDA CIG Bridge: VPN-tunneled identity verification with Ed25519 cryptography
  • TIPS Integration: Bank of Tanzania-compliant payment flows
  • AML/FIU Reporting: Automated regulatory compliance and transaction logging

⚑ Zero-Downtime Infrastructure

  • File-Based Routing: Automatic /pages to URL mapping with dynamic routes
  • Enhanced HMR: Session preservation during hot reloads
  • Bun-Native Runtime: 5ms startup with WebSocket orchestration

🎨 Cultural Resonance

  • 33+ Web Components: African-themed UI elements with cultural semiotics
  • Procedural SVG Engine: Fractal geometry for traditional patterns
  • Mobile-First Design: Optimized for African connectivity constraints

πŸš€ Quick Start

Create Autonomous Project

# Install globally via NPM
npm install -g @africode/core

# Create new project
create-africode my-app
cd my-app

# Install dependencies
bun install

# Start autonomous development server
bun run dev

Project Structure (Autonomous)

my-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ server.ts          # Autonomous server entry
β”‚   β”œβ”€β”€ pages/             # File-based routes
β”‚   β”‚   β”œβ”€β”€ index.ts       # Home page
β”‚   β”‚   └── api/           # API routes
β”‚   β”œβ”€β”€ components/        # Custom components
β”‚   └── core/              # Framework extensions
β”œβ”€β”€ public/                # Static assets
β”œβ”€β”€ package.json           # NPM configuration
β”œβ”€β”€ tsconfig.json          # TypeScript config
└── catalog.json           # A2UI component manifest

AI-Safe Development

// pages/index.ts
import { html } from '@africode/core';

export default function Home() {
  return html`
    <af-app>
      <af-navbar>
        <h1 slot="brand">My AfriCode App</h1>
      </af-navbar>

      <main>
        <af-hero>
          <h1>AI-Safe Fintech</h1>
          <p>Built with cultural patterns</p>
          <af-kente-pattern complexity="3"></af-kente-pattern>
        </af-hero>
      </main>
    </af-app>
  `;
}

πŸ—οΈ Architecture

Core Modules

Module Purpose Status
src/index.ts Main framework entry βœ… Complete
core/a2ui-schema-manager.js AI component catalog βœ… Enhanced
core/nida-cig-middleware.js Identity verification βœ… VPN + Crypto
core/lipa-namba-journey.js Payment primitives βœ… BoT Compliant
core/file-router.js File-based routing βœ… Dynamic routes
core/enhanced-hmr.js Zero-downtime HMR βœ… Session preservation

Cloud Infrastructure

AMD AI Cloud (Intelligence Layer)

  • MI300X GPUs: 192GB HBM3 for LLM inference
  • $100 Credits: 200 hours on RunPod community cloud
  • AfriCode-Coder Model: Fine-tuned for Tanzanian fintech law

Alibaba Cloud (Asset Layer)

  • Model Studio: Qwen3-Max for complex reasoning
  • Free Tier: 1M tokens for initial rollout
  • Batch Inference: 50% cost reduction for production

πŸ”§ CLI Commands

# Development
africode dev              # Start dev server with HMR
africode build            # Production build
africode lint             # Code quality checks

# AI Integration
africode generate a2ui    # Update component catalog
africode generate patterns # Regenerate cultural patterns

# Fintech
africode migrate          # Run database migrations
africode audit            # Security and compliance audit

🎭 Ethnomathematical Patterns

AfriCode v5.0.0 incorporates traditional African geometric principles:

Kente Weaving (Glide Reflection)

import { generateKente } from '@africode/core';

const pattern = generateKente({
  baseColor: '#8B4513',
  accentColor: '#DAA520',
  complexity: 3
});

Ndebele Fractals (Recursive Geometry)

const ndebele = generateNdebele({
  recursionDepth: 4,
  symmetry: 'rotational',
  colors: ['#FF6B6B', '#4ECDC4', '#45B7D1']
});

πŸ”’ Fintech Compliance

NIDA Identity Verification

import { NIDAClient } from '@africode/core';

const nida = new NIDAClient({
  vpnEnabled: true,
  endpoint: 'https://api.nida.go.tz/cig'
});

const result = await nida.verifyNIN('12345678901234567890', 'PIN');

TIPS Payment Processing

import { LipaNambaJourney } from '@africode/core';

const journey = new LipaNambaJourney();
const payment = await journey.executeFullJourney({
  merchantId: 'MERCHANT_001',
  customerPhone: '255712345678',
  amount: 50000
}, customerIdentity, confirmationData);

🌐 Pan-African Expansion

Phase 1: Tanzania Foundation

  • TIPS Integration: Real-time payment processing
  • NIDA Compliance: Identity verification for KYC
  • Cultural Patterns: Swahili language support

Phase 2: East African Corridor

  • PAPSS Bridge: Cross-border settlement
  • Regional Hubs: Nairobi, Kampala, Kigali
  • Agri-Fintech: Supply chain integration

Phase 3: West African Powerhouse

  • NIBSS Integration: Nigerian payment systems
  • Kente Patterns: Ghanaian cultural motifs
  • Enterprise Adoption: Large corporate clients

🀝 Community & Incentives

AfriCode Pioneer Bounty Program

  • Bug Fixes: $50-200 for confirmed issues
  • Features: $300-1500 for new capabilities
  • Performance: $100-500 for optimizations
  • Cultural Assets: $50-300 for pattern designs

Developer Hubs

  • Silicon Dar: Dar es Salaam tech district
  • iHub Nairobi: East African innovation
  • CcHUB Lagos: West African powerhouse
  • GDG Network: Google Developer Groups across Africa

πŸ“Š Performance Metrics

  • Startup Time: <5ms (Bun-native)
  • Bundle Size: <100KB (tree-shaken)
  • Lighthouse Score: 95+ (mobile-first)
  • TIPS Transactions: 490M+ annually supported
  • NIDA Verifications: Real-time with VPN security

πŸ“š Documentation

🀝 Contributing

We welcome contributions that align with our Pan-African vision:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure AI-safety compliance
  5. Submit a pull request

πŸ“„ License

Dual License:

  • Open Source: AGPL v3.0 for community projects
  • Commercial: Available for enterprise deployments

🌟 Acknowledgments

Built for the African developer community with support from:

  • Bank of Tanzania (TIPS infrastructure)
  • National Identification Authority (NIDA systems)
  • AMD AI Cloud ($100 credits for AI development)
  • Alibaba Cloud (Model Studio free tier)
  • African Export-Import Bank (PAPSS coordination)

"Designed for Tanzanians by Tanzanians, Built for Africans by Africans"

πŸ‡ΉπŸ‡ΏπŸ‡°πŸ‡ͺπŸ‡ΊπŸ‡¬πŸ‡·πŸ‡ΌπŸ‡³πŸ‡¬πŸ‡¬πŸ‡­πŸ‡ΏπŸ‡¦πŸ‡²πŸ‡¦

Local Development (Framework Contributors)

If you are developing the framework itself:

  1. Clone and navigate to the framework directory
  2. Register the link: bun link
  3. Use in another project: bun link africode
  4. Run validation: bun scripts/validate-fresh-install.js

Usage (SDK)

Import the core SDK to generate patterns, use the state engine, or handle routing:

import { patterns, store, components } from 'africode';
import { FileSystemRouter } from 'africode/core/router.js';

// Generate a Maasai Shuka pattern
const shukaPattern = patterns.generateShuka();
document.body.style.backgroundImage = `url("${shukaPattern}")`;

// Use Global State
store.ui.theme = 'tanzania';
store.ui.theme; // 'tanzania' - triggers effects on change

// Use File-Based Routing
const router = new FileSystemRouter('./pages');
const route = await router.matchRoute('/users/123');
// { page, params: { id: '123' }, path: '/users/[id]' }

Usage (Authentication)

AfriCode includes built-in session-based authentication:

// API endpoints (automatically available)
POST / api / auth / register; // { email, username, password, fullname }
POST / api / auth / login; // { email/username, password }
POST / api / auth / logout; // Clears session
GET / api / auth / me; // Current user (requires session)
POST / api / auth / refresh; // Extend session expiry

Passwords are hashed with Argon2id (built into Bun), sessions use HttpOnly cookies with SameSite=Strict protection.

Usage (UI Components)

Simply import the components to register them as Custom Elements:

import 'africode/components';

Then use them in your HTML:

<af-navbar theme="tanzania" logo="My App"></af-navbar>

<af-kanga-card proverb="Haraka haraka haina baraka.">
  <h3>Project Title</h3>
  <p>Content goes here...</p>
</af-kanga-card>

<af-button onclick="handleClick()">Click Me</af-button>

βš™οΈ Development

Hot Module Replacement (HMR)

During bun run dev, any file changes trigger automatic browser refresh. This provides 5-10x faster iteration compared to manual reloads:

bun run dev
# Edit a file β†’ browser updates instantly

HMR is smart about what to reload:

  • .js files: Full page reload
  • .css files: Incremental style update
  • .html files: DOM refresh

File-Based Routing

Create files in pages/ and they automatically become routes:

pages/
  index.js          β†’ /
  about.js          β†’ /about
  users/
    [id].js         β†’ /users/123
  api/
    users.js        β†’ POST /api/users
    [...rest].js    β†’ Catch-all: /api/foo/bar/baz

Route parameters are automatically extracted: params.id, params.rest, etc.

πŸ—οΈ Architecture

core/
  β”œβ”€β”€ state.js          β†’ Proxy-based reactive state management
  β”œβ”€β”€ patterns.js       β†’ Cultural SVG generators (Kente, Shuka, Ndebele, Maasai)
  β”œβ”€β”€ html.js           β†’ XSS-safe tagged template literals
  β”œβ”€β”€ router.js         β†’ File-based routing with dynamic routes
  β”œβ”€β”€ db.js             β†’ SQLite ORM with migrations and transactions
  β”œβ”€β”€ auth.js           β†’ Argon2id password hashing and sessions
  β”œβ”€β”€ a2ui.js           β†’ Generative AI interface protocol (v5.0.0)
  β”œβ”€β”€ compliance.js     β†’ Tanzanian fintech regulations (v5.0.0)
  β”œβ”€β”€ bun-runtime.js    β†’ High-performance server engine (v5.0.0)
  β”œβ”€β”€ hydration.js      β†’ Component system and lifecycle
  └── server/
      β”œβ”€β”€ auth-endpoints.js    β†’ Authentication API endpoints
      β”œβ”€β”€ router.js            β†’ Request routing and handler delegation
      └── render.js            β†’ Server-side rendering with HTML injection

components/
  β”œβ”€β”€ base.js           β†’ Web Component base class
  β”œβ”€β”€ 33+ UI components β†’ African-themed elements (buttons, cards, modals)
  └── pattern-showcase.js β†’ Cultural pattern gallery

patterns/
  β”œβ”€β”€ 8 Regional Generators β†’ Procedurally generated SVG patterns
  └── Cultural design system with African semiotics

πŸ“Š Test Coverage

All core systems have comprehensive test coverage:

  • βœ… HTML Templates (html.test.js) - Nested rendering, escaping, arrays, XSS prevention
  • βœ… File-Based Routing (router.test.js) - Dynamic routes, catch-all, parameter extraction
  • βœ… State Management (state.test.js, store.test.js) - Reactivity, effects, signals, deep updates
  • βœ… HMR System (hmr.test.js) - WebSocket server, client reconnection, file watching
  • βœ… Authentication (auth.test.js) - Registration, login, session management, Argon2id hashing
  • βœ… Validation (validation.test.js) - Zod schemas, email, phone, URL, AfriFieldBuilder
  • βœ… Advanced ORM (orm-advanced.test.js) - QueryBuilder, transactions, migrations, WAL mode
  • βœ… WebSocket (websocket.test.js) - Connections, rooms, presence, message queueing, heartbeats
  • βœ… Middleware (middleware.test.js) - CORS, logging, rate limiting, auth, security headers
  • βœ… Security (security.test.js) - CSRF, injection prevention, token validation
  • βœ… Plugin System (plugins.test.js) - Hook execution, timeouts, isolation, safe/strict modes
  • βœ… Cultural Patterns (patterns.test.js) - SVG output, Kente, Ndebele, Kuba, Masai, Zulu
  • βœ… Accessibility (a11y.test.js) - ARIA roles, keyboard navigation, focus management
  • βœ… Framework Core (framework.test.js) - SDK init, config, component lifecycle

Total: 389 passing tests with zero regressions

πŸ“œ Licensing

AfriCode is Dual Licensed:

  1. AGPL v3: For open-source projects. You must open-source your code if you use AfriCode.
  2. Commercial: For proprietary projects. Contact us for a commercial license to build closed-source apps.

🀝 Contribution

We welcome contributions! Please see CONTRIBUTING.md for details.


Built with ❀️ by the AfriCode Team