{"id":14957716,"url":"https://github.com/fwd/server","last_synced_at":"2025-07-20T02:05:46.374Z","repository":{"id":103798486,"uuid":"298763840","full_name":"fwd/server","owner":"fwd","description":"Full-Stack NodeJS Toolkit","archived":false,"fork":false,"pushed_at":"2024-11-01T14:04:37.000Z","size":8133,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-25T16:05:22.833Z","etag":null,"topics":["boilerplate","boostrap","database","express-js","framework","momentjs","nodejs","shell"],"latest_commit_sha":null,"homepage":"","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/fwd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-26T07:44:37.000Z","updated_at":"2024-11-01T14:04:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"ece03c9a-0056-4627-8711-3a915a209698","html_url":"https://github.com/fwd/server","commit_stats":{"total_commits":129,"total_committers":3,"mean_commits":43.0,"dds":"0.45736434108527135","last_synced_commit":"e819e63b32528f1021ced8bffd56cded9bfc2bf4"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fwd/server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwd%2Fserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwd%2Fserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwd%2Fserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwd%2Fserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fwd","download_url":"https://codeload.github.com/fwd/server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwd%2Fserver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266057171,"owners_count":23870120,"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":["boilerplate","boostrap","database","express-js","framework","momentjs","nodejs","shell"],"created_at":"2024-09-24T13:15:23.225Z","updated_at":"2025-07-20T02:05:46.344Z","avatar_url":"https://github.com/fwd.png","language":"JavaScript","readme":"![Cover](https://raw.githubusercontent.com/fwd/server/master/.github/banner.png)\n\n## Features\n\n- [Full Web Server (ExpressJS)](#advanced-usage)\n- [HTTP Library (Axios)](#built-in-http-client-axios)\n- [In-Memory Caching](#in-memory-caching)\n- [SQL-Like JSON Database](#built-in-database)\n- [Crypto UUID Generator](#generate-crypto-uuid)\n- [Natural Language Date Parsing](#natural-language-date-parsing)\n- [Natural Language Timestamps](#natural-language-timestamps)\n- [Filesystem Read/Write](#built-in-file-readwrite)\n- [Filesystem Prepend/Append](#built-in-uuid-generator)\n- [Natural Language Cron](#natural-language-cron)\n- [Run SHELL from NodeJS](#execute-shell-from-nodejs)\n\n## Install\n\n```bash\nnpm install fwd/server\n```\n\n## Basic Usage\n\n```js\nconst server = require('@fwd/server')\n\nserver.get('/', (req, res) =\u003e {\n\tres.send(\"Hello, World!\")\n}) \n\nserver.start(8080)\n```\n\n\u003e Static files are served from **/public** by default. Change with ```server.start(8080, { public: '/dist' })```.\n\n## Advanced Usage\n\n```js\nserver.get('/', async (req, res) =\u003e {\n\tvar settings = await server.database.get('settings')\n\tres.render('index', { config: settings, query: req.query }) // /views/index.ejs\n})\n\nserver.post('/register', async (req, res) =\u003e {\n\n\tvar user = await server.database.create('users', {\n\t\tid: server.uuid(),\n\t\tname: req.body.name,\n\t\tcreated_at: server.timestamp()\n\t})\n\t\n\t// fetching it again just to show off API\n\tuser = await server.database.findOne('users', { name: req.body.name })\n\t\n\tres.send({ user })\n\t\n})\n\nserver.get('/joke', async (req, res) =\u003e {\n\t\n\tvar joke = (await server.http.get('https://api.chucknorris.io/jokes/random')).data\n\t\n\tres.send({ joke })\n\n})\n\nserver.get('/user/:id', async (req, res) =\u003e {\n\n\tvar user = await server.database.findOne('users', { id: req.params.id })\n\n\tif (!user) return res.send({ error: 401 })\n\t\n\tres.send({ user })\n\n})\n\nserver.start(8080, {\n   timezone: 'America/New_York' // optional, just showing it off\n}) \n```\n\n## HTTP Middleware\n\n```js\nserver.get('/', (req, res) =\u003e {\n\tres.send(\"Hello, World!\")\n})\n\nserver.use((req, res, next) =\u003e {\n\t// do stuff\n\tconsole.log( req.ip, req.originalUrl )\n\tnext()\n})\n\nserver.start(8080)\n```\n\n\u003e Includes **CORS** and **EJS** rendering for your convenience.\n\n## Built-in HTTP Client (Axios)\n\n```js\n;(async () =\u003e {\n\tvar joke = await server.http.get('https://api.chucknorris.io/jokes/random')\n\tconsole.log( joke.data )\n})()\n```\n\n## Built-in Database \n\n```js\nconst database = server.database\n;(async () =\u003e {\n\tawait database.get('users') // list all users\n\tawait database.create('users', { name: john }) // creates user, id \u0026 created_at will be generated if not provided\n\tawait database.find('users', { name: 'Joe' }) // Filter users by query\n\tawait database.findOne('users', { id: 1 }) // find user with id of 1\n\tawait database.update('users', 1, { name: \"John\" }) // update user with id of 1 \n\tawait database.remove('users', 1)  // remove user with id of 1\n})()\n\n```\n\nDedicated Github: [@fwd/database](https://github.com/fwd/database)\n\n## In-Memory Caching\n\n```js\nserver.cache('unique_key', { fname: 'Joe' })\n\nconsole.log( server.cache('unique_key') ) // { fname: 'Joe' }\n```\n\n## Natural Language Date Parsing\n\n\u003e Added September 7th, 2021\n\n```js\nconsole.log( server.date('next friday') )\n// Fri Sep 12 2014 12:00:00 GMT-0500 (CDT)\n```\n\nMore info: [@fwd/time](https://github.com/fwd/time)\n\n## Natural Language Timestamps\n\n```js\nserver.time(5, 'seconds') // 5000\nserver.time(1, 'minute') // 60000\n\n// example\nsetInterval(() =\u003e {\n\tconsole.log(\"The time is:\", server.timestamp('LLLL'))\n}, server.time(24, 'minutes'))\n```\n\n## Simple Timestamps\n\n```js\nserver.timestamp() // UNIX timestamp\nserver.timestamp('LL') // September 28, 1994\nserver.timestamp('LLL') // September 28, 1994 4:30PM\nserver.timestamp('LLL', 'America/New_York') // Optional, timezones.\n```\n\nMore info: [@fwd/cache](https://github.com/fwd/cache)\n\n## Natural Language Cron\n\n```js\nserver.cron(() =\u003e {\n\tconsole.log(\"The time is:\", server.timestamp('LLLL'))\n}, 'every 1 hour')\n```\n\nMore info: [@fwd/cron](https://github.com/fwd/cron)\n\n## Generate Crypto UUID\n\n```js\nconst server = require('@fwd/server')\n\nserver.uuid() // 9e471b08-38fe-11eb-adc1-0242ac120002 \nserver.uuid(true) // short uuid, 9e471b08\n```\n\n## Execute Shell from NodeJS\n\n```js\n;(async () =\u003e {\n\tvar cpu_usage = await server.exec(`awk '/cpu /{print 100*($2+$4)/($2+$4+$5)}' /proc/stat`)\n\tconsole.log( cpu_usage )\n})()\n\n```\n\n## Built-in File Read/Write \n\n```js\n;(async () =\u003e {\n\tvar data = await server.read('./grades.csv')\n\tconsole.log( data )\n})()\n```\n\n## Write File\n\n```js\n;(async () =\u003e {\n\t\n\tvar data = await server.write('./notes.txt', 'John Doe')\n\n\tconsole.log( data )\n\n})()\n```\n\n## Append a File\n\n```js\n;(async () =\u003e {\n\tvar data = await server.append('./names.txt', 'John Doe')\n\tconsole.log( data )\n})()\n\n```\n\n## Prepend a File\n\n```js\n;(async () =\u003e {\n\tvar data = await server.prepend('./names.txt', 'Joe Mama')\n\tconsole.log( data )\n})()\n\n```\n\n## MomentJS Included\n\n```js\nconsole.log(server.moment().format('LLLL'))\nconsole.log(server.moment().fromNow())\n```\n\n## 🤝 Contributing\n\nGive a ⭐️ if this project helped you!\n\nContributions, issues and feature requests are welcome! Feel free to check [issues page](https://github.com/fwd/server/issues).\n\n## 📝 License\n\nMIT License\n\nCopyright © [@nano2dev](https://twitter.com/nano2dev).\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\n## Stargazers\n\n[![Stargazers over time](https://starchart.cc/fwd/server.svg)](https://starchart.cc/fwd/server)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwd%2Fserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffwd%2Fserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwd%2Fserver/lists"}