GithubHelp home page GithubHelp logo

benjamin-roger / shoppingify-dev-challenge-next.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 253 KB

Take on Shoppingify from devchallenge.io

Home Page: https://shoppingify-dev-challenge.vercel.app

JavaScript 89.84% SCSS 9.70% CSS 0.13% Pug 0.33%

shoppingify-dev-challenge-next.js's Introduction

Shoppingify

Solution for a challenge from Devchallenges.io.

This repo is my take on the Shoppingify dev challenge.

It has been built with React and Next.js, runs on Vercel with a MongoDB database. It is rendered mostly client-side, with API exposed on a separate server.

How to use

Clone this repo to your folder.

Database settings

Create a MongoDB database.

Create 3 collections :

  • lists
  • items
  • users

Create a few items with the following structure

    {
        "_id": "5f9fb2318e7d6fb94515ccd9",
        "name": "Avocado 2kg",
        "category": "Vegetables",
        "amount": 1,
        "note": "Hello avocado",
        "image": "https://i.imgur.com/zPu5pXI.jpeg"
    }

Environment variables

Create a .env file at the root of the folder "api" with 4 environment variables

PORT=8000
MONGODB_CONNECTION_STRING={{your MongoDB connection string}}
JWT_SECRET={{your JWT secret}}
JWT_EXPIRES_IN={{your JWT expiration duration (example : 24h)}}

Create a .env.local file at the root of the folder "client" with 1 environment variable

BASE_API_URL='http://localhost:8000'

Launch the API app

In the /api folder, run

npm i

npm start

It will open the webserver, to serve the API requests on http:localhost:8000

Launch the client app

Open a separate command window. In the /client folder, run

npm i

npm run dev

It will open the client app itself, available on http:localhost:3000

Deploy your own

Deploy the example using Vercel:

API app

Run the API app on your preferred host.

Client app

Deploy with Vercel

Be careful to add the environment variables !

shoppingify-dev-challenge-next.js's People

Contributors

benjamin-roger avatar

Watchers

James Cloos avatar  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.