For the complete documentation index, see llms.txt. This page is also available as Markdown.

Napier API

The Napier API is the data infrastructure layer of the Napier Protocol ecosystem. It aggregates, processes, and serves data from both on-chain and off-chain sources to support market analytics, token information, and integrated services.

Core Functions

  • Data Aggregation: Combines information from subgraphs, RPCs, and off-chain sources.

  • Caching & Snapshots: Uses Redis caching and periodic snapshots for faster queries and historical analysis.

  • Multi-Chain Queries: Provides a unified interface to query data across multiple blockchains.

  • Off-Chain Storage: Manages persistent application data and metadata using PostgreSQL and AWS S3.

  • Subgraph Proxying: Enhances subgraph queries with additional metadata and fallback mechanisms.

  • Administrative Tools: Supports Slack bot operations, curator management, and reward point systems.

Infrastructure

  • Authentication: SIWE (Sign-In with Ethereum) using JWT.

  • Storage & Database: PostgreSQL with TypeORM and AWS S3.

  • Monitoring: Health checks, Sentry integration, and alerting tools.

  • Performance: Redis caching, query optimization, and rate limiting.

Developer Experience

  • Auto-generated Swagger/OpenAPI documentation.

  • Multi-environment support (development, staging, production).

  • Migration tools and schema versioning.

  • Comprehensive test and build scripts.

Technology Stack

NestJS (TypeScript), PostgreSQL, Redis, JWT (SIWE), AWS S3, Viem (Ethereum), Sentry, Swagger/OpenAPI.

Authentication Endpoints

  • Initialize SIWE: POST /v1/auth/siwe/init

  • Sign In: POST /v1/auth/siwe/signin

  • Get Profile: GET /v1/auth/me

Core Endpoints

  • Markets: /v1/market/* — Yield tokenization data and analytics

  • Users: /v1/user/* — Portfolio and account data

  • Points: /v1/point/* — Reward system

  • Curators: /v1/curator/* — Curator operations

  • Tokens: /v1/token/* — Token metadata

  • Health: /v1/health — System status

Security

  • Authenticated endpoints with SIWE/JWT

  • Input validation and SQL injection prevention

  • Rate limiting and caching against abuse

  • Secure file uploads via pre-signed URLs

Getting Started

  1. Clone the repo and install dependencies with pnpm install.

  2. Configure environment variables (.env).

  3. Start PostgreSQL and Redis (docker-compose up -d).

  4. Run migrations: pnpm run migration:run.

  5. Start the server: pnpm run start:dev. API available at http://localhost:3000 with docs at /docs.

Last updated

Was this helpful?