Giter Site home page Giter Site logo

octovolt-website's Introduction

Octovolt Website

This is the Octovolt website hosted at https://octovolt.xyz, which is based on Next.js and utilizes TypeScript, React and Node.js. The site is primarily an e-commerce site, but it also has pages for a blog. In the future, I hope to add JavaScript experiments; CSS, JS, and WebGL artwork; web based utilities for making music or working with my products; and maybe some other dark corners.

It was originally a Next.js project bootstrapped with create-next-app, but I have modified it a bit since that initial bootstrap.

I hope that by publishing this code on GitHub it might (eventually) serve as an example of how to build an e-commerce site from scratch without needing to pay exorbitant prices to a third party for hosting and/or the management of transactions. Ideally, this would free people to create more readily profitable microbusinesses and hobby businesses, rather than operating at a loss due to the cost of e-commerce.

Getting Started

First, run the development server:

npm run dev

The site will now be viewable at http://localhost:3000.

Second, run the proxy for HTTPS:

npx local-ssl-proxy --config local-ssl-proxy-config.json

Open https://localhost:3001 with your browser to see the result.

Custom Markdown Parsing with Remark

The custom Markdown parsing is encapsulated as a Remark plugin in the src/lib/remarkUtils.ts file. The purpose of this custom parsing is to allow me to write Markdown for external links that open in a new tab, and to include an associated "external link" icon with those links.

Product Catalog and Blog

A new product gets added to the catalog by adding a Markdown file to src/markdown/products. Similarly, a new blog post gets added by adding a new Markdown file within src/markdown/posts. See src/lib/products.ts and src/lib/posts.ts to understand how these Markdown files are parsed and presented in the UI, in addition to the src/app/products and src/app/news directories.

Local Storage Shopping Cart and State Management

The shopping cart is implemented with local storage. I did consider using cookies and a server side data store, but this would have been even more complicated, required a cookies disclaimer, etc. And it's not clear to me that this would be superior in any way.

The cart utilizes the Flux state management pattern of declarative actions, a reactive store and a reactive UI, but implements it with useReducer and useContext, similar to the React documentation examples. Since the amount of state is small, this works pretty well. If this becomes more complex I will need to use something like Redux or perhaps roll my own event-driven solution.

See src/lib/cartReducer.ts for most of the code related to state management. This is added to the client code in src/app/components/body.tsx.


TODOs

Contact Form

I was not able to get the contact form to work locally. I'm hopeful that I'll have better luck once it's deployed to a real server.

E-commerce

I hope to calculate shipping on the fly with an API call to FedEx.

I am going to include both PayPal and Credit Card options. I hope to power the Credit Card payment with Stripe, but I would use whatever service is cheapest and yet works with international payments. If you have a better suggestion, please let me know.

Again, I think all of this will be easier to develop on a live server rather than locally.

Super Secret Stuff

Obviously, I can't share a bunch of my own sensitive info in this repo. So all of that will need to be in a file or two outside of the repo and referred to with environment variables or something. This is not yet set up.

octovolt-website's People

Contributors

octovolt avatar

Watchers

 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.