Skip to content

Nexacore-Org/NexaFx-backend

Repository files navigation

NexaFX Backend

NexaFX is a Web3-powered currency exchange platform that supports real-time fiat and crypto conversions. The backend is built using NestJS and interfaces with smart contracts written in Rust on the Stellar network.

🚀 Features

  • JWT-based authentication and authorization
  • Role-based access control (Admin, User, Tutor)
  • Multi-currency exchange system
  • Blockchain integration with Stellar smart contracts
  • Real-time and historical transactions tracking
  • Modular, scalable NestJS architecture
  • Exportable transaction data (CSV, Excel, PDF)

🏗️ Project Architecture

nexafx-backend/
├── src/
│   ├── auth/              # JWT auth module
│   ├── users/             # User management (CRUD, roles)
│   ├── currencies/        # Fiat and crypto currency support
│   ├── transactions/      # Transaction logs and conversions
│   ├── common/            # Guards, interceptors, decorators
│   ├── config/            # Environment configs and database setup
│   └── main.ts            # Application entry point
├── migrations/            # SQL migration files (e.g. using TypeORM CLI)
├── test/                  # Unit and integration tests
├── .env.example           # Sample environment configuration
├── package.json
└── README.md

📦 Tech Stack

  • Backend: NestJS, TypeScript
  • ORM: TypeORM (PostgreSQL)
  • Security: JWT, Bcrypt
  • Blockchain: Stellar (Rust smart contracts)
  • Exporting: pdfkit, exceljs, fast-csv
  • Testing: Jest, Supertest

⚙️ Environment Variables

Create a .env file in the root directory. Refer to .env.example:

DATABASE_URL=postgresql://USER:PASSWORD@localhost:5432/nexafx
JWT_SECRET=your_secret_key
JWT_EXPIRES_IN=1d
STELLAR_NETWORK=TESTNET
STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
STELLAR_ADMIN_SECRET=your_stellar_admin_secret

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/your-org/nexafx-backend.git
cd nexafx-backend

2. Install Dependencies

npm install

3. Setup Database

npx prisma migrate dev --name init
npx prisma generate

4. Run the Application

npm run start:dev

🧪 Running Tests

# Unit & Integration
npm run test

# E2E
npm run test:e2e

# Coverage
npm run test:cov

🔐 Role-Based Access

  • USER: Can perform standard exchange operations
  • TUTOR: Manages educational content (future module)
  • ADMIN: Full control of all resources

Guards are applied at controller and route levels using custom decorators and NestJS Guards.


📁 Modules Overview

Module Description
auth JWT login, registration, guards
users User CRUD, roles, profile
currencies Supported fiat & crypto currencies
transactions Track exchanges & conversions (CRUD)
common Utilities, global guards, DTOs

📄 API Documentation

Coming Soon: Swagger/OpenAPI integration for full REST endpoint visibility.


🧱 Smart Contract Integration

  • Rust-based contracts deployed on Stellar testnet
  • Integration handled via service in NestJS using Horizon APIs
  • Each transaction is optionally linked with a smart contract execution (future roadmap)

📝 Commit Message Format

# Format:
type(scope): subject

# Examples:
feat(auth): implement refresh token strategy
fix(users): validate email uniqueness
chore(deps): upgrade Prisma to 5.0.0

📌 Roadmap

  • Auth Module with JWT
  • Users Module with roles
  • Currencies Module (Fiat + Crypto)
  • Transactions Module with Stellar link
  • DAO & Reward System (via Smart Contracts)
  • Real-time rate updates
  • Export features

🔗 Related Repositories

📜 License

MIT License. See LICENSE file.

📧 Contact

For inquiries, discussions, or help, feel free to reach out to us:


About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 50