Edviron - NestJS Payment Gateway API by JAYESH NIKAMEdviron - NestJS Payment Gateway API by JAYESH NIKAM

Edviron - NestJS Payment Gateway API

JAYESH NIKAM

JAYESH NIKAM

Edviron - NestJS Payment Gateway API

๐Ÿš€ A comprehensive NestJS application with MongoDB Atlas integration, JWT authentication, payment processing, and transaction management.

๐ŸŒŸ Features

๐Ÿ—๏ธ NestJS Framework - Progressive Node.js framework with TypeScript
๐Ÿƒ MongoDB Atlas - Cloud database with Mongoose ODM
๐Ÿ” JWT Authentication - Secure authentication with Passport strategies
๐Ÿ’ณ Payment Gateway - Edviron payment integration with JWT signing
๐Ÿ”— Webhook Processing - Real-time payment status updates
๐Ÿ“Š Transaction APIs - Advanced querying with pagination and sorting
๐Ÿ›ก๏ธ Security - Helmet, CORS, input validation, and rate limiting
โœ… Validation - Comprehensive request validation with class-validator
๐Ÿ“ Clean Architecture - Well-organized modular structure
๐Ÿ“š API Documentation - Complete Postman collection included

๐Ÿ“ Project Structure

src/ โ”œโ”€โ”€ config/ โ”‚ โ””โ”€โ”€ configuration.ts # Environment configuration โ”œโ”€โ”€ decorators/ โ”‚ โ””โ”€โ”€ public.decorator.ts # Custom decorators โ”œโ”€โ”€ dto/ โ”‚ โ”œโ”€โ”€ create-user.dto.ts # User validation DTOs โ”‚ โ”œโ”€โ”€ create-payment.dto.ts # Payment validation DTOs โ”‚ โ”œโ”€โ”€ webhook.dto.ts # Webhook validation DTOs โ”‚ โ””โ”€โ”€ transaction-query.dto.ts # Transaction query DTOs โ”œโ”€โ”€ guards/ โ”‚ โ”œโ”€โ”€ jwt-auth.guard.ts # JWT authentication guard โ”‚ โ”œโ”€โ”€ jwt-auth-enhanced.guard.ts # Enhanced JWT guard with public routes โ”‚ โ”œโ”€โ”€ jwt.strategy.ts # JWT Passport strategy โ”‚ โ””โ”€โ”€ local.strategy.ts # Local Passport strategy โ”œโ”€โ”€ middlewares/ โ”‚ โ””โ”€โ”€ logger.middleware.ts # HTTP request logging โ”œโ”€โ”€ modules/ โ”‚ โ”œโ”€โ”€ auth/ โ”‚ โ”‚ โ”œโ”€โ”€ auth.controller.ts # Authentication endpoints โ”‚ โ”‚ โ”œโ”€โ”€ auth.service.ts # Authentication logic โ”‚ โ”‚ โ””โ”€โ”€ auth.module.ts # Auth module configuration โ”‚ โ”œโ”€โ”€ user/ โ”‚ โ”‚ โ”œโ”€โ”€ user.controller.ts # User CRUD endpoints โ”‚ โ”‚ โ”œโ”€โ”€ user.service.ts # User business logic โ”‚ โ”‚ โ””โ”€โ”€ user.module.ts # User module configuration โ”‚ โ””โ”€โ”€ payment/ โ”‚ โ”œโ”€โ”€ payment.controller.ts # Payment endpoints โ”‚ โ”œโ”€โ”€ payment.service.ts # Payment processing logic โ”‚ โ”œโ”€โ”€ webhook.service.ts # Webhook processing โ”‚ โ”œโ”€โ”€ transaction.service.ts # Transaction queries โ”‚ โ”œโ”€โ”€ transaction.controller.ts # Transaction endpoints โ”‚ โ””โ”€โ”€ payment.module.ts # Payment module configuration โ”œโ”€โ”€ schemas/ โ”‚ โ”œโ”€โ”€ user.schema.ts # User MongoDB schema โ”‚ โ”œโ”€โ”€ order.schema.ts # Order MongoDB schema โ”‚ โ”œโ”€โ”€ order-status.schema.ts # OrderStatus MongoDB schema โ”‚ โ””โ”€โ”€ webhook-logs.schema.ts # WebhookLogs MongoDB schema โ”œโ”€โ”€ app.controller.ts โ”œโ”€โ”€ app.module.ts # Main application module โ”œโ”€โ”€ app.service.ts โ””โ”€โ”€ main.ts # Application entry point

๐Ÿ”ง Prerequisites

Node.js (v18 or higher)
npm or yarn
MongoDB Atlas account
Postman (optional, for API testing)

๐Ÿš€ Quick Start

1. Clone and Install

# Clone the repository git clone <repository-url> cd edviron # Install dependencies npm install

2. Environment Configuration

# Copy environment template cp .env.example .env
Edit the .env file with your configuration:
# Application Configuration PORT=3000 NODE_ENV=development # CORS Configuration CORS_ORIGIN=http://localhost:3000,http://localhost:3001 # Payment Gateway Configuration PAYMENT_API_KEY=your-edviron-api-key PG_KEY=your-payment-gateway-key PAYMENT_BASE_URL=https://dev-vanilla.edviron.com # Security Configuration BCRYPT_SALT_ROUNDS=10 API_KEY=your-api-key-here

3. MongoDB Atlas Setup

Create Account: Visit MongoDB Atlas
Create Cluster: Set up a free tier cluster
Database User: Create a user with read/write permissions
Network Access: Whitelist your IP (use 0.0.0.0/0 for development)
Connection String: Copy and update MONGODB_URI in .env

4. Run the Application

# Development mode with hot reload npm run start:dev # Production mode npm run start:prod # Debug mode npm run start:debug
๐ŸŽ‰ Application will be available at:http://localhost:3000

๐Ÿ“š API Documentation

๐Ÿ” Authentication Endpoints

Method
Endpoint
Description
Auth Required
POST
/auth/login
User login
โŒ
GET
/auth/profile
Get user profile
โœ…

๐Ÿงช Usage Examples

Authentication Flow

# 1. Create a user curl -X POST http://localhost:3000/users \ -H "Content-Type: application/json" \ -d '{ "username": "johndoe", "email": "john@example.com", "password": "password123", "firstName": "John", "lastName": "Doe" }' # 2. Login to get JWT token curl -X POST http://localhost:3000/auth/login \ -H "Content-Type: application/json" \ -d '{ "email": "john@example.com", "password": "password123" }' # 3. Use JWT token for protected routes curl -X GET http://localhost:3000/auth/profile \ -H "Authorization: Bearer YOUR_JWT_TOKEN"

๐Ÿ“ฎ Postman Collection

Import the included Postman collection for easy API testing:
Open Postman
Click Import
Select Edviron-API.postman_collection.json
Update environment variables:
baseUrl: http://localhost:3000
accessToken: Your JWT token from login

๐Ÿ“„ License

This project is MIT licensed.
image2
image2
image3
image3
image4
image4
image5
image5
Like this project

Posted May 28, 2026

A comprehensive NestJS application for payment processing and transaction management.