Table of Contents
MVP for electronic e-commerce store.
Site is live, but payments and shipping are not active yet!
You're looking for electronics? We have a wide variety of electronics for all your needs. From computers to cameras to cell phones, we have you covered. And don't let our low prices fool you – these aren't your average products! Our e-Renaissance certified gadgets offer great quality and won't break the bank.
We are a leading online electronics store that is committed to providing the best customer service. We offer a wide range of products including mobile phones, laptops, televisions and much more. Our team of experts will guide you through the process of making your purchase and offer you advice on how to take care of your new device.
The MVP was heavily inspired by this Figma design. Our MMP design is inpsired by Amazon/BestBuy single page design.
This is an example of how you go about setting up our project locally. To get a local copy up and run follow these simple example steps.
- Node.js
- Git
- Stripe: Account, Secret & Publishable key
- Cloudinary: Account Secret Key & Product Images
- MongoDB Atlas: MongoDB Account & Secret Key
-
Clone the repo into the desired folder
git clone https://github.com/kbventures/ecommerce.git
-
Go to cloned folder
cd ecommerce
-
Install NPM packages into both client and server folders
cd client npm install cd ../server npm install
-
Change client fetch URL from https://erenaissance-backend.vercel.app/api/products to your localhost or your provider http://localhost:4001/api/products;
// client/src/contexts/Itemscontext.jsx useEffect(() => { const fetchItems = async () => { // change fetch to: //// http://localhost:4001/api/products; const response = await fetch( `https://erenaissance-backend.vercel.app/api/products` ) const json = await response.json(); setItems(json); }; fetchItems();
// client/src/routes/Basket/index.jsx async function handleSubmit(e, basket) { e.preventDefault(); // change fetch to: // http://localhost:4001/api/create-checkout-session const url = await fetch( "https://erenaissance-backend.vercel.app/api/create-checkout-session",; { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(basket), } ).then((i) => i.json()); window.location.href = url; }
-
Change Server URLS
// server/src/app.ts app.post( '/api/create-checkout-session', async (req: Request<any, any, LineItem[], any>, res: Response) => { console.log(req.body); const products = req.body.map((e) => ({ price: e.default_price?.id, quantity: 1, })); const session = await stripe.checkout.sessions.create({ line_items: products, mode: 'payment', // Change to : // success_url: "http://localhost:8080/home", // cancel_url: "http://localhost:8080/", success_url: 'https://erenaissance-frontend.vercel.app/home', cancel_url: 'https://erenaissance-frontend.vercel.app/', }); res.json(session.url); }
-
Add .env file inside server directory
MONGO_URI = YOUR_SECRET_KEY;
STRIPE_SECRET = YOUR_SECRET_KEY;
PUBLISHABLE_KEY = YOUR_SECRET_KEY;
SECRET = YOUR_SECRET_KEY;
- Start Client
cd client npm run dev
- Start Server
cd .. cd server npm run dev
- Go to http://localhost:8080/ if you wanna see client, or http://localhost:4001/api for server
cd server
npm run test
cd server
npm run build
cd client
npm run build
As a team we learned to work continuously and asynchronously on designing, developing, testing, and deploying a full stack application with Stripe third party integration. We expanded our knowledge of React, Express.js, MongoDB, Node.js, Webpack, several deployment solutions, CI/CD, using Vercel's development preview branch, mono repos, automated testing, Typescript, documentation, linting, coordinating as a team, code reviews, CSS Modules, GitHub Primer's CSS design systems, communication, UX/UI design, Figma, and managing a project(Github project).
- MVP
- [] MMP
- Implement new Figma design
- Improve accessibility, performance & SEO metrics
- Automated testing
- Move front end to Typescript
- Client sign up
- Client login, logout & authentication
- Client dashboard features
- Back services to support authentication and client routes
See the open issues for a full list of proposed features (and known issues).
-
Clone the repository with this command if you don't have it:
git clone https://github.com/kbventures/ecommerce.git
-
Run the following command to make sure you have the latest changes on the main branch
git pull
-
Create a new feature branch with a descriptive name and only make your changes here. For example, to add this README documentation I would call this branch
add-git-workflow
.git checkout -b <your feature branch name>
-
Make as many changes as you need in your feature branch. You can use the following commands per commit message - or add the individual files instead of using the .
git add . git status git commit -m <your commit message>
-
Once your feature is ready and you're ready to merge into the main branch first make sure to push your local branch changes to GitHub.
git push --set-upstream origin <your feature branch name>
-
Go to https://github.com/kbventures/ecommerce/branches and you should see your newly pushed feature branch. Find and click the button, "New pull request", to request that your changes be "pulled" into the main branch.
-
When you click the button, complete the form required for each pull request and click "Create pull request".
-
In the top right corner, click "Reviewers" and add one person on the team as the Reviewer for the pull request.
-
Once the Reviewer has looked at your pull request and verified that everything is OK, they will merge your pull request into the main branch.
-
From within your feature branch, fetch the latest changes from the main branch
git fetch origin main
-
Rebase so that your feature branch history is stacked on top of the latest main branch history
git rebase origin/main
-
Now resolve the conflicts manually in your code editor one at a time. Git will tell you which files have a conflict. Once you've resolved the conflicts run the following commands:
git add . git rebase --continue
-
Write and save a commit message if all conflicts are resolved.
-
Push your rebased feature branch changes to GitHub's computers.
git push -f origin <your feature branch name>
-
Go back to your pull request on Github your pull request should have no conflicts and you can merge into the main branch!
Also, don't forget the most important rule of rebasing:
NEVER REBASE ON A REMOTE BRANCH >
Why do we care to write a good commit message? A well-crafted Git commit message is the best way to communicate context about a change to other developers working on that project, and indeed, to your future self.
A commit has two parts: a subject (max 50 characters) and a description. Use the following command to separate a subject from the description.
git commit -m "Subject" -m "Description..."
In each commit message:
-
Specify the type of commit in the subject. Example:
Feat: create landing page
.- feat: The new feature you're adding to a particular application
- fix: A bug fix
- style: Feature and updates related to styling
- refactor: Refactoring a specific section of the codebase
- test: Everything related to testing
- docs: Everything related to documentation
- chore: Regular code maintenance.
-
Separate the subject from the body
-
Remove whitespace errors
-
Remove unnecessary punctuation marks
-
Do not end the subject line with a period
-
Capitalize the subject line and each paragraph
-
Use the body to explain what changes you have made and why you made them.
-
Do not assume the reviewer understands what the original problem was, ensure you add it.
-
Do not think your code is self-explanatory
We are grouping by feature as listed in React docs. See Grouping by features or routes
We are using ESLint with Airbnb rules, alongside Prettier to format code and follow modern standards when writing Javascript. In addition, we can minimize runtime errors.
Distributed under the MIT License. See LICENSE for more information.
Dmitry Kulakov - @atomeistee - [email protected]
Enrick Andersen Ong - @rickansen
Ken Beaudin - @kb9700
Abdhul Shabbir - @abdulshabbirdev
Jennie Allen - @jenanemone