Skip to content

Latest commit

 

History

History
199 lines (156 loc) · 4.49 KB

File metadata and controls

199 lines (156 loc) · 4.49 KB

SecureNet Setup Guide

Prerequisites

Before setting up the SecureNet Monitoring Platform, ensure you have:

Step-by-Step Setup

1. Extract and Open Project

  1. Extract the downloaded ZIP file
  2. Open the extracted folder in VS Code
  3. Open the integrated terminal in VS Code (Ctrl+`` or View > Terminal`)

2. Install Dependencies

Install frontend dependencies:

npm install

Install backend dependencies:

cd server
npm install
cd ..

3. Database Setup

Option A: Local MongoDB

  1. Install MongoDB Community Edition
  2. Start MongoDB service:
    • Windows: MongoDB should start automatically
    • macOS: brew services start mongodb/brew/mongodb-community
    • Linux: sudo systemctl start mongod

Option B: MongoDB Atlas (Cloud)

  1. Create account at MongoDB Atlas
  2. Create a new cluster
  3. Get connection string from "Connect" button
  4. Replace MONGODB_URI in .env file

4. Environment Configuration

  1. Copy .env.example to .env:
cp .env.example .env
  1. Edit .env file with your settings:
MONGODB_URI=mongodb://localhost:27017/securenet
JWT_SECRET=your-super-secret-jwt-key-change-this
JWT_EXPIRE=24h
PORT=3001
NODE_ENV=development
FRONTEND_URL=http://localhost:5173

Important: Change the JWT_SECRET to a secure random string!

5. Start the Application

Terminal 1 - Backend Server

cd server
npm start

You should see:

MongoDB connected
SecureNet server running on port 3001
Default admin user created:
Email: [email protected]
Password: admin123

Terminal 2 - Frontend Development Server

npm run dev

You should see:

Local:   http://localhost:5173/
Network: use --host to expose

6. Access the Application

  1. Open your browser and go to: http://localhost:5173
  2. Login with default credentials:

Troubleshooting

Common Issues

MongoDB Connection Error

Error: connect ECONNREFUSED 127.0.0.1:27017

Solution: Make sure MongoDB is running

  • Check if MongoDB service is started
  • Verify connection string in .env

Port Already in Use

Error: listen EADDRINUSE: address already in use :::3001

Solution:

  • Kill process using the port: lsof -ti:3001 | xargs kill -9
  • Or change PORT in .env file

Module Not Found

Error: Cannot find module 'express'

Solution: Install dependencies

cd server
npm install

CORS Error

Access to fetch blocked by CORS policy

Solution: Check that backend is running on port 3001

Development Tips

VS Code Extensions (Recommended)

  • ES7+ React/Redux/React-Native snippets
  • Tailwind CSS IntelliSense
  • MongoDB for VS Code
  • Thunder Client (API testing)

Useful Commands

# Check if ports are in use
netstat -an | grep :3001
netstat -an | grep :5173

# View MongoDB logs (if local)
tail -f /usr/local/var/log/mongodb/mongo.log

# Reset database (development only)
mongo securenet --eval "db.dropDatabase()"

Next Steps

  1. Explore the Dashboard: Navigate through different sections
  2. Create Users: Register new users with different roles
  3. Monitor Traffic: Watch real-time traffic simulation
  4. Test Responses: Try automated response features (Admin only)
  5. Customize: Modify components and add new features

Production Deployment

Frontend (Netlify/Vercel)

npm run build
# Upload dist/ folder to hosting service

Backend (Railway/Heroku)

  1. Create account on hosting platform
  2. Connect GitHub repository
  3. Set environment variables
  4. Deploy from server/ directory

Database (MongoDB Atlas)

  1. Create production cluster
  2. Update connection string
  3. Set up database users and security

Support

If you encounter issues:

  1. Check the console for error messages
  2. Verify all services are running
  3. Check network connectivity
  4. Review the logs in terminal

For development questions, refer to: