StreamNet is a secure, real-time chat application designed for local network communications with integrated AI capabilities. Built with modern web technologies and a focus on security, StreamNet delivers a seamless, encrypted messaging experience tailored for your local network. Enjoy features like instant messaging, AI-powered conversations through ChatLLama, robust security protocols, and an intuitive design.
- Real-time messaging powered by encrypted WebSockets.
- Message threading and reply functionality.
- Typing indicators and presence detection.
- Rate limiting: 5 messages per 10 seconds.
- Support for messages up to 5000 characters.
- Local AI Integration: Chat with Ollama models running on your local network.
- Real-Time Streaming: Experience character-by-character AI responses powered by Socket.io.
- Model Selection: Choose from various Ollama models for different conversation needs.
- Advanced Formatting: Full markdown support with code syntax highlighting.
- Streaming Controls: Pause or stop AI responses at any time.
- Conversation Management: Auto-generated titles and searchable history.
- Theme Customization: Light, Dark, and System theme options.
- End-to-end SSL/TLS encryption.
- Message signing with HMAC-SHA256.
- Comprehensive input sanitization against XSS attacks.
- Configurable CORS protection.
- Built-in rate limiting and spam prevention.
- Secure user authentication.
- Modern, responsive design built with Tailwind CSS.
- Dark mode support for comfortable viewing.
- Animated transitions and interactive UI elements.
- Customizable user avatars.
- Real-time online/offline status indicators.
- Mobile-friendly layout.
- Node.js v14 or higher
- MongoDB
- SSL certificate and key
- npm or yarn
- Gmail account for OTP email integration
- Ollama installed locally (for ChatLLama functionality)
- Download Node.js v14+ from nodejs.org
- Run the installer and follow the prompts
- Install MongoDB Community Server:
- Download from mongodb.com
- Run installer with "Complete" setup
- Install MongoDB Compass when prompted
-
Install OpenSSL for Windows:
- Download from slproweb.com/products/Win32OpenSSL.html
- Choose Win64 OpenSSL v1.1.1 or later
-
Generate SSL certificate (run in project root):
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./ssl/private.key -out ./ssl/certificate.crt
Tip
For Windows users: Run all commands in PowerShell or Command Prompt as Administrator
-
Clone the repository:
git clone https://github.com/GitCoder052023/StreamNet.git cd StreamNet
-
Install dependencies:
npm install
-
Configure the environment:
cp .env.example .env
-
Database Setup:
-
Install and start MongoDB
-
Open MongoDB Compass or your shell
-
Create a new connection using:
mongodb://localhost:27017
-
Create the following databases and collections:
StreamNet Database:
Database: StreamNet Collections: - Users - Messages - otps - Conversations
ChatLLama Database:
Database: ChatLLama Collections: - users - conversations
-
Note
Both databases must be created before starting the application. The collections will be automatically created if they don't exist.
-
Gmail App Password Setup:
- Sign in to your Google Account.
- Navigate to Security → 2-Step Verification.
- Under "App passwords," select "Other" and enter a label (e.g., "StreamNet").
- Copy the generated 16-character password.
-
Ollama Setup (for ChatLLama):
- Install Ollama from ollama.ai.
- Pull your preferred models:
ollama pull llama2 ollama pull llama2-uncensored ollama pull mistral
- Ensure Ollama is running before starting StreamNet.
Update your .env
file with your settings:
PORT=3000
SPORT=4000
HOST="System will configure it automatically"
NODE_ENV=development
JWT_SECRET="your_secure_jwt_secret"
ALLOWED_ORIGINS="System will configure it automatically"
SSL_KEY="path to your ssl key"
SSL_CERT="path to your ssl cert"
SECRET_KEY="your_secure_secret_key"
TOKEN_EXPIRY="24h"
SALT_ROUNDS=10
EMAIL_USER="your_email_address"
EMAIL_PASSWORD="your_app_password"
MONGODB_URI=mongodb://localhost:27017/StreamNet
FRONTEND_ORIGIN="System will configure it automatically"
OLLAMA_API_URL="http://localhost:11434"
ChatLLama_MONGODB_URI="mongodb://localhost:27017/ChatLLama"
npm run dev
After running the development server, you'll see output similar to this:
[ChatLLama:start] ChatLLama app running on port http://192.168.1.5:3001
[start] Connected to MongoDB
[start] Engine is running on port 3000
[server] Connected to MongoDB
[server] Server is running on https://192.168.1.5:4000
[server] [NETWORK INTERFACE] - StreamNet is running on https://192.168.1.5:3000
[server] [LOCAL INTERFACE] - StreamNet is running on https://localhost:3000
[ChatLLama:server] ChatLLama Server running on port http://192.168.1.5:5000
[ChatLLama:server] MongoDB connected
- Open your browser and navigate to the Network Interface URL shown in the console (e.g.,
https://192.168.1.5:3000
).
Important
You may see a security warning like "Your connection is not private" or "This connection is not secure". This is normal when using self-signed SSL certificates in development.
- To proceed:
- On Chrome: Click "Advanced" and then "Proceed to site"
- On Firefox: Click "Advanced..." and then "Accept the Risk and Continue"
- On Edge: Click "Continue to site"
The warning appears because we're using a self-signed certificate for local development. The connection is still encrypted and safe for local network use.
npm run dev
- Start all services concurrently (recommended for development)npm start
- Start the main Engine servicenpm run server
- Start the WebSocket servernpm run ChatLLama:start
- Start the ChatLLama frontendnpm run ChatLLama:server
- Start the ChatLLama backend servernpm run build:css
- Build and watch Tailwind CSS changesnpm run lint
- Run ESLint checksnpm run lint:fix
- Fix ESLint issues automaticallynpm run format
- Format code with Prettiernpm run format:check
- Check code formatting without making changes
Tip
For development, using npm run dev
is recommended as it starts all required services simultaneously.
This project is licensed under the MIT License.
We welcome contributions from the community! Here's how you can help make StreamNet better:
-
Fork the Repository
- Click the 'Fork' button on GitHub
- Clone your fork locally:
git clone https://github.com/GitCoder052023/StreamNet.git
-
Create a Branch
git checkout -b feature/your-feature-name
- Follow our coding style and conventions
- Write clear, documented code
- Add unit tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
-
Update your fork with the latest changes:
git remote add upstream https://github.com/GitCoder052023/StreamNet.git git fetch upstream git merge upstream/main
-
Push your changes:
git push origin feature/your-feature-name
-
Open a Pull Request with:
- Clear title and description
- Screenshots for UI changes
- List of changes made
- Bug fixes
- New features
- Documentation improvements
- UI/UX enhancements
- Performance improvements
- Test coverage
For detailed guidelines, please read our Contributing Guide.
Note
By contributing, you agree to follow our Code of Conduct.
If you discover a security vulnerability in StreamNet, please report it to us immediately. We take all security issues seriously and will address them as quickly as possible.
To report a vulnerability, please email us at contact.khub.dev@gmail.com
with the subject line "Security Vulnerability in StreamNet". Please include the following details in your report:
- A description of the vulnerability
- Steps to reproduce the issue
- Any potential impact of the vulnerability
- Your contact information (optional)
We will acknowledge receipt of your report within 48 hours and provide a timeline for addressing the issue.
- Encryption: All communications are encrypted using WebSockets (wss://).
- Input Validation: User inputs are validated to prevent injection attacks.
- Dependency Monitoring: We regularly update dependencies to ensure no known vulnerabilities are present.
We follow the principle of responsible disclosure. We ask that you do not publicly disclose the vulnerability until we have had a chance to address it and provide a fix.
Thank you for helping us keep StreamNet secure!
Built with ❤️ by Hamdan Khubaib for the community.