{"id":21753841,"url":"https://github.com/melardev/apiecombookshelfexpress","last_synced_at":"2026-04-14T01:31:08.421Z","repository":{"id":107256069,"uuid":"170124664","full_name":"melardev/ApiEcomBookshelfExpress","owner":"melardev","description":"Ecommerce API app built with Express and Bookshelf js ORM framework","archived":false,"fork":false,"pushed_at":"2019-03-13T13:12:27.000Z","size":666,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T02:46:22.597Z","etag":null,"topics":["api","bookshelf","crud","e-commerce","ecommerce","express","expressjs","full-stack","fullstack","javascript","node","node-js","orm","orm-framework","pagination","web","webapp"],"latest_commit_sha":null,"homepage":"http://melardev.com/eng","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/melardev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2019-02-11T12:25:19.000Z","updated_at":"2020-10-05T04:54:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8cd77f1-badd-4d8a-b156-5e79e03bad40","html_url":"https://github.com/melardev/ApiEcomBookshelfExpress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/melardev/ApiEcomBookshelfExpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FApiEcomBookshelfExpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FApiEcomBookshelfExpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FApiEcomBookshelfExpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FApiEcomBookshelfExpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melardev","download_url":"https://codeload.github.com/melardev/ApiEcomBookshelfExpress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FApiEcomBookshelfExpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31778580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T00:11:49.126Z","status":"ssl_error","status_checked_at":"2026-04-14T00:10:29.837Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","bookshelf","crud","e-commerce","ecommerce","express","expressjs","full-stack","fullstack","javascript","node","node-js","orm","orm-framework","pagination","web","webapp"],"created_at":"2024-11-26T09:11:53.175Z","updated_at":"2026-04-14T01:31:08.404Z","avatar_url":"https://github.com/melardev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Api E-commerce Express + Bookshelf\n# Table of Contents\n- [Introduction](#introduction)\n- [Full-stack Applications](#full-stack-applications)\n  * [E-commerce (shopping cart)](#e-commerce-shopping-cart)\n    + [Server side implementations](#server-side-implementations)\n    + [Client side implementations](#client-side-implementations)\n  * [Blog/CMS](#blogcms)\n    + [Server side implementations](#server-side-implementations-1)\n    + [Client side](#client-side)\n      - [The next come are](#the-next-come-are)\n  * [Simple CRUD(Create, Read, Update, Delete)](#simple-crudcreate-read-update-delete)\n    + [Server side implementations](#server-side-implementations-2)\n    + [Client side implementations](#client-side-implementations-1)\n      - [The next come are](#the-next-come-are-1)\n  * [CRUD + Pagination](#crud--pagination)\n    + [Server side implementations](#server-side-implementations-3)\n      - [The next come are](#the-next-come-are-2)\n    + [Client side implementations](#client-side-implementations-2)\n      - [The next come are](#the-next-come-are-3)\n- [Follow me](#social-media-links)\n    \n# Introduction\nThis is one of my E-commerce API app implementations. It is written in Node js, using Express and Bookshelf as the main dependencies.\nThis is not a finished project by any means, but it has a valid enough shape to be git cloned and studied if you are interested in this topic.\nIf you are interested in this project take a look at my other server API implementations I have made with:\n\n# Full-stack Applications\n## E-commerce (shopping cart)\n### Server side implementations\n- [Spring Boot + Spring Data Hibernate](https://github.com/melardev/SBootApiEcomMVCHibernate)\n- [Spring Boot + JAX-RS Jersey + Spring Data Hibernate](https://github.com/melardev/SpringBootEcommerceApiJersey)\n- [Node Js + Sequelize](https://github.com/melardev/ApiEcomSequelizeExpress)\n- [Node Js + Bookshelf](https://github.com/melardev/ApiEcomBookshelfExpress)\n- [Node Js + Mongoose](https://github.com/melardev/ApiEcomMongooseExpress)\n- [Python Django](https://github.com/melardev/DjangoRestShopApy)\n- [Flask](https://github.com/melardev/FlaskApiEcommerce)\n- [Golang go gonic](https://github.com/melardev/api_shop_gonic)\n- [Ruby on Rails](https://github.com/melardev/RailsApiEcommerce)\n- [AspNet Core](https://github.com/melardev/ApiAspCoreEcommerce)\n- [Laravel](https://github.com/melardev/ApiEcommerceLaravel)\n\nThe next to come are:\n- Spring Boot + Spring Data Hibernate + Kotlin\n- Spring Boot + Jax-RS Jersey + Hibernate + Kotlin\n- Spring Boot + mybatis\n- Spring Boot + mybatis + Kotlin\n- Asp.Net Web Api v2\n- Elixir\n- Golang + Beego\n- Golang + Iris\n- Golang + Echo\n- Golang + Mux\n- Golang + Revel\n- Golang + Kit\n- Flask + Flask-Restful\n- AspNetCore + NHibernate\n- AspNetCore + Dapper\n\n### Client side implementations\nThis client side E-commerce application is also implemented using other client side technologies:\n- [React Redux](https://github.com/melardev/ReactReduxEcommerceRestApi)\n- [React](https://github.com/melardev/ReactEcommerceRestApi)\n- [Vue](https://github.com/melardev/VueEcommerceRestApi)\n- [Vue + Vuex](https://github.com/melardev/VueVuexEcommerceRestApi)\n- [Angular](https://github.com/melardev/AngularEcommerceRestApi)\n\n## Blog/CMS\n### Server side implementations\n- [Spring Boot + Spring Data Hibernate](https://github.com/melardev/SpringBootApiBlog)\n- [Go + Gin Gonic](https://github.com/melardev/GoGonicBlogApi)\n- [NodeJs + Mongoose](https://github.com/melardev/ApiBlogExpressMongoose)\n- [Laravel](https://github.com/melardev/LaravelApiBlog)\n- [Ruby on Rails + JBuilder](https://github.com/melardev/RailsApiBlog)\n- [Django + Rest-Framework](https://github.com/melardev/DjangoApiBlog)\n- [Asp.Net Core](https://github.com/melardev/AspCoreApiBlog)\n- [Flask + Flask-SQLAlchemy](https://github.com/melardev/FlaskApiBlog)\n\nThe next to come are:\n- Spring Boot + Spring Data Hibernate + Kotlin\n- Spring Boot + Jax-RS Jersey + Hibernate + Kotlin\n- Spring Boot + mybatis\n- Spring Boot + mybatis + Kotlin\n- Asp.Net Web Api v2\n- Elixir\n- Golang + Beego\n- Golang + Iris\n- Golang + Echo\n- Golang + Mux\n- Golang + Revel\n- Golang + Kit\n- Flask + Flask-Restful\n- AspNetCore + NHibernate\n- AspNetCore + Dapper\n\n### Client side\n- [Vue + Vuex](https://github.com/melardev/VueVuexBlog)\n- [Vue](https://github.com/melardev/VueBlog)\n- [React + Redux](https://github.com/melardev/ReactReduxBlog)\n- [React](https://github.com/melardev/ReactBlog)\n- [Angular](https://github.com/melardev/AngularBlog)\n\nThe next come are\n- Angular NgRx-Store\n- Angular + Material\n- React + Material\n- React + Redux + Material\n- Vue + Material\n- Vue + Vuex + Material\n- Ember\n\n## Simple CRUD(Create, Read, Update, Delete)\n### Server side implementations\n- [Spring Boot + Spring Data Hibernate](https://github.com/melardev/SpringBootApiJpaCrud)\n- [Spring boot + Spring Data Reactive Mongo](https://github.com/melardev/SpringBootApiReactiveMongoCrud)\n- [Spring Boot + Spring Data Hibernate + Jersey](https://github.com/melardev/SpringBootApiJerseySpringDataCrud)\n- [NodeJs Express + Mongoose](https://github.com/melardev/ExpressMongooseApiCrud)\n- [Nodejs Express + Bookshelf](https://github.com/melardev/ExpressBookshelfApiCrud)\n- [Nodejs Express + Sequelize](https://github.com/melardev/ExpressSequelizeApiCrud)\n- [Go + Gin-Gonic + Gorm](https://github.com/melardev/GoGinGonicApiGormCrud)\n- [Ruby On Rails](https://github.com/melardev/RailsApiCrud)\n- [Ruby On Rails + JBuilder](https://github.com/melardev/RailsApiJBuilderCrud)\n- [Laravel](https://github.com/melardev/LaravelApiCrud)\n- [AspNet Core](https://github.com/melardev/AspNetCoreApiCrud)\n- [AspNet Web Api 2](https://github.com/melardev/AspNetWebApiCrud)\n- [Python + Flask](https://github.com/melardev/FlaskApiCrud)\n- [Python + Django](https://github.com/melardev/DjanogApiCrud)\n- [Python + Django + Rest Framework](https://github.com/melardev/DjangoRestFrameworkCrud)\n\n### Client side implementations\n- [VueJs](https://github.com/melardev/VueAsyncCrud)\n\n#### The next come are\n- Angular NgRx-Store\n- Angular + Material\n- React + Material\n- React + Redux + Material\n- Vue + Material\n- Vue + Vuex + Material\n- Ember\n- Vanilla javascript\n\n## CRUD + Pagination\n### Server side implementations\n- [Spring Boot + Spring Data + Jersey](https://github.com/melardev/SpringBootJerseyApiPaginatedCrud)\n- [Spring Boot + Spring Data](https://github.com/melardev/SpringBootApiJpaPaginatedCrud)\n- [Spring Boot Reactive + Spring Data Reactive](https://github.com/melardev/ApiCrudReactiveMongo)\n- [Go with Gin Gonic](https://github.com/melardev/GoGinGonicApiPaginatedCrud)\n- [Laravel](https://github.com/melardev/LaravelApiPaginatedCrud)\n- [Rails + JBuilder](https://github.com/melardev/RailsJBuilderApiPaginatedCrud)\n- [Rails](https://github.com/melardev/RailsApiPaginatedCrud)\n- [NodeJs Express + Sequelize](https://github.com/melardev/ExpressSequelizeApiPaginatedCrud)\n- [NodeJs Express + Bookshelf](https://github.com/melardev/ExpressBookshelfApiPaginatedCrud)\n- [NodeJs Express + Mongoose](https://github.com/melardev/ExpressApiMongoosePaginatedCrud)\n- [Python Django](https://github.com/melardev/DjangoApiCrudPaginated)\n- [Python Django + Rest Framework](https://github.com/melardev/DjangoRestFrameworkPaginatedCrud)\n- [Python Flask](https://github.com/melardev/FlaskApiPaginatedCrud)\n- [AspNet Core](https://github.com/melardev/AspNetCoreApiPaginatedCrud)\n- [AspNet Web Api 2](https://github.com/melardev/WebApiPaginatedAsyncCrud)\n\n#### The next come are\n- NodeJs Express + Knex\n- Flask + Flask-Restful\n- Laravel + Fractal\n- Laravel + ApiResources\n- Go with Mux\n- AspNet Web Api 2\n- Jersey\n- Elixir\n\n### Client side implementations\n- [Angular](https://github.com/melardev/AngularPaginatedAsyncCrud)\n- [React-Redux](https://github.com/melardev/ReactReduxPaginatedAsyncCrud)\n- [React](https://github.com/melardev/ReactAsyncPaginatedCrud)\n- [Vue + Vuex](https://github.com/melardev/VueVuexPaginatedAsyncCrud)\n- [Vue](https://github.com/melardev/VuePaginatedAsyncCrud)\n\n\n#### The next come are\n- Angular NgRx-Store\n- Angular + Material\n- React + Material\n- React + Redux + Material\n- Vue + Material\n- Vue + Vuex + Material\n- Ember\n- Vanilla javascript\n\n# Social media links\n- [Youtube Channel](https://youtube.com/melardev) I publish videos mainly on programming\n- [Blog](http://melardev.com) Sometimes I publish the source code there before Github\n- [Twitter](https://twitter.com/@melardev) I share tips on programming\n\n\n\n\n# Getting started\nAs with most node js projects, do the following\n1. git clone the project\n2. Rename the .env.example to .env and change the settings according to what you need, I recommend using MySQL, with SQLite you may sometimes have errors.\n3. npm install\n4. npm start\n\n\n# Features\n- Authentication / Authorization\n- Paging\n- CRUD operations on products, comments, tags, categories\n![Fetching products page](./github_images/postman.png)\n- Orders, guest users may place an order\n![Database diagram](./github_images/db_structure.png)\n\n# What you will learn\n- Bookshelf ORM\n    - associations: hasMany, belongsTo, belongsToMany\n    - scopes\n    - virtuals\n    - base\n    - knex\n    - complex queries\n- express\n    - middlewares\n    - authentication\n    - authorization\n- seed data with faker js\n\n- misc\n    - project structure\n    - dotenv\n\n\n# Understanding the project\nThe project is meant to be educational, to learn something beyond the hello world thing we find in a lot, lot of \ntutorials and blog posts. Since its main goal is educational, I try to make as much use as features of APIs, in other\nwords, I used different code to do the same thing over and over, there is some repeated code but I tried to be as unique\nas possible so you can learn different ways of achieving the same goal.\nProject structure:\n- models: Mvc, it is our domain data.\n- dtos: it contains our serializers, they will create the response to be sent as json. They also take care of validating the input(feature incomplete)\n- controllers: well this is the mvC, our business logic.\n- routes: they register routes to router middleware\n- middleware: some useful middleware, mainly the authentication and authorization middleware.\n- config: the database configurer.\n- seeder: contains the file that seeds the database, some developers prefer to generate seed skeleton files and seed the database using knex cli.\nI did not in this case, in the future I will have in my Github page a project like this one but only using Knex.\n- .env the env file from where to populate the process.env node js environment variable\n- public: contains the uploaded files.\n\n# Steps followed to create build this project (incomplete)\n\n- Init knex, this will generate some knexfile.js and migrations \nnode_modules\\.bin\\knex.cmd init\n- Generate migrations for each table we want to create\nnode_modules\\.bin\\knex.cmd migrate:make create_products_categories\n- Run migration files to create tables\nnode_modules\\.bin\\knex.cmd migrate:latest\n- Seed database with:\n`node seeder\\seeds.js`\nor\n`npm run seed`\nnode_modules\\.bin\\knex.cmd migrate:rollback\nnode_modules\\.bin\\knex.cmd seed:make seed_subscriptions\nnode_modules\\.bin\\knex.cmd seed:run\n\n# TODO\n- The app is lacking validation other than basic authentication.\n- Better error handling.\n- Implement transactions in createOrder and createTag and createCategories the least.\n- Use batch functions in seeds for bulk inserts.\n- Review data types of columns, some are only varchar(255) which may not be enough.\n- Refractor the code, either use snake case style or camel case Style, not mix.\n- Better way of loading models, I have seen many implementations that read any files in the models folder and load them,\nit is just a matter of time before I take one of those snippets or write one by my own.\n\n# Resources\n- [Bookshelf scopes](https://www.npmjs.com/package/bookshelf-scopes)\n- [Bookshelf schema](https://bookshelf-schema.readthedocs.io/en/latest/scopes.html#default-scope)\n- [Bookshelf pagination](https://github.com/bookshelf/bookshelf/wiki/Plugin:-Pagination)\n- [Bookshelf base](https://www.npmjs.com/package/bookshelf-modelbase)\n- [Bookshelf virtuals](https://github.com/bookshelf/bookshelf/wiki/Plugin:-Virtuals)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelardev%2Fapiecombookshelfexpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelardev%2Fapiecombookshelfexpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelardev%2Fapiecombookshelfexpress/lists"}