This document explains the structure of the Nestera monorepo and what each major directory/file contributes. It is intended to be a single “source of truth” README for new contributors.
Nestera is a decentralized savings and investment protocol built on Stellar using Soroban smart contracts. It enables:
- Non-custodial savings enforced on-chain
- Flexible and locked savings with deterministic interest logic
- Goal-based and group savings mechanisms
- A web interface (frontend) and an API layer (backend) for off-chain services
Main components:
contracts/: Soroban smart contracts (Rust)backend/: NestJS API for indexing, orchestration, metadata/analytics, and other off-chain responsibilitiesfrontend/: Next.js web app for interacting with the protocolscripts/: automation helpers for cleanup/testing/rollbacks
/
├── frontend/ # Next.js application
├── backend/ # NestJS backend API
├── contracts/ # Soroban smart contracts (Rust)
├── scripts/ # Automation scripts (deploy/test helpers)
├── src/ # Repo-level TS modules (additional code, if used)
└── README.md # Primary project README (short)
package.json/pnpm-workspace.yaml/pnpm-lock.yaml- Defines a pnpm workspace so
frontend/,backend/, andcontracts/can be coordinated.
- Defines a pnpm workspace so
Cargo.toml/Cargo.lock- Rust workspace metadata for
contracts/(Soroban code compilation/test).
- Rust workspace metadata for
eslint.config.js- Root lint configuration.
CONTRIBUTING.md- Contribution process and code ownership expectations.
OBSERVABILITY.md- Correlation ID / audit log runbook (end-to-end tracing patterns).
Project status/progress artifacts (examples):
DEVELOPMENT_PROGRESS.md,README_PROGRESS.md,REPO_STATUS.md,FINAL_STATUS.md- operational docs:
DISASTER_RECOVERY_RUNBOOK.md,REPO_FIX_PLAN.md - CI/performance docs:
CI_CD_TEST_REPORT.md,CLONE_SPEED_FIX.md,QUICK_FIX_CLONE_SPEED.md
Root pnpm-workspace.yaml includes:
backendfrontendcontracts
Root Cargo.toml and contracts/ define compilation/testing for Soroban smart contracts.
Implements the protocol logic on-chain: savings behavior, constraints, custody rules, and withdrawal rules.
contracts/
├── Cargo.toml
├── src/
│ ├── lib.rs
│ ├── token.rs, treasury/*, staking/*, strategy/*, rewards/* (modules)
│ ├── governance.rs, group.rs, goal.rs, lock.rs (core domain)
│ ├── security.rs, errors.rs, invariants.rs, storage_types.rs
│ └── *_tests.rs (module-specific test code)
└── tests/
├── integration.rs
├── *_test.rs (multi-contract behavior tests)
└── rewards/ strategy/ treasury integration tests
contracts/README.md describes an Off-Chain Oracle pattern:
- An Admin signs a payload off-chain (Ed25519).
- Users submit payload + signature to the contract.
- The contract verifies the signature and enforces timestamp/expiry.
Provides the off-chain service layer. Responsibilities include:
- Indexing/monitoring contract events
- API endpoints for the frontend
- User metadata management and analytics aggregation
- Security hardening (Helmet/CORS, throttling, RBAC)
backend/src/
├── app.controller.ts / app.module.ts / app.service.ts / main.ts
├── auth/ # authentication, guards/RBAC-related code
├── common/ # shared utilities and filters/interceptors
├── config/ # configuration loading
├── migrations/ # database migrations
├── modules/ # domain-specific feature modules
├── test-rbac/ # RBAC tests
└── test-throttling/ # throttling tests
backend/src/Secure API Headers with Helmet & CORS/README.md
backend/test/*.e2e-spec.tscontains E2E coverage (health, throttling, webhooks, disputes, etc.).
The UI used to interact with Nestera: create savings accounts, deposit funds, and track progress.
frontend/app/
├── layout.tsx, page.tsx, loading.tsx, globals.css
├── components/
├── context/
├── dashboard/
├── docs/
├── features/
├── goals/, savings/
├── proposals/, community/
├── privacy/, terms/, support/
Contains repository automation utilities such as cleanup and test/rollback helpers.
Examples:
scripts/cleanup-repo.shbackend/scripts/check-migrations-down.jsbackend/scripts/test-rollback.sh
At the root there is a src/ directory. The listing shows src/modules/. This may contain additional modules used by tooling or shared logic.
OBSERVABILITY.md documents:
X-Correlation-IDUUID per API request- propagation through HTTP, DB audit logs, background jobs, and contract event metadata
It includes SQL patterns and debugging procedures.
CONTRIBUTING.md specifies:
- workflow (branch naming, PR steps)
- testing expectations
- code ownership / required review paths for security/critical modules
README.md(product summary + architecture)contracts/README.md(off-chain oracle / authorization)backend/src/Secure API Headers with Helmet & CORS/README.mdOBSERVABILITY.md(incident tracing)CONTRIBUTING.md(workflow + ownership)
- Off-Chain Oracle: Off-chain admin signature authorizing on-chain actions.
- Correlation ID: Request-scoped UUID used for end-to-end tracing.
EOF