Skip to content

vikashkrdeveloper/zorvyn-finance-api

Repository files navigation

Zorvyn Finance Data API

This is the backend for the Finance Dashboard system, supporting role-based access control (RBAC), secure authentication with session management, financial record tracking, and aggregated analytics.

Postman Documentation: https://documenter.getpostman.com/view/27530861/2sBXitCn95
Live Backend (Swagger): https://zorvyn-finance-backend-y2ab.onrender.com/api-docs
GitHub Repository: https://github.com/vikashkrdeveloper/zorvyn-finance-api.git

Features Implemented

  • User and Role Management: Secure registration, login, and profile management with RBAC support.
  • Financial Records CRUD: Complete management of income and expense records.
  • Record Filtering: Advanced filtering by Date Range, Category, and Record Type (Income/Expense).
  • Dashboard Summary APIs: Real-time aggregated data including total balance, category breakdown, and 6-month visual trends.
  • Role Based Access Control: Granular permissions for Viewer, Analyst, and Admin roles.
  • Input Validation and Error Handling: Centralized error management and robust schema validation using Zod.
  • Data Persistence: Reliable multi-document transactions and storage using MongoDB.

Key Technical Highlights

  • JWT Authentication: Secure authentication with Refresh Token Rotation and session invalidation.
  • Soft Deletes: Universal soft-delete pattern implemented for Users and Financial Records.
  • Security Headers: Implementation of Helmet for secure HTTP headers.
  • Rate Limiting: Dynamic configuration for request rate limiting.

Technology Stack

  • Runtime: Node.js (TypeScript)
  • Framework: Express.js
  • Database: MongoDB + Mongoose
  • Validation: Zod
  • Documentation: Swagger (OpenAPI 3.0)
  • Testing: Jest + Supertest

Getting Started

Prerequisites

  • Node.js v18+
  • MongoDB (Local or Atlas)

Installation

  1. Clone the repository and install dependencies:
    npm install
  2. Setup environment variables (Template provided in .env.example):
    cp .env.example .env

Database Seeding (Optional)

To quickly populate the database with mock users and transaction data for evaluation:

npm run seed

Running the Application

  • Development: npm run dev (with hot-reload)
  • Production: npm run build && npm start

API Documentation

The project includes an interactive documentation portal powered by Swagger.

Testing

Run the automated test suite to verify authentication and core logic:

npm test

Roles & Permissions

Role Permissions
Viewer Can only view dashboard data and summaries.
Analyst Can view all financial records and access dashboard insights.
Admin Full access: Manage users, create/update/delete financial records.

Project Structure

src/
├── config/       # Database and app configurations
├── controllers/  # Business logic and request handling
├── middlewares/  # Auth, Validation, and Error guards
├── models/       # Mongoose data schemas
├── routes/       # API route definitions
├── utils/        # Generic helpers (JWT, Swagger, Seed)
└── validation/   # Zod schema definitions

Releases

No releases published

Packages

 
 
 

Contributors