{"id":20796630,"url":"https://github.com/gotocva/nilajs","last_synced_at":"2025-06-27T00:35:13.928Z","repository":{"id":185320221,"uuid":"673343614","full_name":"gotocva/nilajs","owner":"gotocva","description":"\"NilaJS a simple and powerfull REST api framework built on top of expressjs.","archived":false,"fork":false,"pushed_at":"2025-04-16T06:35:41.000Z","size":3180,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-16T08:10:05.265Z","etag":null,"topics":["expressjs","framework","node-framework","nodejs-api"],"latest_commit_sha":null,"homepage":"https://nilajs.in","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gotocva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-01T12:19:26.000Z","updated_at":"2025-04-16T06:35:45.000Z","dependencies_parsed_at":"2024-11-17T16:35:25.973Z","dependency_job_id":"8efc2a36-5eb3-4c61-a877-01071e1c12b6","html_url":"https://github.com/gotocva/nilajs","commit_stats":null,"previous_names":["gotocva/nilajs"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotocva%2Fnilajs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotocva%2Fnilajs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotocva%2Fnilajs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotocva%2Fnilajs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gotocva","download_url":"https://codeload.github.com/gotocva/nilajs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252645478,"owners_count":21781966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","framework","node-framework","nodejs-api"],"created_at":"2024-11-17T16:28:25.668Z","updated_at":"2025-05-06T07:57:44.426Z","avatar_url":"https://github.com/gotocva.png","language":"JavaScript","readme":"\n\n\n## NilaJS REST api framework\n\n\n```bash\nnpx nilajs create:app \u003cappName\u003e\n```\n\nSteps to run the application REST api\n\n```bash\ncd \u003cappName\u003e\nnpm install\nnpm start\n```\n\nTo use nila cli to generate files \n\nRun below command to generate a new module with basic CRUD operations\n\n\nRun below command to generate a new controller \n\n```bash\nnode nila create:controller \u003ccontrollerName\u003e\n```\n\nRun below command to generate a new model \n\n```bash\nnode nila create:model \u003cmodelName\u003e\n```\n\n# **📌 NilaJS - Scalable \u0026 Lightweight JS backend framework**\n**NilaJS** is a **Scalable \u0026 Lightweight JS backend framework** designed with a clean architecture, following **MVC (Model-View-Controller)** and service-based design patterns. It includes **authentication, validations, error handling, socket handling, and a structured folder hierarchy** for easy scalability.\n\n---\n\n## **📁 Folder Structure**\n```\nNilaJS\n│── config/\n│   ├── mongoose.js\n│── controllers/\n│   ├── user.controller.js\n│── models/\n│   ├── user.model.js\n│── node_modules/  \n│── routes/v1/\n│   ├── routes.js\n│── services/user/\n│   ├── auth.service.js\n│   ├── user.service.js\n│── utils/\n│   ├── error.handler.js\n│   ├── memory.handler.js\n│   ├── socket.handler.js\n│── validations/user/\n│   ├── auth.validation.js\n│   ├── user.validation.js\n│── .env\n│── .env.example\n│── .gitignore\n│── index.js\n│── package-lock.json\n│── package.json\n│── README.md\n```\n\n---\n\n## **📂 Folder \u0026 File Explanations**\n### **1️⃣ `config/`**\nStores configuration files for external services or database connections.\n- **`mongoose.js`** → Initializes and configures MongoDB using Mongoose.\n\n### **2️⃣ `controllers/`**\nContains route handlers that process requests and return responses.\n- **`user.controller.js`** → Manages user-related logic (e.g., register, login, CRUD).\n\n### **3️⃣ `models/`**\nDefines database schemas and models using Mongoose.\n- **`user.model.js`** → Defines the User schema with fields like `name`, `email`, `password`.\n\n### **4️⃣ `routes/v1/`**\nDefines API routes and maps them to controllers.\n- **`routes.js`** → Centralized API routing for version 1 (`v1`).\n\n### **5️⃣ `services/user/`**\nContains business logic and reusable service functions.\n- **`auth.service.js`** → Handles authentication logic (e.g., password hashing, token generation).\n- **`user.service.js`** → Handles user-related operations (e.g., CRUD, profile updates).\n\n### **6️⃣ `utils/`**\nUtility functions for handling errors, memory monitoring, and sockets.\n- **`error.handler.js`** → Centralized error handling middleware.\n- **`memory.handler.js`** → Monitors memory usage and prevents leaks.\n- **`socket.handler.js`** → Handles WebSocket (`socket.io`) connections.\n\n### **7️⃣ `validations/user/`**\nHandles request validations using libraries like **Joi** or **Express Validator**.\n- **`auth.validation.js`** → Validates authentication-related requests (e.g., login, register).\n- **`user.validation.js`** → Validates user data inputs for CRUD operations.\n\n### **8️⃣ Root Files**\n- **`.env`** → Stores environment variables (e.g., database URL, API keys).\n- **`.env.example`** → Example `.env` file for developers.\n- **`.gitignore`** → Prevents unnecessary files from being committed.\n- **`index.js`** → Entry point of the application, initializes Express server.\n- **`package.json`** → Lists dependencies, scripts, and project metadata.\n- **`README.md`** → Documentation for the project.\n\n---\n\n# Environment Configuration Guide\n\nThis document provides instructions on how to set up and configure the environment variables for the application.\n\n## Prerequisites\n- Ensure you have Node.js installed on your system.\n- A `.env` file should be created in the root directory of the project.\n- Do not expose sensitive credentials in public repositories.\n\n## Setup Instructions\n\n1. **Create a `.env` file** in the root directory of the project if it does not already exist.\n\n2. **Copy the following template into your `.env` file and update the values accordingly:**\n\n```ini\n# Node.js environment setting\nNODE_ENV=development\n\n# Application server port\nPORT=3000\n\n# Application name\nAPP_NAME=\"YourAppName\"\n\n# Base URL of the application\nAPP_URL=\"http://localhost:3000\"\n\n# MongoDB connection string\nMONGODB_URL=\"mongodb://localhost:27017/mydatabase\"\n\n# Secret key for encryption/decryption\nSECRET_KEY=\"SECRET_KEY_FOR_ENCRYPTION_AND_DECRYPTION\"\n\n# JWT secret key for authentication\nJWT_SECRET=\"JWT_SECRET_KEY\"\n\n# Whitelisted domains for CORS (comma-separated values)\nWHITE_LISTED_DOMAINS=\"http://localhost:4200, http://localhost:3000\"\n\n# SMTP email configurations\nSMTP_HOST=smtp.zoho.com  \nSMTP_PORT=465  \nSMTP_USERNAME=email@mailinator.com  \nSMTP_PASSWORD=appPassword  \nEMAIL_FROM=email@mailinator.com  \n```\n\n## Notes:\n- **Update all values as per your environment.**\n- **Use strong and unique keys for `SECRET_KEY` and `JWT_SECRET`.**\n- **For production, avoid hardcoding secrets; use a secure vault or environment variable manager.**\n- **Ensure the `.env` file is added to `.gitignore` to prevent exposing sensitive information.**\n\n## Security Considerations\n- Never commit the `.env` file to version control.\n- Use environment variable management tools like **dotenv**, **AWS Secrets Manager**, or **Vault** for production setups.\n- Regularly rotate your secret keys and credentials.\n\n\n```\nMIT License\n\nCopyright (c) 2023 Sivabharathy\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotocva%2Fnilajs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgotocva%2Fnilajs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotocva%2Fnilajs/lists"}