Giter VIP home page Giter VIP logo

coding-challenge-backend's Introduction

Project Description: Building a Node.js REST-API for Product Management

Overview:

Create a robust Node.js REST-API for product management, providing full CRUD (Create, Read, Update, Delete) functionality for products. The API will be built using your choice of Node.js framework and MongoDB as the database. The product schema must include essential fields such as name, category, price, and availability. Additionally, the project must integrate features like pagination, search, purchase tracking, and external API integration.

Key Features:

  1. Product CRUD Operations: Implement Create, Read, Update, and Delete operations for products, ensuring that the product schema includes essential fields like name, category, price, and availability.

  2. Pagination and Search: Integrate pagination for the Read operations, allowing users to specify the page number and items per page. Implement a search feature to filter products based on various criteria such as name, category, or price.

  3. Purchase Endpoint: Create an endpoint to purchase a product, tracking the purchase details (e.g., product purchased, date, and user).

  4. Aggregation for Purchase Stats: Implement a MongoDB aggregation endpoint, /purchase/stats, to provide statistics on product purchases. Users should be able to retrieve purchase data, such as total purchases, top-selling products, or purchase trends.

  5. External API Integration: Integrate an external API, specifically the Random Data API, to fetch credit card data. Filter the data to exclude credit card numbers and limit the type of credit cards to Visa. Consider customizing the size of the returned data.

  6. Database Model: Exercise creativity in designing the database model. You have the freedom to structure the database schema to suit the project's needs efficiently.

  7. Containerization with Docker [Optional]: Containerize both the application and MongoDB using Docker. Create a Docker Compose configuration to ensure smooth deployment and management of the services.

  8. Authentication and Authorization (Extra Points)[Optional]: Implement JWT-based authentication and authorization to secure specific routes. Some routes, like purchasing or managing products, should be accessible only to authenticated and authorized users.

  9. Linting: Use a linter (e.g., ESLint) to enforce code quality and consistency throughout the project.

Documentation and GitHub:

  • Provide thorough documentation in a README file, detailing how to set up, run, test ...ect

  • Explain the database schema and model design choices.

  • Describe how to use the API endpoints and provide example requests and responses.

  • Include information on integrating and running the Docker containers.

  • If you choose to implement authentication, document the authentication process.

  • Push your code to a public GitHub repository for version control and collaboration.

CI/CD Consideration [Optional]:

While it's encouraged to use GitHub Actions for continuous integration and deployment (CI/CD).

And suit yourself to add any features or utilize any tools you believe add value, solve specific problem, boost performance or even enhance development experience


Just have fun and be creative ๐Ÿ˜Ž


Dependencies:

You might user docker-compose or run locally with node and npm. Tested node version is: >=18.

Create your .env file: Create a new file called .env and pass the data from the variables from .env.examples. PS: Current secret variables are for testing purposes only; no need to worry!.

To run locally with node:

# install all dependencies
npm install
# start server
npm start

To run with docker-compose:

# to build your docker image
docker-compose build
# to run your built docker image
docker-compose up
# or simply run
docker-compose up -d

To check your .js files with eslint:

npm run lint:fix

Test the API with Postman:

Run in Postman

Usage of postman consists of two seperate collections; one for local development, and one for staging environments.

Remaining features:

  • Add more stats,
  • Use an external data api,
  • Deploy on a web server,
  • Add CI/CD,

coding-challenge-backend's People

Contributors

arka-cell avatar dev-mus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.