Skip to content

Full stack mock e-commerce store. Built with Node.js, Stripe, GraphQL & Next.js

License

Notifications You must be signed in to change notification settings

luke-h1/storify

Repository files navigation

CI / build & test

Storify

A mock e commerce store built to learn clean GraphQL schema design, database relationships & React

📌 Table of contents

🚀 Features

  • User registration, login & authentication flow with forgot password & password resets
  • Full product creation user flow (with Stripe integration)
  • Full Cart management flow
  • Create and cancel orders (with Stripe integration)
  • Add reviews to products
  • Admin utilities (manage products, users & orders on the service)

👷 Getting Started

You will need to install the following in order to get this project up & running locally

Dependency management with Lerna & yarn workspaces

The project currently uses Lerna and Yarn workspaces to manage dependencies. This project follows a monorepo structure and should be treated as such. This means that when installing new dependencies or bootstraping the project for the first time, you should not run yarn install in a given sub-project's directory. Any new dependencies should be directly added to sub-project package.json and you should then run yarn in the root directory to install these new dependencies.

Install Dependencies

yarn

Setting up environment variables

Both the frontend and api project have a .env.example which provides an example of what .env variables are required & their type (i.e. string, number etc). If you fail to provide these values, the frontend & api will fail to start.

Create your environment variables based on the examples of the relevant .env.example

cp -r .env.example .env 

Setting up Redis & Postgres

You must install Docker in order to run Redis & Postgres. Make sure you have filled the environment variables related to Postgres & Redis correctly and then run the following to start Redis & Postgres.

docker-compose up 

Now that the databases are started we can start the API for the first time.

Run the following commands to start the API (ensure the databases are running):

This command transpiles Typescript to Javascript:

yarn watch

Open up a new terminal & cd into the api folder

Start the API in a development environment:

yarn dev 

The backend will now be listening on http://localhost:<PORT>/api/graphql(migrations are automatically ran if needed)

If you want to seed the database there is a seed available which will seed the local database with 24 users & 24 products. Simply run yarn seed in the api folder (with the databases running) in order to seed your local database

running migrations

If you make any changes to the database schema you will need to generate migrations in order to apply your changes to the dataase.

To create a new migration (in the api project):

yarn migrate:gen

To run these migrations against your local database (in the api project):

yarn migrate:up 

To revert these changes & rollback the migration:

yarn migrate:down 

📮 FAQ

Question What tech is used in this Project?

Answer: Node.js, Apollo server, TypeGraphQL, Redis, Stripe, Next.js, TailwindCSS, URQL, [AWS] (https://aws.amazon.com/)

Question Why use GraphQL & not REST?

Answer: While I could've chosen to write this API purely in a RESTful manner, this would've extended the amount of time spent on this project significantly. This project uses GraphQL codegen which significatlly cut down the amount of development & testing resource it would've taken to manually write hooks & manage state.

🐛 Issues

Feel free to file a new issue with a respective title and description in the Storify repository. If you already found a solution to your problem, Feel free to make a PR! Have a look at the contribution guidelines to find out about the coding standards.

🎉 Contributing

Check out the contributing page to see the best places to file issues, start discussions and begin contributing.

📕 License

This project is licensed under the Apache 2 license.

Made with love by Luke Howsam 💜 🚀💥

About

Full stack mock e-commerce store. Built with Node.js, Stripe, GraphQL & Next.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages