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/initSign In:
POST /v1/auth/siwe/signinGet Profile:
GET /v1/auth/me
Core Endpoints
Markets:
/v1/market/*— Yield tokenization data and analyticsUsers:
/v1/user/*— Portfolio and account dataPoints:
/v1/point/*— Reward systemCurators:
/v1/curator/*— Curator operationsTokens:
/v1/token/*— Token metadataHealth:
/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
Clone the repo and install dependencies with
pnpm install.Configure environment variables (
.env).Start PostgreSQL and Redis (
docker-compose up -d).Run migrations:
pnpm run migration:run.Start the server:
pnpm run start:dev. API available athttp://localhost:3000with docs at/docs.
Last updated
Was this helpful?