Skip to content
B2B SaaS · CRMLive in production

NayaPrayog CRM & Client Portal

A CRM for agencies and service companies covering leads, projects, tickets, time tracking and invoices, plus a portal where clients follow their project, approve work and pay.

Role
Sole engineer: architecture, API, web app, billing, security and deployment.
Platforms
Web · Admin
Stack
  • React
  • Node.js
  • Express 5
  • PostgreSQL
  • JWT
  • bcrypt
  • Multer
  • Nodemailer
  • Razorpay
NayaPrayog CRM team dashboard
01

Overview

NayaPrayog CRM brings the sales side (leads), the delivery side (projects, milestones, tickets, time logs, stand-ups) and the money side (invoices, part-payments, overdue alerts) into one web app, with a client portal on top. It is sold as SaaS: every subscribing company gets its own private workspace.

02

Product context

Naya Prayog runs its own client projects in the platform workspace and manages all subscriber workspaces from there.

03

Problem

Agencies usually juggle a spreadsheet for leads, a task tool for delivery, an invoicing tool for money and email threads with clients. Nobody sees the whole picture, and clients have no single place to follow progress or approve work.

04

Objectives

  • One workspace for leads, delivery, money and client communication
  • Strict separation between subscriber companies and between clients
  • Role-aware access, so not everyone sees project money
  • Self-serve SaaS: free trial, plans, online subscription billing
05

My role

Sole engineer: architecture, API, web app, billing, security and deployment.

06

Engineering approach

Server-enforced permissions drive everything. Each user has exactly one workspace role plus per-project roles, and the API decides field by field what a person may see. For example, project value and invoices are visible only to admins, the project's manager, its Product Owner or Project Manager, and that project's client.

07

Technical architecture

01Clients
  • React web app (code-split)
  • Team workspace
  • Client portal
02API
  • Node.js / Express 5
  • Cookie session + CSRF header
  • Workspace-pinned queries
03Data
  • PostgreSQL
  • Auto-applied migrations
  • Append-only audit & billing history
04Services
  • Razorpay subscriptions & invoice payments
  • Private file storage
  • SMTP notifications
05Infra
  • Linux VPS
  • Apache /crm proxy + HSTS
  • PM2, graceful restarts
  • Health check
08

Frontend

React app with a team workspace (dashboard, leads pipeline, projects, tickets, time logs, timesheets, invoices) and a separate client portal view. It refreshes automatically after a new version is deployed.

09

Backend

Express 5 API. Every query is pinned to the signed-in user's workspace, and a project you may not open returns the same 'not found' as one that doesn't exist, so ids can't be probed. A background job checks for overdue invoices every six hours.

10

Database design

PostgreSQL with migrations applied automatically and safely when the API starts. Approvals, the activity log and billing history are append-only.

11

Integrations

  • Razorpay for monthly/yearly subscriptions and online invoice payments, with renewals and failed-payment handling
  • SMTP email for invitations, password resets and notifications
  • Private file storage with allow-listed types and permission-checked downloads
12

Infrastructure & deployment

Served under /crm on the same VPS as the other apps, with Apache proxying the API, PM2 managing the process, a database-aware health endpoint, and graceful restarts that let in-flight requests finish.

13

Challenges & solutions

  1. Multi-tenant data isolation

    Challenge

    Subscriber companies and their clients must never see each other's data.

    Solution

    Every query is pinned to the caller's workspace, client users are limited to their own company and client-visible items, and forbidden resources look identical to missing ones.

  2. Who may see the money

    Challenge

    Budgets and invoices are sensitive even inside one company.

    Solution

    Field-level rules on the server: everyone outside the allowed roles sees '—' instead of values.

  3. Session security

    Challenge

    Cookie sessions are convenient but open to CSRF.

    Solution

    httpOnly, Secure, SameSite=Strict cookies plus a required custom header on every change request; role changes and deactivation sign the user out immediately.

  4. Subscription lifecycle

    Challenge

    Trials end, cards fail, and people cancel mid-period.

    Solution

    A 3-day grace period for failed payments, cancel at period end, and a read-only mode that keeps data visible when a subscription lapses.

14

Features

  • Leads pipeline with conversion to clients
  • Projects, milestones, tickets and project roles
  • Time logs, stand-ups, timesheets and team reports
  • Invoices, part-payments, overdue alerts, online payment
  • Client portal: progress, approvals, files, invoices, messages
  • Plans, free trial, subscription billing, platform admin
  • Audit log of every important action
15

Testing

Automated end-to-end API test suite covering permissions, workspace isolation, billing, invoices, approvals, tickets and daily work.

17

Lessons learned

  • Make 'forbidden' and 'not found' indistinguishable to outsiders.
  • Decide visibility per field, not per page, when roles overlap.
  • Design the unhappy billing paths (failed, lapsed, cancelled) as carefully as checkout.