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.
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
/pagesto 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 devProject 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 manifestAI-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:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure AI-safety compliance
- 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:
- Clone and navigate to the framework directory
- Register the link:
bun link - Use in another project:
bun link africode - 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 expiryPasswords 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 instantlyHMR is smart about what to reload:
.jsfiles: Full page reload.cssfiles: Incremental style update.htmlfiles: 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/bazRoute 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:
- AGPL v3: For open-source projects. You must open-source your code if you use AfriCode.
- 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