Files
gru_emoney_token-factory/api/GETTING_STARTED.md
defiQUG 651ff4f7eb Initial project setup: Add contracts, API definitions, tests, and documentation
- Add Foundry project configuration (foundry.toml, foundry.lock)
- Add Solidity contracts (TokenFactory138, BridgeVault138, ComplianceRegistry, etc.)
- Add API definitions (OpenAPI, GraphQL, gRPC, AsyncAPI)
- Add comprehensive test suite (unit, integration, fuzz, invariants)
- Add API services (REST, GraphQL, orchestrator, packet service)
- Add documentation (ISO20022 mapping, runbooks, adapter guides)
- Add development tools (RBC tool, Swagger UI, mock server)
- Update OpenZeppelin submodules to v5.0.0
2025-12-12 10:59:41 -08:00

3.1 KiB

Getting Started with eMoney API

Prerequisites

  • Node.js: 18.0.0 or higher
  • pnpm: 8.0.0 or higher (package manager)
  • TypeScript: 5.3.0 or higher
  • Redis: For idempotency handling
  • Kafka/NATS: For event bus (optional for development)

Installing pnpm

If you don't have pnpm installed:

# Using npm
npm install -g pnpm

# Using curl (Linux/Mac)
curl -fsSL https://get.pnpm.io/install.sh | sh -

# Using Homebrew (Mac)
brew install pnpm

# Verify installation
pnpm --version

Workspace Setup

This is a pnpm workspace with multiple packages. Install all dependencies from the api/ root:

cd api
pnpm install

This will install dependencies for all packages in the workspace:

  • Services (REST API, GraphQL, Orchestrator, etc.)
  • Shared utilities (blockchain, auth, validation, events)
  • Tools (Swagger UI, mock servers, SDK generators)
  • Packages (schemas, OpenAPI, GraphQL, etc.)

Running Services

REST API Server

cd api/services/rest-api
pnpm run dev

Server runs on: http://localhost:3000

GraphQL API Server

cd api/services/graphql-api
pnpm run dev

Server runs on: http://localhost:4000/graphql

Swagger UI Documentation

cd api/tools/swagger-ui
pnpm run dev

Documentation available at: http://localhost:8080/api-docs

Mock Servers

cd api/tools/mock-server
pnpm run start:all

Mock servers:

Building

Build all packages:

cd api
pnpm run build:all

Build specific package:

cd api/services/rest-api
pnpm run build

Testing

Run all tests:

cd api
pnpm run test:all

Run specific test suite:

cd test/api
pnpm test

Workspace Commands

From the api/ root:

# Install all dependencies
pnpm install

# Build all packages
pnpm run build:all

# Run all tests
pnpm run test:all

# Run linting
pnpm run lint:all

# Clean all build artifacts
pnpm run clean:all

Package Management

Adding Dependencies

To a specific package:

cd api/services/rest-api
pnpm add express

To workspace root (dev dependency):

cd api
pnpm add -D -w typescript

Using Workspace Packages

Internal packages use workspace:* protocol:

{
  "dependencies": {
    "@emoney/blockchain": "workspace:*",
    "@emoney/validation": "workspace:*"
  }
}

Troubleshooting

pnpm not found

Install pnpm globally:

npm install -g pnpm

Workspace dependencies not resolving

Ensure you're running commands from the api/ root:

cd api
pnpm install

Build errors

Clear node_modules and reinstall:

cd api
rm -rf node_modules
rm pnpm-lock.yaml
pnpm install

Next Steps

  1. Review API README for architecture overview
  2. Check Swagger UI Guide for API documentation
  3. See Integration Cookbook for usage examples
  4. Review Error Catalog for error handling