Skip to content

SHalimoosavi/SYJ-Calling-CRM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SYJ Calling CRM

A lightweight, mobile-first CRM for tracking leads and calls.

Built by SAYANJALI NEXUS PRIVATE LIMITED for internal sales and marketing teams across its business verticals — with a clear path toward AI-assisted follow-up automation.

License: MIT

Node.js

Next.js

TypeScript

Prisma

Runs identically on Android (Termux), Linux, and Windows.


Status

v0.1.0 — MVP Foundation. Authentication, database schema, and a working dashboard are live and functional. Lead management, call logging, click-to-call, and AI features are the focus of the next release — see Roadmap: v0.2.0 below.


What's included today

Area Status
JWT authentication (register / login / me), ADMIN / CALLER roles
First registered user auto-promoted to ADMIN
SQLite database via Prisma ORM (portable to PostgreSQL/MySQL later)
Data model: Users, Leads, Business Verticals, Call Logs, Activity timeline
Seed script: default admin + 10 business verticals
Mobile-first responsive dashboard (Next.js App Router + Tailwind CSS)
Dashboard summary API backed by real database counts
Security: Helmet, CORS, rate limiting, Zod input validation
Layered backend architecture (routes → controllers → services → repositories)
VoiceProvider / AIProvider interfaces reserved — no vendor lock-in
Blockchain module boundary reserved for future SYJ Token integration
Jest + Supertest test scaffold, passing health-check test
ESLint-configured on both apps
Verified on Android Termux (via Ubuntu/proot-distro), Linux, and Windows

Lead management, contact import, click-to-call, call outcome logging, and AI call summaries are not yet implemented — they're the subject of the v0.2.0 roadmap below.


Project structure

SYJ-Calling-CRM/
├── backend/                   # Node.js + Express + TypeScript + Prisma API
│   ├── prisma/
│   │   ├── schema.prisma      # Database schema (SQLite)
│   │   └── seed.ts            # Default admin + business verticals
│   └── src/
│       ├── config/            # env, Prisma client
│       ├── controllers/       # HTTP layer
│       ├── routes/            # Express routers
│       ├── middleware/        # auth, validation, error handling
│       ├── services/          # business logic
│       ├── repositories/      # data access layer
│       ├── providers/         # voice / AI / blockchain abstraction interfaces
│       ├── validators/        # Zod schemas
│       ├── types/             # shared TS types (Role, LeadStatus, CallOutcome)
│       ├── utils/             # ApiError, asyncHandler, JWT helpers
│       └── __tests__/         # Jest + Supertest
├── frontend/                  # Next.js 14 (App Router) + TypeScript + Tailwind
│   └── src/
│       ├── app/                # login, dashboard, providers, layout
│       ├── components/         # Button, Card, TextField
│       ├── hooks/               # useRequireAuth, useDashboardSummary
│       ├── lib/                 # Axios client, auth storage, Zod validators
│       └── config/               # env
├── docs/                        # Architecture, API, database, setup guides
├── setup.sh                     # Linux / Android Termux setup
├── setup.ps1                    # Windows PowerShell setup
├── setup.bat                    # Windows CMD setup
└── CHANGELOG.md

Requirements

  • Node.js LTS (18.x or 20.x recommended) — check with node -v
  • npm (bundled with Node.js)
  • Git
  • Internet access on first install (npm packages, plus Prisma's engine binaries, fetched automatically by db:generate / db:push)

On Android, install Termux from F-Droid (not the outdated Play Store build), then:

pkg update && pkg install nodejs-lts git -y

Termux note: Prisma's native engine binaries are built for glibc-based Linux and are not compatible with Android's Bionic libc. Run the backend from inside proot-distro (Ubuntu) rather than native Termux — see docs/TERMUX.md for the full setup. The frontend has no such dependency and runs fine in native Termux.


Quick start

1. Clone and run the setup script

Linux / Android Termux (inside proot-distro Ubuntu for the backend):

git clone <your-repo-url> SYJ-Calling-CRM
cd SYJ-Calling-CRM
./setup.sh

Windows PowerShell:

git clone <your-repo-url> SYJ-Calling-CRM
cd SYJ-Calling-CRM
.\setup.ps1

Windows CMD:

git clone <your-repo-url> SYJ-Calling-CRM
cd SYJ-Calling-CRM
setup.bat

The script installs both apps' dependencies, generates the Prisma client, creates the SQLite database, and seeds a default admin account.

2. Run the backend

cd backend
npm run dev

API: http://localhost:4000 · Health check: http://localhost:4000/api/health

3. Run the frontend (separate terminal)

cd frontend
npm run dev

App: http://localhost:3000

4. Sign in

Field Value
Email admin@sayanjalinexus.com
Password ChangeMe123!

⚠️ Change this password immediately. There is no "change password" UI yet in this release — update it via the API or database directly.


Common commands

Backend (/backend)

Command Purpose
npm run dev Start API with hot reload
npm run build Compile TypeScript to dist/
npm start Run the compiled build
npm run lint ESLint check
npm test Run the Jest test suite
npm run db:generate Regenerate the Prisma client
npm run db:push Sync schema to the SQLite database
npm run db:migrate Create a versioned migration
npm run db:seed Re-run the seed script
npm run db:reset Drop and recreate the database (destructive)

Frontend (/frontend)

Command Purpose
npm run dev Start the Next.js dev server
npm run build Production build
npm start Run the production build
npm run lint ESLint check

Environment variables

Copy .env.example.env (backend) and .env.example.env.local (frontend) — the setup scripts do this automatically. See each file for the full list. Real .env files are git-ignored and should never be committed.


Troubleshooting

db:generate / db:push fails to download the engine binary Prisma fetches a small native engine binary from binaries.prisma.sh on first run. If you're behind a restrictive firewall or proxy, allow that domain, or see Prisma's docs on PRISMA_ENGINES_MIRROR. This requires standard internet access and is unrelated to your Node/npm setup.

Android Termux: Could not parse schema engine response Prisma's binaries aren't compatible with Termux's Bionic libc. Run the backend from inside proot-distro Ubuntu instead — see docs/TERMUX.md.

Termux: npm install fails building a native module

pkg install build-essential python -y

then retry npm install.

Port already in use Change PORT in backend/.env, and NEXT_PUBLIC_API_BASE_URL in frontend/.env.local, to match.


Roadmap: v0.2.0

The next phase focuses on making this a genuinely usable CRM, not just a foundation. Planned scope:

Lead management

  • Add, edit, and delete leads
  • Search and filter across all lead fields
  • CSV / XLSX import — upload lead lists in bulk
  • Duplicate detection on import
  • Field-level validation on import and manual entry

Call logging

  • Outcome capture: Interested, Follow-up, Not Interested, Busy, Wrong Number
  • Free-text notes attached to each call
  • Full call history per lead

Business verticals

  • Assign every lead to a SAYANJALI NEXUS business vertical
  • Vertical-level filtering and reporting

Click-to-call

  • Twilio integration behind the existing VoiceProvider interface
  • Call history synced with lead timelines

AI features

  • Local, open-source AI only — no OpenAI or other closed-source cloud APIs
  • Providers: Ollama, DeepSeek, Qwen
  • Locally generated call summaries
  • Suggested follow-up messages based on call outcome and notes

See docs/ROADMAP.md for the complete phased plan, including later phases (AI agent automation, autonomous follow-up, SYJ Token integration).


Documentation

Doc Covers
docs/ARCHITECTURE.md System design and layering
docs/API.md REST API reference
docs/DATABASE.md Schema and Prisma commands
docs/SETUP.md Manual setup (no scripts)
docs/TERMUX.md Android / Termux + proot-distro notes
docs/LINUX.md Linux-specific notes
docs/WINDOWS.md Windows-specific notes
docs/ROADMAP.md Full phased delivery plan
docs/SECURITY.md Security posture and responsibilities
docs/CONTRIBUTING.md Contribution guidelines

License

MIT — see LICENSE.

Contributing

Maintained under SAYANJALI NEXUS PRIVATE LIMITED. See docs/CONTRIBUTING.md for guidelines before opening a pull request.

About

Lightweight, open-source CRM for tracking leads and calls. Node.js, Express, Next.js, TypeScript, Prisma/SQLite. Built by SAYANJALI NEXUS PRIVATE LIMITED.

Topics

Resources

License

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors