Skip to content

Frotam/Beep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Atlas CRM – Company & Employee Query Management (MERN + Realtime)

NOTE: This is only the frontend part of the project. No backend logic (API calls or transcription) is implemented. Demo Link - https://youtu.be/7Nl7r5ozyEU

A full‑stack app where companies register, manage employees, and track customer queries with real‑time updates. Employees resolve incoming queries; companies get a rich dashboard for insights.

Highlights

  • Companies & Employees: Register/login, add employees with auto credentials
  • Queries: Create queries, view transcripts, listen to recordings, close/resolve
  • Company‑scoped data: Each company only sees its own queries
  • Realtime: Live updates via Socket.io (new/closed queries)
  • Secure: JWT auth, role‑based routes, hashed passwords

Project Structure

backend/
  server.js
  routes/
    company.js
    queries.js
  models/
    Company.js
    Query.js (Summary)
frontend/
  src/
    pages/ (CompanyDashboard, EmployeeDashboard, Login/Register, etc.)
    services/api.js

Prerequisites

  • Node.js 16+
  • npm
  • Local MongoDB running at mongodb://127.0.0.1:27017/mydb

Setup & Run

  1. Install deps
cd backend && npm install
cd ../frontend && npm install
  1. Start backend (http://localhost:5000)
cd backend
npm start
  1. Start frontend (http://localhost:3000)
cd frontend
npm run dev

Backend CORS and Socket.io are already configured for the frontend at http://localhost:3000.

Environment (optional)

Create backend/.env to customize:

PORT=5000
MONGO_URI=mongodb://127.0.0.1:27017/mydb
JWT_SECRET=change_me
JWT_EXPIRES=365d

User Flow

  1. Register a company → receive a unique 4‑digit registration number
  2. Login as that company → go to the company dashboard
  3. Add employees (auto email/password) and share credentials
  4. Employees login with the company registration number → work the open queries

Sample data behavior

  • Current default: On company register, one sample query is seeded to your local MongoDB for that company.
  • You can also manually seed later via API POST /api/queries/sample (see below) if you remove auto‑seeding.

To disable automatic seeding: remove the seeding block in backend/routes/company.js under the register route and rely solely on POST /api/queries/sample.

API Reference

Base URL: http://localhost:5000/api

Auth/session helpers (frontend)

  • Token is stored in localStorage.token
  • Actor details in localStorage.actor

Company

  • POST /company/register – create a company
  • POST /company/login – returns { token, company }
  • GET /company/me – current company profile (auth: company)
  • POST /company/:companyId/employees – add employee (auth: company, same company)
  • POST /company/employee/login – employee login via registration number
  • GET /company/employee/me – current employee profile (auth: employee)

Queries

  • GET /queries/all – list all queries for the authenticated company (auth: company)
  • GET /queries/unsolved – list unsolved queries for employee’s company (auth: employee)
  • POST /queries – create a query (auth: company)
  • PATCH /queries/:queryId/close – close a query (auth: employee)
  • GET /queries/:queryId – fetch query details (auth)
  • POST /queries/sample – seed sample queries for the authenticated company (auth: company)

Headers for auth routes:

Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json

Example: seed sample queries (manual)

Default sample (one item):

curl -X POST http://localhost:5000/api/queries/sample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{}'

Custom samples:

curl -X POST http://localhost:5000/api/queries/sample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "samples": [
      {
        "Url_call": "https://example.com/rec1.wav",
        "Call_data": "User asked about delivery.",
        "Transcript": "User: Do you deliver?\nAgent: Yes...",
        "Call_Summary": "Delivery inquiry",
        "Complaint_Summary": ""
      }
    ]
  }'

Data Model (simplified)

Company

name, email, registrationNumber, password, employees[{ name, email, password, phoneNumber }]

Summary (Query)

companyId, Solved, Url_call, Call_data, Transcript, Call_Summary,
Complaint_Summary?, closedBy { employeeId, employeeName, closedAt }

Realtime

Socket.io broadcasts:

  • newQuery when a query is created
  • queryClosed when a query is closed

Front‑end listens and reloads lists accordingly.

Quick Test Checklist

  • Company register/login works
  • Dashboard shows seeded sample (if auto‑seeding on)
  • POST /queries/sample adds records for current company
  • Add employee → employee can login and view unsolved queries
  • Employee can close a query → dashboard updates in realtime

🛠 Troubleshooting

  • 401/403: Check your Authorization: Bearer <token> header
  • CORS: Frontend must run on http://localhost:3000
  • Mongo: Ensure local Mongo is running on mongodb://127.0.0.1:27017/mydb
  • Socket: Verify both servers are running and open DevTools console

📄 License

This project is provided as‑is for hackathon/learning use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published