Skip to content

The Boom Nexus Env Manager is a secure and efficient environment variable management system designed for Boom Nexus. It allows administrators to store, manage, and retrieve sensitive environment variables such as API keys, database credentials, and third-party service configurations

License

Notifications You must be signed in to change notification settings

Boomtoknlab/boom-nexus-env-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Boom Nexus Env Manager

πŸ“Œ Overview

The Boom Nexus Env Manager is a secure and scalable environment variable management system for Boom Nexus applications. It enables administrators to store, manage, and retrieve environment variables efficiently while maintaining high security, role-based access control (RBAC), and seamless API integration.


πŸš€ Features

βœ… Secure Storage – Encrypts environment variables using AES encryption in PostgreSQL.
βœ… Role-Based Access Control (RBAC) – Implements JWT authentication for user-specific access control.
βœ… Admin Dashboard – User-friendly interface for managing variables effortlessly (React-based).
βœ… RESTful API – Exposes secure endpoints for programmatic access and automation.
βœ… Logging & Auditing – Tracks changes, access logs, and permissions for security compliance.
βœ… Multi-Environment Support – Manages variables across development, staging, and production environments.


πŸ“‚ Project Structure

boom-nexus-env-manager/ │── backend/ # Node.js & Express API β”‚ β”œβ”€β”€ config/ # Configuration files β”‚ β”œβ”€β”€ controllers/ # API Controllers β”‚ β”œβ”€β”€ models/ # Database Models β”‚ β”œβ”€β”€ routes/ # API Routes β”‚ β”œβ”€β”€ middleware/ # Auth & Security Middleware β”‚ β”œβ”€β”€ utils/ # Utility Functions β”‚ β”œβ”€β”€ server.js # Main Server Entry β”‚ └── .env.example # Example environment variables β”‚ │── frontend/ # React Admin Dashboard β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ components/ # UI Components β”‚ β”‚ β”œβ”€β”€ pages/ # Dashboard Pages β”‚ β”‚ β”œβ”€β”€ services/ # API Integration β”‚ β”‚ β”œβ”€β”€ App.js # Main App Entry β”‚ β”‚ β”œβ”€β”€ index.js # React DOM Renderer β”‚ └── public/ # Static Files β”‚ │── database/ # PostgreSQL Database Scripts │── docs/ # Documentation & API Reference │── README.md # Project Documentation │── LICENSE # MIT License │── package.json # Backend Dependencies │── frontend/package.json # Frontend Dependencies


πŸ› οΈ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/Boomtoknlab/boom-nexus-env-manager.git
cd boom-nexus-env-manager

2️⃣ Backend Setup
cd backend
cp .env.example .env   # Configure environment variables
npm install            # Install dependencies
npm run dev            # Start backend in development mode

3️⃣ Frontend Setup
cd ../frontend
npm install            # Install dependencies
npm start              # Run React dashboard

4️⃣ Database Setup (PostgreSQL)
# Open PostgreSQL and create the database
CREATE DATABASE boom_env_manager;

# Run migrations
npx sequelize-cli db:migrate

πŸ”‘ API Authentication

Boom Nexus Env Manager uses JWT authentication. You need to include a token in the request header:
Authorization: Bearer YOUR_JWT_TOKEN

πŸ”Ή Example API Calls

1️⃣ Get All Environment Variables
GET /api/env-variables

2️⃣ Add a New Environment Variable
POST /api/env-variables
Content-Type: application/json
Authorization: Bearer YOUR_JWT_TOKEN

{
  "key": "DATABASE_URL",
  "value": "postgres://user:password@localhost:5432/dbname"
}

4️⃣ Delete an Environment Variable
DELETE /api/env-variables/:id
Authorization: Bearer YOUR_JWT_TOKEN

πŸ”§ Backend Code Examples

server.js (Backend Entry Point)
import express from 'express';
import dotenv from 'dotenv';
import cors from 'cors';
import envRoutes from './routes/envRoutes.js';
import authMiddleware from './middleware/auth.js';

dotenv.config();
const app = express();

app.use(cors());
app.use(express.json());

app.use('/api/env-variables', authMiddleware, envRoutes);

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));

models/EnvVariable.js (Database Model for Environment Variables)
import express from 'express';
import { getEnvVariables, addEnvVariable, updateEnvVariable, deleteEnvVariable } from '../controllers/envController.js';

const router = express.Router();

router.get('/', getEnvVariables);
router.post('/', addEnvVariable);
router.put('/:id', updateEnvVariable);
router.delete('/:id', deleteEnvVariable);

export default router;

controllers/envController.js (Controller Functions for Environment Variables)
import EnvVariable from '../models/EnvVariable.js';

export const getEnvVariables = async (req, res) => {
  try {
    const variables = await EnvVariable.findAll();
    res.json(variables);
  } catch (error) {
    res.status(500).json({ error: 'Failed to fetch environment variables' });
  }
};

export const addEnvVariable = async (req, res) => {
  try {
    const { key, value } = req.body;
    const variable = await EnvVariable.create({ key, value });
    res.status(201).json(variable);
  } catch (error) {
    res.status(500).json({ error: 'Failed to add environment variable' });
  }
};

export const updateEnvVariable = async (req, res) => {
  try {
    const { id } = req.params;
    const { value } = req.body;
    await EnvVariable.update({ value }, { where: { id } });
    res.json({ message: 'Updated successfully' });
  } catch (error) {
    res.status(500).json({ error: 'Failed to update environment variable' });
  }
};

export const deleteEnvVariable = async (req, res) => {
  try {
    const { id } = req.params;
    await EnvVariable.destroy({ where: { id } });
    res.json({ message: 'Deleted successfully' });
  } catch (error) {
    res.status(500).json({ error: 'Failed to delete environment variable' });
  }
};

🌍 Frontend (React Dashboard) Example

services/api.js (API Service for Environment Variables)
import axios from 'axios';

const API_URL = 'http://localhost:5000/api/env-variables';

export const getEnvVariables = async () => {
  const response = await axios.get(API_URL);
  return response.data;
};

export const addEnvVariable = async (data) => {
  const response = await axios.post(API_URL, data);
  return response.data;
};

export const updateEnvVariable = async (id, data) => {
  const response = await axios.put(`${API_URL}/${id}`, data);
  return response.data;
};

export const deleteEnvVariable = async (id) => {
  const response = await axios.delete(`${API_URL}/${id}`);
  return response.data;
};

πŸ“œ License

This project is open-source and available under the MIT License.

πŸ“© Contact

For inquiries, reach out via GitHub Issues.

About

The Boom Nexus Env Manager is a secure and efficient environment variable management system designed for Boom Nexus. It allows administrators to store, manage, and retrieve sensitive environment variables such as API keys, database credentials, and third-party service configurations

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published