{"id":15607342,"url":"https://github.com/hasimy-as/codebase-restify","last_synced_at":"2026-04-18T02:04:23.931Z","repository":{"id":53167266,"uuid":"324096835","full_name":"hasimy-as/Codebase-Restify","owner":"hasimy-as","description":"A back end project template using Restify as a Node.js framework and Redis for data caching.","archived":false,"fork":false,"pushed_at":"2021-04-03T02:08:29.000Z","size":822,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-04T14:50:14.599Z","etag":null,"topics":["api","codebase","codebase-restify","collaborator","eslint","nodejs","redis","restify"],"latest_commit_sha":null,"homepage":"https://api-codebase-restify.herokuapp.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hasimy-as.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-24T07:38:54.000Z","updated_at":"2021-08-18T07:44:31.000Z","dependencies_parsed_at":"2022-09-12T22:23:15.732Z","dependency_job_id":null,"html_url":"https://github.com/hasimy-as/Codebase-Restify","commit_stats":null,"previous_names":[],"tags_count":5,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasimy-as%2FCodebase-Restify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasimy-as%2FCodebase-Restify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasimy-as%2FCodebase-Restify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasimy-as%2FCodebase-Restify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasimy-as","download_url":"https://codeload.github.com/hasimy-as/Codebase-Restify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246193257,"owners_count":20738452,"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":["api","codebase","codebase-restify","collaborator","eslint","nodejs","redis","restify"],"created_at":"2024-10-03T05:01:28.874Z","updated_at":"2026-04-18T02:04:18.893Z","avatar_url":"https://github.com/hasimy-as.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codebase-Restify\n\nA back end project template using Restify as a Node.js framework and Redis for data caching.\n\n[![App version](https://img.shields.io/badge/Version-v.2.0.0-green)](https://gitHub.com/hasimy-as/Codebase-Restify/releases)\n[![Github license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/hasimy-as/Codebase-Restify/master/LICENSE)\n[![npm](https://img.shields.io/npm/v/npm.svg)](https://www.npmjs.com/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://gitHub.com/hasimy-as/Codebase-Restify)\n[![Code coverage](https://img.shields.io/badge/Code_Coverage-93%25-green)](https://gitHub.com/hasimy-as/Codebase-Restify)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code-of-conduct.md)\n\u003cbr /\u003e\n\n# About\n\nProviding REST API is a mandatory feature in the modern world. There are a few reasons to choose Restify and MongoDB. In essence, we’re avoiding potential pitfalls with picking the “shiny new thing” and focusing on the most important factors when it comes to building a REST API: developer experience, performance, along with support and availability of knowledge/experience within the Javascript community.\n\nThis Codebase is based on a simple real life use-case inside an internal office or environment, which is the Admin is able to create User, and the User is able to create a Document. Access points are using Basic and JWT Authentications.\n\n# Pre-reqs\nTo run this project locally, you will need to do a few things:\n- Install [Node.js](https://nodejs.org/en/)\n- Install [MongoDB](https://docs.mongodb.com/manual/installation/)\n- Install [Redis](https://redis.io/topics/quickstart)\n- Install [VS Code Editor](https://code.visualstudio.com/)\n\u003e **Note:** Other code editor will work just fine.\n\n# Getting started\n- Clone the repository\n```\ngit clone --depth=1 https://github.com/hasimy-as/Codebase-Restify.git \u003cproject_name\u003e\n```\n- Install dependencies\n```\ncd \u003cproject_name\u003e\nnpm install\n```\n- Configure your MongoDB server\n```zsh\n# create the db directory\nsudo mkdir -p /data/db\n# give the db correct read/write permissions\nsudo chmod 777 /data/db\n```\n- Initialize MongoDB\n```zsh\n./mongod\n```\n- Initialize Redis\n```zsh\n./redis-server\n```\n- Run the project in production mode\n```\nnpm start\n```\n- Run the project in development mode\n```\nnpm run dev\n```\n- ESLint\n```zsh\n# check linting\nnpm run lint\n# fix linting problems\nnpm run lint-fix\n```\n- Unit and Integration tests\n```zsh\n# run tests\nnpm run test\n# generate test coverage report\nnpm run cover\n```\n- Environment configuration (.env.example)\n\u003e **Note:** You may change the configuration as you like, and put it in a .env file.\n```\n# PORT\nPORT = mongodb://\u003cusername\u003e:\u003cpassword\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdatabase_name\u003e\n\n# MONGODB\nMONGO_URI = YOUR_MONGO_URI\n\n# BASIC AUTHENTICATION\nBASIC_AUTH_USERNAME = USERNAME\nBASIC_AUTH_PASSWORD = PASSWORD\n\n# KEYS\nPUBLIC_KEY = public.pem\nPRIVATE_KEY = private.pem\nSECRET_KEY = shussshhhh\n\n# REDIS\nREDIS_URL = redis://\u003cusername\u003e:\u003cpassword\u003e@\u003chost\u003e:\u003cport\u003e\n```\n- Endpoints\n```\n- ROOT\n# GET\nhttp://localhost:\u003cYOUR_PORT\u003e/\n\n- ADMIN\n# GET\nJWT TOKEN         = http://localhost:\u003cYOUR_PORT\u003e/api/admin\nJWT TOKEN         = http://localhost:\u003cYOUR_PORT\u003e/api/admin/:adminId\n\n# POST\nBASIC AUTH        = http://localhost:\u003cYOUR_PORT\u003e/api/admin\nBASIC AUTH        = http://localhost:\u003cYOUR_PORT\u003e/api/admin/login\n\n# PUT\nJWT TOKEN (Admin) = http://localhost:\u003cYOUR_PORT\u003e/api/admin/:adminId\n\n# DEL\nJWT TOKEN (Admin) = http://localhost:\u003cYOUR_PORT\u003e/api/admin/:adminId\n\n- USER\n# GET\nBASIC AUTH        = http://localhost:\u003cYOUR_PORT\u003e/api/users\nJWT TOKEN         = http://localhost:\u003cYOUR_PORT\u003e/api/users/:userId\n\n# POST\nJWT TOKEN (Admin) = http://localhost:\u003cYOUR_PORT\u003e/api/users\nBASIC AUTH        = http://localhost:\u003cYOUR_PORT\u003e/api/users/login\n\n# PUT\nJWT TOKEN (User)  = http://localhost:\u003cYOUR_PORT\u003e/api/users/:userId\n\n# DEL\nJWT TOKEN (Admin) = http://localhost:\u003cYOUR_PORT\u003e/api/users/:userId\n\n- DOCUMENTS\n# GET\nJWT TOKEN         = http://localhost:\u003cYOUR_PORT\u003e/api/document\nJWT TOKEN         = http://localhost:\u003cYOUR_PORT\u003e/api/document/:documentId\n\n# POST\nJWT TOKEN (User)  = http://localhost:\u003cYOUR_PORT\u003e/api/document\n\n# PUT\nJWT TOKEN (User)  = http://localhost:\u003cYOUR_PORT\u003e/api/document/:documentId\n\n# DEL\nJWT TOKEN (USER)  = http://localhost:\u003cYOUR_PORT\u003e/api/document/:documentId\n```\n\n# What's inside?\n\nA quick peek at some of the top-level files and directories found in this project.\n\n| Name | Description |\n| ------------------------ | --------------------------------------------------------------------------------------------- |\n| **app**                  | This directory contains all of the code related to the back-end, such as APIs, configurations, database connections, and library files.|\n| **test**                 | Tests for this projects are stored here.|\n| **server.js**            | Entry point to your Restify application.|\n| README                   | Well, you're reading it right now jahaha.|\n| LICENSE                  | Codebase-Restify is licensed under the MIT license.|\n| .env.example             | API keys, tokens, passwords, database URI. Clone this, but don't check it in to public repos.|\n| .eslintrc.yml            | Main configuration file for ESLint. ESLint is a pluggable and configurable linter tool for identifying and reporting on patterns in Javascript.|\n| code-of-conduct          | Passport authentication strategies and login middleware. Add other complex config code here   |\n| package.json             | A manifest file for Node.js projects. Includes things such as metadata (the project's name, author, et cetera).|\n| package-lock.json        | An automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You won't change this file directly).|\n\n# Schema\n\nThe schema or models that this project is using is with the help of [Joi](https://joi.dev).\n\n```js\n// Admin schema\n// GET BY ID\nadminId: Joi.string().guid().required()\n\n// CREATE\nroles: Joi.string().default(ROLES.SUPER_ADMIN).optional(),\nname: Joi.string().required(),\naddress: Joi.string().required(),\nemail: Joi.string().email().max(50).required(),\npassword: Joi.string().min(6).required()\n\n// LOGIN\nemail: Joi.string().email().max(50).required(),\npassword: Joi.string().min(6).required()\n\n// UPDATE\nadminId: Joi.string().guid().required(),\nname: Joi.string().required(),\naddress: Joi.string().required(),\nemail: Joi.string().email().max(50).required(),\npassword: Joi.string().min(6).required()\n\n// DELETE\nadminId: Joi.string().guid().required()\n\n// User schema\n// GET BY ID\nuserId: Joi.string().guid().required()\n\n// CREATE\nroles: Joi.string().default(ROLES.USER).optional(),\nname: Joi.string().required(),\naddress: Joi.string().required(),\nemail: Joi.string().email().max(50).required(),\npassword: Joi.string().min(6).required()\n\n// LOGIN\nemail: Joi.string().email().max(50).required(),\npassword: Joi.string().min(6).required()\n\n// UPDATE\nuserId: Joi.string().guid().required(),\nname: Joi.string().required(),\naddress: Joi.string().required(),\nemail: Joi.string().email().max(50).required(),\npassword: Joi.string().min(6).required()\n\n// DELETE\nuserId: Joi.string().guid().required()\n\n// Document schema\n// CREATE\ntitle: Joi.string().max(60).required(),\nabout: Joi.string().max(250).required(),\ndocument: Joi.string().required()\n\n// UPDATE\ndocumentId: Joi.string().guid().required(),\ntitle: Joi.string().max(60).required(),\nabout: Joi.string().max(250).required(),\ndocument: Joi.string().required()\n\n// DELETE\ndocumentId: Joi.string().guid().required()\n```\n\n# Dependencies\n\nDependencies are managed through `package.json`.\nIn that file you'll find two sections:\n## `dependencies`\n\n| Package                         | Description                                                           |\n| ------------------------------- | --------------------------------------------------------------------- |\n| babel-eslint                    | An ESLint parser that allows for linting of experimental syntax transformed by Babel.|\n| chai                            | BDD/TDD assertion library for Node.js|\n| confidence                      | A configuration document format designed to work with any existing JSON-based configuration.|\n| cors                            | Node.js [CORS](https://web.dev/cross-origin-resource-sharing/) middleware.|\n| crypto                          | Provides cryptographic functionality including wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.|\n| eslint                          | A linter tool for identifying and reporting on patterns in Javascript.|\n| generic-pool                    | Generic resource pool with Promise based API to reuse or throttle usage of database connections.|\n| hippie                          | HTTP assertion library for Node.js.|\n| joi                             | Schema description language and data validator for Javascript.|\n| jsonwebtoken                    | Implementation of [JSON Web Tokens](https://tools.ietf.org/html/rfc7519).|\n| mocha                           | Test framework for Node.js|\n| mongodb                         | [MongoDB](https://www.mongodb.com/) driver for Node.js.|\n| passport                        | An authentication middleware for Node.js|\n| passport-http                   | HTTP Basic and Digest authentication strategies for Passport.|\n| redis                           | An asynchronous Node.js Redis client.|\n| restify                         | Node.js REST API framework.|\n| sinon                           | Test framework for Javascript, specializes in testing spies, stubs and mocks.|\n| uuid                            | For the creation of [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) UUIDs.|\n| validate.js                     | Declarative validations for Javascript objects.|\n| winston                         | Logging library with support for multiple transports.|\n\n## `devDependencies`\n\n| Package                         | Description                                                           |\n| ------------------------------- | --------------------------------------------------------------------- |\n| dotenv                          | Loads environment variables from .env file.|\n| istanbul                        | A Javascript code coverage tool.|\n| nodemon                         | Utility that automatically restarts node process when it crashes.|\n| nyc                             | Istanbul CLI for coverage test results.|\n\n# Version\n\nCurrent app version is on v2.0.0.\n\n# License and Conduct\n\nMIT © [Hasimy Md's License](https://raw.githubusercontent.com/hasimy-as/Codebase-Restify/master/LICENSE)\n\n[Code of Conduct](code-of-conduct.md)\n\n# Collaboration\n\nWant to collaborate? Fork the project and be a collaborator now!\n\nHappy coding!\n\n~Hasimy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasimy-as%2Fcodebase-restify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasimy-as%2Fcodebase-restify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasimy-as%2Fcodebase-restify/lists"}