Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
44bbed9
feat: Implement core backend models and routes for deals, meetings, n…
m-zeeshan-saeed Jan 26, 2026
52ca2e8
chore: Add *.env to .gitignore to prevent sensitive environment varia…
m-zeeshan-saeed Jan 26, 2026
b254bb0
chore: add .env and .env.local to .gitignore.
m-zeeshan-saeed Jan 26, 2026
f9b0d2b
feat: add README.md and .env.example for project setup and configurat…
m-zeeshan-saeed Jan 26, 2026
37c9dd6
feat: Add initial README.md with project setup instructions and refin…
m-zeeshan-saeed Jan 26, 2026
a97c111
refactor: include detailed error message in the registration failure …
m-zeeshan-saeed Jan 26, 2026
f5b4377
feat: Implement payment and wallet management with real-time communic…
m-zeeshan-saeed Feb 14, 2026
3dcede8
all done and deploy stage
m-zeeshan-saeed Feb 14, 2026
9722a6f
feat: conditionally auto-scroll chat messages based on user's current…
m-zeeshan-saeed Feb 14, 2026
3ba6d3d
feat: Configure Socket.IO and CORS to use `CLIENT_URL` for origin and…
m-zeeshan-saeed Feb 14, 2026
76358ed
feat: Configure Axios to use `withCredentials` and adjust the base AP…
m-zeeshan-saeed Feb 14, 2026
690c799
feat: implement new chat modal with user search functionality and emo…
m-zeeshan-saeed Feb 15, 2026
14d7c35
Create SECURITY.md for security policy
m-zeeshan-saeed Feb 15, 2026
8709595
Clean up env.development by removing sensitive data
m-zeeshan-saeed Feb 15, 2026
c2a6f91
feat: Remove development environment file and enhance chat conversati…
m-zeeshan-saeed Feb 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env*
.env
.env.local
.env.example
97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Business Nexus

A comprehensive web platform for business connections, connecting startups, investors, and professionals.

## Tech Stack

**Frontend:**

- React
- TypeScript
- Vite
- Tailwind CSS
- Lucide React (Icons)

**Backend:**

- Node.js
- Express
- MongoDB (Mongoose)
- TypeScript

## Prerequisites

Before running this project, ensure you have the following installed:

- [Node.js](https://nodejs.org/) (v16+ recommended)
- [MongoDB](https://www.mongodb.com/) (running locally or a cloud instance like MongoDB Atlas)

## Installation

1. **Clone the repository:**

```bash
git clone <repository-url>
cd Nexus
```

2. **Install dependencies:**
```bash
npm install
```

## Configuration

1. **Backend Environment Variables:**
Create a `.env` file in the root directory based on `.env.example`:

```bash
cp .env.example .env
```

Update the `.env` file with your specific configuration, particularly the `MONGODB_URL` if you are not using a local default instance.

```env
PORT=3001
MONGODB_URL=mongodb://localhost:27017/business-nexus
```

## Running the Project

You will need to run the backend and frontend in separate terminal windows.

### 1. Start the Backend Server

The backend requires a running MongoDB instance. Make sure MongoDB is started.

In the first terminal window, run:

```bash
npx tsx watch backend/server.ts
```

The server should start on port `3001` and connect to MongoDB.

### 2. Start the Frontend Application

In a second terminal window, run:

```bash
npm run dev
```

The frontend will start (usually on `http://localhost:5173`) and will automatically connect to the backend at `http://localhost:3001`.

## Building for Production

To build the frontend for production:

```bash
npm run build
```

## Project Structure

- `src/` - Frontend source code (React components, pages, services)
- `backend/` - Backend source code (Express server, Mongoose models, routes)
- `public/` - Static assets
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
55 changes: 55 additions & 0 deletions backend/config/swaggerConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import swaggerJsdoc from "swagger-jsdoc";

const options: swaggerJsdoc.Options = {
definition: {
openapi: "3.0.0",
info: {
title: "Business Nexus API",
version: "1.0.0",
description: "API documentation for the Business Nexus platform",
contact: {
name: "Support",
url: "http://localhost:5173/help",
},
},
servers: [
{
url: "http://localhost:3001/api",
description: "Development Server",
},
],
components: {
securitySchemes: {
bearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
},
Transaction: {
type: "object",
properties: {
id: { type: "string" },
userId: { type: "string" },
type: { type: "string", enum: ["deposit", "withdraw", "transfer"] },
amount: { type: "number" },
status: {
type: "string",
enum: ["pending", "completed", "failed"],
},
description: { type: "string" },
recipientId: { type: "string" },
createdAt: { type: "string", format: "date-time" },
},
},
},
},
security: [
{
bearerAuth: [],
},
],
},
apis: ["./backend/routes/*.ts"], // Path to the API docs (it scans JSDoc comments)
};

export const specs = swaggerJsdoc(options);
64 changes: 64 additions & 0 deletions backend/database.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import mongoose from "mongoose";
import dotenv from "dotenv";
import bcrypt from "bcryptjs";
import { entrepreneurs, investors } from "../src/data/users";
import { messages } from "../src/data/messages";
import { collaborationRequests } from "../src/data/collaborationRequests";

import User from "./models/User.model";
import Message from "./models/Message.model";
import CollaborationRequest from "./models/CollaborationRequest.model";

dotenv.config();

const MONGO_URL = process.env.MONGODB_URL;

if (!MONGO_URL) {
console.error("MONGODB_URL not found in .env");
process.exit(1);
}

async function database() {
try {
await mongoose.connect(MONGO_URL as string);
console.log("Connected to MongoDB for database...");

// Clear existing data
await User.deleteMany({});
await Message.deleteMany({});
await CollaborationRequest.deleteMany({});
console.log("Cleared existing collections.");

// Hash a default password for all mock users
const defaultPassword = await bcrypt.hash("password123", 10);

// Seed Users
const allUsers = [...entrepreneurs, ...investors].map((user) => ({
...user,
password: defaultPassword,
}));

await User.insertMany(allUsers);
console.log(
`Successfully added ${allUsers.length} users with hashed passwords.`,
);

// Seed Messages
await Message.insertMany(messages);
console.log(`Successfully added ${messages.length} messages.`);

// Seed Collaboration Requests
await CollaborationRequest.insertMany(collaborationRequests);
console.log(
`Successfully added ${collaborationRequests.length} collaboration requests.`,
);

console.log("Database added successfully!");
process.exit(0);
} catch (error) {
console.error("Error adding to database:", error);
process.exit(1);
}
}

database();
41 changes: 41 additions & 0 deletions backend/middlewares/auth.middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Request, Response, NextFunction } from "express";
import jwt from "jsonwebtoken";

const JWT_SECRET = process.env.JWT_SECRET || "your_fallback_secret";

export interface AuthRequest extends Request {
user?: {
userId: string;
role: string;
};
}

export const authenticateToken = (
req: AuthRequest,
res: Response,
next: NextFunction,
) => {
const authHeader = req.headers["authorization"];
const token = authHeader && authHeader.split(" ")[1];

if (!token) {
return res.status(401).json({ message: "No token provided" });
}

jwt.verify(token, JWT_SECRET, (err, decoded) => {
if (err) {
return res.status(403).json({ message: "Invalid or expired token" });
}
req.user = decoded as { userId: string; role: string };
next();
});
};

export const checkRole = (roles: string[]) => {
return (req: AuthRequest, res: Response, next: NextFunction) => {
if (!req.user || !roles.includes(req.user.role)) {
return res.status(403).json({ message: "Access denied" });
}
next();
};
};
Loading