Skip to content

accesslayerorg/accesslayer-server

Access Layer Server

This repository contains the backend API for Access Layer.

The server is the off-chain layer for the product. It handles the parts of the marketplace that do not need to live inside Stellar smart contracts, while coordinating with the client and contracts as the product grows.

Purpose

The server is responsible for:

  • creator and user profile management
  • auth and session-related flows
  • creator metadata and perk definitions
  • indexing contract activity for faster reads
  • notifications, analytics, and moderation workflows
  • access checks for gated off-chain content

Tech

  • Node.js
  • Express
  • TypeScript
  • Prisma
  • PostgreSQL

Current state

  • Express app bootstrap exists in src/app.ts
  • common backend middleware is already scaffolded
  • reusable starter utilities are kept in generic Access Layer-safe form

Local setup

pnpm install
cp .env.example .env
pnpm db:up
pnpm exec prisma generate
pnpm exec prisma db push
pnpm dev

Database

This repo includes a local PostgreSQL container for development.

Start the database:

pnpm db:up

Watch database logs:

pnpm db:logs

Stop the database:

pnpm db:down

The default connection string in .env.example matches the included Docker setup.

Verification

pnpm lint
pnpm build

Health Check

The server provides health check endpoints for local development and production monitoring:

Simple Health Check

Endpoint: GET /api/v1/health

Returns a minimal response suitable for load balancers and uptime monitors:

{
   "success": true,
   "message": "OK",
   "timestamp": "2025-01-15T10:30:00.000Z"
}

Detailed Health Check

Endpoint: GET /api/v1/health/detailed

Returns comprehensive service status including database connectivity:

{
   "success": true,
   "message": "Access Layer server is running",
   "timestamp": "2025-01-15T10:30:00.000Z",
   "version": "1.0.0",
   "environment": "development",
   "uptime": 12345.67,
   "memory": {
      "used": 45.23,
      "total": 128.5
   },
   "system": {
      "platform": "win32",
      "nodeVersion": "v20.10.0"
   },
   "database": {
      "status": "connected",
      "responseTime": 12
   },
   "services": [
      {
         "name": "API Server",
         "status": "healthy"
      },
      {
         "name": "Database",
         "status": "healthy"
      }
   ]
}

Response Codes:

  • 200 OK - All services healthy (or development mode)
  • 503 Service Unavailable - Database disconnected in production

Usage Examples

Local Development:

curl http://localhost:3000/api/v1/health/detailed

Production Monitoring:

curl https://your-domain.com/api/v1/health

Docker/Kubernetes Health Probes:

livenessProbe:
   httpGet:
      path: /api/v1/health
      port: 3000
   initialDelaySeconds: 10
   periodSeconds: 30

readinessProbe:
   httpGet:
      path: /api/v1/health/detailed
      port: 3000
   initialDelaySeconds: 5
   periodSeconds: 10

Open source workflow

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors