✨ Finarva AI Backend is a robust and scalable platform built with NestJS, PostgreSQL, and Prisma, designed to empower microentrepreneurs with intelligent financial and operational tools.
- 🤖 AI Merchant Assistant: Utilizes LLMs, RAG, and Pinecone DB to offer dynamic, context-aware guidance that streamlines business operations, boosts topline growth, and helps merchants adhere to marketplace best practices.
- 💡 AI-Powered Financial Advisory: Delivers personalized investment and insurance advice, driven by OpenAI GPT-4 and Gemini Pro models.
- 📊 Expense Tracking & Management: Helps microentrepreneurs manage their business finances effectively.
- 🌊 Cash Flow Analysis & Forecasting: Provides insights into cash flow and predicts future financial health.
- 💰 Micro-loan & Credit Facilitation: Connects entrepreneurs with potential funding opportunities.
- 📦 Supply Chain Management: Helps businesses track their inventory and manage their supply chain.
- 📈 Business Analytics & Reporting: Offers a consolidated view of business performance.
- 🧠 Personalized, Multilingual Quizzes: Engages users with tailored quizzes in their native language.
- 👤 Client Management: Manages detailed client profiles and preferences.
- 📚 Smart Learning Recommendations: Recommends relevant content based on user behavior.
- 🌍 Multi-language Support: Serves localized content to clients in their native languages.
- 🧩 Modular & Scalable: Built using a clean, service-repository pattern.
- 🧪 Swagger API Docs: Auto-generated, interactive API documentation.
- Background Job Processing: Integrated BullMQ to manage long-running tasks asynchronously, ensuring the main application remains fast and responsive.
- Optimized Database Queries: Enhanced query performance through indexing strategies and optimized data access patterns, reducing response times.
- Database Scalability: Implemented a read-replica database strategy to distribute load and improve data availability for read-heavy operations.
- High Availability: Leveraged Node.js Clustering to run multiple application instances in parallel, improving CPU utilization and overall throughput.
Layer | Technology |
---|---|
Backend | NestJS |
Database | PostgreSQL + Prisma |
AI Models | OpenAI GPT-4 / Gemini Pro |
Vector DB | Pinecone |
Documentation | Swagger + class-validator |
Deployment | Ready for Docker / CI-CD Pipelines |
📦 src
├── ai/ # AI Integration layer (Gemini/OpenAI)
├── analytics/ # Business analytics and reporting
├── app.controller.ts # Main app controller
├── app.module.ts # Main app module
├── app.service.ts # Main app service
├── auth/ # Authentication and authorization
├── cash-flow/ # Cash flow analysis and forecasting
├── clients/ # Client module (profile, preferences)
├── common/ # Shared DTOs and utilities
├── expenses/ # Expense tracking and management
├── insurance/ # Insurance suggestion logic
├── inventory/ # Inventory and supply chain management
├── investment/ # Investments & recommendations
├── invoicing/ # Invoice creation, Stripe integration
├── learning/ # Content learning logic
├── loans/ # Micro-loan and credit facilitation
├── main.ts # App entry point
├── merchant-assistant/ # AI-powered merchant assistant
├── prisma/ # Prisma service integration
├── quiz/ # Quiz suggestion, history & records
├── reporting/ # Business analytics and reporting
├── tax/ # Tax calculation and reporting
├── types/ # Shared types
├── vector-store/ # Pinecone vector store integration
📦 prisma/ └── schema.prisma # Prisma schema definition
📦 test/ ├── app.e2e-spec.ts # End-to-end tests ├── jest-e2e.json # Jest config for e2e └── mocks/ # Mock services for testing
Other root files: ├── .env # Environment variables ├── Dockerfile # Docker setup ├── package.json # Project dependencies ├── README.md # Project documentation └── ... # Configs, scripts, etc.
- Node.js v18+
- PostgreSQL (Local or Docker)
- Prisma CLI
- OpenAI / Gemini API Key
- Pinecone API Key
git clone https://github.com/your-username/finarva-ai-backend
cd finarva-ai-backend
npm install
Create a .env
file in the root with the following content:
DATABASE_URL="postgresql://user:password@localhost:5432/finarva"
OPENAI_API_KEY=sk-xxx
GEMINI_API_KEY=your-gemini-key
PINECONE_API_KEY=your-pinecone-key
npx prisma generate
npx prisma db push
npm run start:dev
Access the interactive Swagger documentation at:
http://localhost:3000/api
Explore all endpoints, test requests, and view schemas.
npm run lint # Run linter
npm run test # Run unit tests
This project is licensed under the MIT License.
We welcome contributions! Please follow the standard GitHub flow: fork, branch, commit, and pull request.
🚀 Empowering the next generation of microentrepreneurs through intelligence.