Skip to content

A Medusa Commerce, Remix.run, and Gatsby mono-repo that contains the admin interface, public storefront, and medusa backend for the Montessori Woodshop's online shopping experience. Deployed using Cloudflare Pages and Render

Notifications You must be signed in to change notification settings

the-montessori-woodshop/the-montessori-woodshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medusa

The Montessori Woodshop

The Montessori Woodshop is a family owned and operated woodshop that specializes in hand made montessori style furniture and toys that puts an extreme focus on craftsmanship, sustainability, and generational sustainability.

Getting Started

  • TBD

Environment Variables

Category Name Platforms
Build NODE_ENV Used for build time development
Admin GATSBY_MEDUSA_BACKEND_URL API URL for access
Medusa JWT_SECRET Secret for authentication
Medusa COOKIE_SECRET Secret for cookie transmission
Medusa MEDUSA_PORT API Port for access
Medusa MEDUSA_ADMIN_CORS URL of Admin Application
Medusa MEDUSA_STORE_CORS URL of Storefront Application
Medusa MEDUSA_REDIS_HOST Redis URL
Medusa MEDUSA_REDIS_PORT Redis Port
Medusa MEDUSA_STRIPE_API_KEY Secret for Stripe Access
Medusa MEDUSA_STRIPE_WEBHOOK_SECRET Secrete for Stripe Webhook Access
Medusa CLOUDFLARE_IMAGE_API_TOKEN Token to upload images to CF
Medusa CLOUDFLARE_IMAGE_HASH Image account hash
Cloudflare CLOUDFLARE_ACCOUNT_ID Token used for CI deployments to CF
Cloudflare CLOUDFLARE_API_TOKEN_WORKERS Token used for CI deployments to CF
Cloudflare CLOUDFLARE_API_TOKEN_PAGES Token used for CI deployments to CF
Auth0 WOODSHOP_AUTH0_API_ISSUER Issuer of ID
API WOODSHOP_API_DATABASE_URL URL of Database*
API WOODSHOP_API_MIGRATE_DATABASE_URL Migration URL when developing
Auth0 WOODSHOP_AUTH0_AUDIENCE Audience of the API
Auth0 WOODSHOP_AUTH0_DASHBOARD_CALLBACK_URL Callback URL after Code Grant
Auth0 WOODSHOP_AUTH0_DASHBOARD_DOMAIN Domain of code grant
Auth0 WOODSHOP_AUTH0_DASHBOARD_CLIENT_ID Auth0 Client ID
Auth0 WOODSHOP_AUTH0_DASHBOARD_CLIENT_SECRET Auth0 Client Secret
Auth0 WOODSHOP_AUTH0_API_ISSUER Issuer of ID

NODE_ENV

Should be set to either development or production. This tells the application at build time what target it's building for. This can be set either in the .env file or on the path of the process will be using it. The later is the most important.

Packages Used

Platforms

  • Github Actions (migrate)
  • Github Actions (deploy)

GATSBY_MEDUSA_BACKEND_URL

Packages Used

Platforms

  • Github Actions (deploy)

JWT_SECRET

MEDUSA_PORT

MEDUSA_ADMIN_CORS

MEDUSA_STORE_CORS

MEDUSA_REDIS_HOST

MEDUSA_REDIS_PORT

MEDUSA_STRIPE_API_KEY

MEDUSA_STRIPE_WEBHOOK_SECRET

CLOUDFLARE_IMAGE_API_TOKEN

This token is created on the Cloudflare dashboard and is then used with the Medusa API to enhance the admin function for how images are stored. This is also used for the woodshop api to manage images that are going to be used inside of the blog and website.

Packages Used

Platforms

  • .env
  • Render
  • Wrangler

CLOUDFLARE_IMAGE_ACCOUNT_HASH

Packages Used

Platforms

  • Render

CLOUDFLARE_ACCOUNT_ID

This is the token that is used to tell wrangler what account it should be targeting when running wrangler commands. This can go on the path of the process that is executed from yarn / npm scripts.

Packages Used

Platforms

  • Github Actions (deploy)

CLOUDFLARE_API_TOKEN_WORKERS

This is the token that is used to use with the wrangler CLI to upload cloudflare workers assets to the Cloudflare network.

Packages Used

Platforms

  • Github Actions (deploy)

CLOUDFLARE_API_TOKEN_PAGES

This is the token that is used to use the direct upload feature of angular to deploy static assets and function folders to cloudflare pages. This token is used in Github Actions and included on the path of the script that is used to kick off of the wrangler CLI.

Packages Used

Platforms

  • Github Actions (deploy)

WOODSHOP_API_DATABASE_URL

This URL is the environment variable that is used to tell Prisma where it should be connecting to the DB. This is a single environment variable that changes depending upon how it's used and where it is used. Since we're only using this database in the serverless environment, we need to make sure it is added to wrangler and that's done a little differently than putting it on the path of the process.

However, this is also needed when migrating the DB in CI so this should also go on the path when running the migrate commands

Packages Used

Platforms

  • Github Actions (migrate)
  • Wrangler (development)
  • Wrangler (production)

WOODSHOP_API_MIGRATE_DATABASE_URL

This URL is used only when developing locally. Since (as of this moment) the local workflow is using the Prisma data proxy, we cannot use the data proxy URL to migrate the DB. Instead we must use the external query string of the

WOODSHOP_API_SHADOW_DATABASE_URL

WOODSHOP_AUTH0_AUDIENCE

Packages Used

Platforms

WOODSHOP_AUTH0_DASHBOARD_CALLBACK_URL

Packages Used

Platforms

  • Pages EnvVars

WOODSHOP_AUTH0_DASHBOARD_CALLBACK_URL

Packages Used

Platforms

  • Pages EnvVars

WOODSHOP_AUTH0_DASHBOARD_DOMAIN

Packages Used

Platforms

  • Pages EnvVars

WOODSHOP_AUTH0_DASHBOARD_CLIENT_ID

Packages Used

Platforms

  • Pages EnvVars

WOODSHOP_AUTH0_DASHBOARD_CLIENT_SECRET

Packages Used

Platforms

  • Pages EnvVars

WOODSHOP_AUTH0_API_ISSUER

Packages Used

Platforms

Deployment

Below is a matrix of where each of the solutions are deployed

Category Service Method CF Pages CF Workers Render Prisma Studio
Medusa API Redis 1-Click X
Medusa API Postgres 1-Click X
Medusa API NodeJS API 1-Click X
Storefront Remix GH Action X
Admin Gatsby 1-Click X
Woodshop API Postgres (Dev) 1-Click X X
Woodshop API Postgres (Prod) 1-Click X X
Woodshop API Postgres Shadow DB
Woodshop API Serverless API GH Action X
Docs Components GH Action X (sites)

Development

Starting all of the services

  1. Create .env file at / (refer to the values in the .env-sample)
  2. Create .env file at /packages/woodshop-api/ (refer to the values in the .env-sample)
  3. Run docker-compose up -d to:
    • Create the Medusa API PostgreSQL DB and run migrations and seed scripts
    • Create the Medusa API Redis cache and link it to the DB instance
    • Build and run the Medusa Administrator console

Woodshop API

The below command will do the following:

  • Generate a Prisma Client that can be consumed in your code
  • Start the wrangler serverless service
  • Listen for changes in the packages/woodshop-api/src folder
yarn api-dev

Migrations

Developing the schema without making a migration

yarn api:push

Creating a migration

Due to the limitations of the Prisma DataProxy, you'll need to switch the WOODSHOP_API_DATABASE_URL to the direct query string of the database instead of the proxied URL. Also ensure that your ShadowDB is running using docker compose.

yarn api:migrate-dev

Storefront

The below command will start the remix server using miniflare. Any changes that are made will automatically update the code and the page will refresh.

yarn dev

Components

The below command will start up the Storybook solution so any components can be created in isolation.

yarn components-dev

Once you're satisfied with your components, in order to make sure that the Remix app can consume them, you'll need to run the below:

yarn components-build

About

A Medusa Commerce, Remix.run, and Gatsby mono-repo that contains the admin interface, public storefront, and medusa backend for the Montessori Woodshop's online shopping experience. Deployed using Cloudflare Pages and Render

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published