• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
ianmenethil

ianmenethil

ZenServer

Unlisted
Like
ZenServer
Home
Code
19
.claude
.client
.cursor
.git
.vscode
.vt
scripts
5
src
10
tasks
tests
.gitignore
.vtignore
CLAUDE.md
README.md
Z1-Server.md
ZenApp.md
deno.json
env.example
H
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
22
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Z1-Server.md
Code
/
Z1-Server.md
Search
7/10/2025
Viewing readonly version of main branch: v589
View latest version
Z1-Server.md

Based on the attached files, this is a Zenith API Server (Z1) - a microservices-based payment processing and webhook management system built on Val Town. Here's a comprehensive summary:

🏗️ Architecture Overview

The system follows a router-based microservices pattern where a central router (Router.ts) distributes requests to specialized endpoint handlers. Each service communicates using internal JWT tokens for security.

🛣️ Endpoints & Capabilities

1. Router (/)

  • Health checks: /, /ping, /health - System status monitoring
  • Request routing: Distributes traffic to specialized handlers
  • ZID generation: Creates unique request identifiers for tracking
  • Internal token management: Generates JWT tokens for inter-service communication

2. Webhooks (/hooks)

  • POST /hooks: Store incoming webhook data
  • GET /hooks: List webhooks with filtering (date range, payload mode)
  • GET /hooks/{id}: Retrieve specific webhook record
  • DELETE /hooks/{id}: Remove webhook record
  • Metadata capture: IP, country, user agent, headers, request body

3. Hash Generation (/hash)

  • Payment fingerprint generation using SHA-1, SHA-512, or SHA3-512
  • Multiple payment modes:
    • Mode 0: Payment amount > 0
    • Mode 1: Payment amount ≥ 0
    • Mode 2: Payment amount = 0
    • Mode 3: Payment amount ≥ 0
  • Input validation: Credentials, timestamps, payment amounts
  • Version support: v3, v4, v5 hash algorithms

4. Enhanced Hash (/zenhash)

  • Environment-based credentials: Pulls username/password from environment variables
  • Payment schemes: tp, rr, b2b, tbp, sep, ccep
  • Same validation & hashing as /hash but with scheme-based credential injection

5. Proxy (/proxy)

  • HTTP proxy service: Forward requests to external services
  • Header preservation: Maintains authentication headers (h-key, api-key, authorization)
  • Universal method support: GET, POST, PUT, DELETE, etc.

6. SlicePay (/create-link)

  • Payment link creation (delegated to external handler)
  • Link generation for payment processing

🔒 Security Architecture

Multi-Layer Security

  1. External Validation: Rate limiting, IP restrictions, request sanitization
  2. Internal JWT Authentication: Service-to-service communication security
  3. Request Correlation: ZID tracking across all services

JWT Security Features

  • HMAC SHA-512 token signing
  • Context validation: IP, User-Agent, host, path matching
  • 5-minute expiration with clock skew tolerance
  • Development mode support for local testing

Request Security

  • Header sanitization and validation
  • Input sanitization for all user data
  • Cloudflare integration: IP geolocation, country detection
  • CORS, CSP, and security headers

💾 Data Storage (SQLite)

Tables

  • webhooks: Webhook request records
  • hash: Basic hash generation logs
  • zenhash: Enhanced hash generation logs
  • logs: General application logs
  • rate_limits: Rate limiting data

Metadata Tracking

  • Request headers, body, timestamp
  • Client IP, country, user agent
  • ZID correlation across services
  • Hash generation parameters and results

🌐 Integration Features

Cloudflare Integration

  • IP detection: cf-connecting-ip, x-forwarded-for
  • Geolocation: Country, city, region detection
  • Security headers: Automatic forwarding of CF security data

Environment Configuration

  • Scheme-based credentials: U_TP, P_TP, etc.
  • JWT secrets: Configurable signing keys
  • Endpoint URLs: Microservice endpoint configuration

🔧 Operational Capabilities

Monitoring & Debugging

  • Health checks: System-wide status monitoring
  • Request correlation: ZID-based request tracking
  • Comprehensive logging: Full request/response capture
  • Error handling: Detailed error responses with stack traces

Performance Features

  • Async processing: Non-blocking request handling
  • Connection pooling: Efficient database connections
  • Rate limiting: Built-in request throttling

📊 Use Cases

This system appears designed for:

  • Payment processing: Secure hash generation for payment gateways
  • Webhook management: Capture and process incoming webhooks
  • API proxying: Route requests to external services
  • Request auditing: Full request/response logging for compliance
  • Multi-tenant support: Scheme-based credential management

The architecture suggests it's a production-grade payment infrastructure with enterprise security features, comprehensive logging, and microservices scalability.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.