AI-powered FinTech CRM for Startups, Investors & Deal Flow Automation
Built with Node.js + Express + MongoDB. Modular structure for scalability. Phase 1 complete—ready for auth, CRM, and integrations.
-
✅ Task 1: Node.js + Express project initialized (
npm start/npm run dev). -
✅ Task 2: /src structure: controllers, models, routes, middleware, config, utils.
-
✅ Task 3: .env setup (PORT, MONGO_URI, JWT_SECRET). Copy
.env.example& fill MONGO_URI. -
✅ Task 4: MongoDB connected via Mongoose (
src/config/db.js). Verified locally (Compass/shell). -
Health route:
GET /api/health→{"status": "running"}. -
✅ Task 5: Base health route (
GET /api/health) created returning{ status: "running" }. -
✅ Task 6: Middleware integrated: Helmet (security), Morgan (logging), CORS (frontend access), and
express.json()(body parsing). -
✅ Task 7: GitHub CI pipeline created (
.github/workflows/nodejs-ci.yml) to automate lint/test/build.Phase 2: Auth (User model, JWT register/login).
Live at: http://localhost:3000
Tested & working with Thunder Client / Postman
| Phase | Feature | Status | Notes |
|---|---|---|---|
| 1 | Setup + DB Connections | Completed | PostgreSQL (Prisma) + MongoDB |
| 2 | Authentication & JWT | Completed | Register / Login / Protected routes |
| 3 | Core CRM (Org, Lead, Deal) | Completed | Full CRUD + filtering + pagination |
| 4 | Email & Domain Search APIs | Completed | Endpoints + models ready |
| 5 | Blockchain Integration | Pending | Next in line |
| 6 | AI Recommendations | Pending | |
| 7 | Security + Swagger + Tests | Pending |
This phase adds the full CRM system including Organizations, Leads, and Deals.
✅ Task 1: Organization Module
- Organization model created (
name,type,website,region,contact). - CRUD routes added at /api/organizations.
- Filtering by
typeandregionimplemented. - Pagination supported using
?page=&limit=.
✅ Task 2: User–Organization Relationship
- Users linked to organizations via PostgreSQL foreign key (organizationId).
- Relationship enforced in Prisma schema.
- User endpoints updated to include organization details.
✅ Task 3: Leads Module
- Lead model created (
name,email,domain,status,addedBy). - CRUD routes added at /api/leads.
- Filtering supported by:
statusaddedByIddomain
- Pagination integrated for lead listings.
✅ Task 4: Deals Module
- Complex many-to-many deal structure implemented:
- Multiple startups per deal
- Multiple investors per deal
- Enum fields added:
- Stage →
NEW,NEGOTIATING,DUE_DILIGENCE,CLOSED - Status →
ACTIVE,LOST,WON
- Stage →
- Full CRUD routes at /api/deals
- Filtering by:
- Stage
- Startup IDs
- Investor IDs
- Pagination supported.
✅ Task 5: Database Integration
- Prisma schema fully updated with:
- Organizations
- Users
- Leads
- Deals
- Join tables:
DealStartup,DealInvestor
- Migrations generated & applied to PostgreSQL.
- All foreign key constraints validated.
- Express server with two endpoints:
POST /api/blockchain/store— send data to smart contract and store tx metadata in SQLite.GET /api/blockchain/fetch/:id— try to fetch on-chain record via contract call, falls back to DB record.
- Ethers.js integration (use Sepolia / Polygon testnet via PROVIDER_URL).
- SQLite DB (
data/blockchain.db) storing txHash, blockNumber, timestamp, id, data. - Retry logic for sending transactions.
- Install Node >= 18
- Copy
.env.exampleto.envand fill values:PROVIDER_URL(Sepolia or Polygon testnet RPC)PRIVATE_KEY(testnet account with funds)CONTRACT_ADDRESS(deployed contract address)
- If you have a custom contract ABI, replace
contract_abi.jsonor updateABI_FILEin.env. - Install dependencies:
npm install - Start server:
npm start - Endpoints:
- Store:
POST http://localhost:4000/api/blockchain/storewith JSON body:{ "id": "deal-123", "data": "some verified search data" } - Fetch:
GET http://localhost:4000/api/blockchain/fetch/deal-123
- Store:
The server expects the contract to implement these functions; you can adapt the ABI:
function store(string calldata id, string calldata data) external returns (bool);
function fetch(string calldata id) external view returns (string memory data, uint256 timestamp);If your contract uses different method names/signatures, update contract_abi.json.
- This project does not deploy a contract. It interacts with an existing deployed contract (supply address + ABI).
- For testing without a real contract, you can use a "mock" ABI included here; the server will still submit transactions but they may revert if ABI/methods don't match the deployed contract.
- The SQLite DB is created at
data/blockchain.db.
This phase integrates a standalone FastAPI-based AI microservice with the Fintrix Node backend.
The Node.js backend communicates with the AI microservice via HTTP to generate lead scoring and recommendations.
Fintrix Backend (Node.js) ---> FastAPI AI Microservice port 3000 port 8000
fintrix-backend/ ├── src/ ├── ai-service/ │ ├── main.py │ ├── requirements.txt │ └── venv/
cd ai-service python3 -m venv venv # only once source venv/bin/activate pip install fastapi uvicorn pydantic
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
Add this to .env (root of fintrix-backend):
AI_URL=http://127.0.0.1:8000/recommend
Node automatically forwards POST requests from:
POST /api/ai/recommend
to the AI microservice.
Start both servers:
Python AI Service
cd ai-service source venv/bin/activate uvicorn main:app --port 8000 --reload
Node Backend
npm run dev
Send a test request:
POST http://localhost:3000/api/ai/recommend
Body:
{ "org_id": 1, "leads": [ { "lead_id": 101, "name": "Lead A" }, { "lead_id": 202, "name": "Lead B" } ] }
Sample successful response:
{ "success": true, "data": { "lead_scores": [ { "lead_id": 101, "score": 0.01 }, { "lead_id": 202, "score": 0.02 } ] } }
FastAPI exposes:
GET /health → { "status": "ai-service-running" }
Node logs on startup:
🟢 AI Microservice Connected
- AI microservice integrated under
/api/ai - Health check working
- End‑to‑end recommendations functional
Phase 6 AI Deal Recommender 🔜
Phase 7 Blockchain-secured Deals 🔜
- Clone:
git clone https://github.com/shakthishankar/fintrix-backend.git - Install:
cd fintrix-backend && npm install - Setup .env: Copy
.env.exampleto.env, updateMONGO_URI(local:mongodb://localhost:27017/fintrix-db). - Start MongoDB (local install/service).
- Run:
npm run dev - Test:
curl http://localhost:3000/api/healthor browser.
- Backend: Node.js, Express
- DB: MongoDB + Mongoose
- Env: dotenv
- Dev: nodemon