{"id":31131783,"url":"https://github.com/anthonywrather/e-commerce-rails7","last_synced_at":"2025-10-11T04:57:09.964Z","repository":{"id":311202444,"uuid":"1042616304","full_name":"AnthonyWrather/e-commerce-rails7","owner":"AnthonyWrather","description":"This is a testbed for a  simple Rails 7 E-Commerce app.","archived":false,"fork":false,"pushed_at":"2025-09-20T12:55:37.000Z","size":1050,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-20T14:39:21.086Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnthonyWrather.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-22T09:48:00.000Z","updated_at":"2025-09-20T12:27:10.000Z","dependencies_parsed_at":"2025-09-20T14:26:18.182Z","dependency_job_id":"997380c3-6261-4369-9028-0b7e06d9f747","html_url":"https://github.com/AnthonyWrather/e-commerce-rails7","commit_stats":null,"previous_names":["anthonywrather/e-commerce-rails7"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnthonyWrather/e-commerce-rails7","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnthonyWrather%2Fe-commerce-rails7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnthonyWrather%2Fe-commerce-rails7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnthonyWrather%2Fe-commerce-rails7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnthonyWrather%2Fe-commerce-rails7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnthonyWrather","download_url":"https://codeload.github.com/AnthonyWrather/e-commerce-rails7/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnthonyWrather%2Fe-commerce-rails7/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006214,"owners_count":26084063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-18T04:36:29.530Z","updated_at":"2025-10-11T04:57:09.959Z","avatar_url":"https://github.com/AnthonyWrather.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\n* This is a demo project based on a tutorial from Conner Jensen.\n\n\u003e This is the repo that goes along with my Fullstack E-Commerce app tutorial.\n\u003e Check it out here \u003chttps://youtu.be/hURUMwdCWuI?si=YxSO5hpRAESz6rEU\u003e\n\n* About E-Commerce-Rails7\n\nThings you may want to cover:\n\n* Ruby version\n`3.2.2`\n\n* Configuration\nAdd your env variables to the `config/credentials.yml.enc` file. You can do this by running `bin/rails credentials:edit`\n\n* Database creation\nLocally we use sqlite3 as our database. This is already set up for you. In production make sure your `DATABASE_URL` env variable is set. We use PostgreSQL in production.\n\n* Database initialization\nrun `bin/rails db:migrate` to create the tables\n\n* Deployment instructions\nWe deploy on Render create a free account here render.com\n\n* Initial Dev setup\nYou need to build the Tailwind components before you can start the server.\n\n```bash\nbin/rails tailwindcss:build\nbin/rails s\nbin/rails tailwindcss:watch\n```\n\nNext you need to add 1 or more admin users.\n\n```bash\nbin/rails c\n```\n\n```ruby\nAdmin.create(email: \"admin1@example.com\", password: \"12345678\")\nAdmin.create(email: \"admin2@example.com\", password: \"12345678\")\n```\n\nYou might need to install VIPS if running locally.\n\n```bash\nbrew install vips\n```\n\nTo build the Dockerfile you need to run\n\n```bash\ndocker build -f Dockerfile -t e-commerce-rails7 .\ndocker run -p 3000:3000 -v $(PWD):/rails e-commerce-rails7\n```\n\nSetup DevContainers with postgresql\n\nThe devcontainer's are setup but the app is still using sqlite.\n\nChange the app to use postgresql and pgadmin.\n\n```bash\nrails db:system:change --to=postgresql\n\nEDITOR=\"code --wait\" rails credentials:edit\n```\n\nThe pgadmin web interface can be found here \u003clocalhost:15432\u003e and needs user(postgres)/password(postgres)/host(postgres).\n\nYou can also run pgadmin locally and connect via \u003clocalhost:5432\u003e\n\nAdded the VSCode extensions to autoload.\n\n```json\n// Configure tool-specific properties.\n\"customizations\": {\n  // Configure properties specific to VS Code.\n  \"vscode\": {\n    // Set *default* container specific settings.json values on container create.\n    \"settings\": {},\n    \"extensions\": [\n      \"streetsidesoftware.code-spell-checker\",\n      \"ms-azuretools.vscode-containers\",\n      \"p1c2u.docker-compose\",\n      \"aliariff.vscode-erb-beautify\",\n      \"github.vscode-github-actions\",\n      \"mohd-akram.vscode-html-format\",\n      \"oderwat.indent-rainbow\",\n      \"bierner.markdown-preview-github-styles\",\n      \"ms-ossdata.vscode-pgsql\",\n      \"esbenp.prettier-vscode\",\n      \"shopify.ruby-lsp\",\n      \"castwide.solargraph\",\n      \"hoovercj.ruby-linter\",\n      \"misogi.ruby-rubocop\",\n      \"miguel-savignano.ruby-symbols\",\n      \"bradlc.vscode-tailwindcss\",\n      \"austenc.tailwind-docs\",\n      \"zarifprogrammer.tailwind-snippets\",\n      \"heybourn.headwind\",\n      \"gruntfuggly.todo-tree\",\n      \"redhat.vscode-yaml\",\n      \"vscode-icons-team.vscode-icons\",\n      \"davidanson.vscode-markdownlint\",\n      \"hridoy.rails-snippets\",\n      \"kaiwood.endwise\",\n      \"manuelpuyol.erb-linter\"\n    ]\n  }\n}\n```\n\nRobocop playtime...\n\n```bash\n# Run the safe only cops.\nrubocop -a\n\n# Run the safe and unsafe cops.\n# Beware there are dragons in there...\nrubocop -A\n\n# To run only a set of the cops.\nrubocop --only Style/Documentation\n\n# To run and fix just a set of cops.\nrubocop --only Style/FrozenStringLiteralComment -A\n```\n\nThe final rubocop.yml file is\n\n```yml\n# The behaviour of RuboCop can be controlled via the .rubocop.yml\n# configuration file. It makes it possible to enable/disable\n# certain cops (checks) and to alter their behaviour if they accept\n# any parameters. The file can be placed either in your home\n# directory or in some project directory.\n#\n# RuboCop will start looking for the configuration file in the directory\n# where the inspected file is and continue its way up to the root directory.\n#\n# See https://docs.rubocop.org/rubocop/configuration\n\nAllCops:\n  NewCops: enable\n  SuggestExtensions: false\n\nStyle/Documentation:\n  Enabled: false\n\nLayout/LineLength:\n  Enabled: false\n\nMetrics/BlockLength:\n  Enabled: false\n\nMetrics/AbcSize:\n  Enabled: false\n\nMetrics/MethodLength:\n  Enabled: false\n\nMetrics/PerceivedComplexity:\n  Enabled: false\n\nMetrics/CyclomaticComplexity:\n  Enabled: false\n\n# Examine these changes to see what breaks.\nStyle/ClassAndModuleChildren:\n  Enabled: false\n\nStyle/ConditionalAssignment:\n  Enabled: false\n\nStyle/IfUnlessModifier:\n  Enabled: false\n\nStyle/SafeNavigation:\n  Enabled: false\n\nStyle/SlicingWithRange:\n  Enabled: false\n\nLint/NonLocalExitFromIterator:\n  Enabled: false\n```\n\nChanged the currency from USD to GBP\n\nAdd a price to the stock record so each variant can have its own price.\n\n```bash\nbin/rails generate migration AddPriceToStock\n```\n\nAdd an amount to the product record so that a single priced item can have a stock level.\n\n```bash\nbin/rails generate migration AddAmountToProduct\n```\n\nAdd a price to the order_products table so we can record the line item prices.\n\n```bash\nbin/rails generate migration AddPriceToOrderProducts\n```\n\nAdd a Name to the Orders table.\n\n```bash\nbin/rails generate migration AddNameToOrderOrders\n```\n\nAdded Render to Slack integration so there is a notification of each deployment.\nWell that's the strategy....\n\nFixed various bugs and added various features.\n\nAdding ssh to the Render test server.\nCreate the local ssh key.\n\n```bash\nssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_docker\n```\n\nUpload the SSH key to render.\n\nTo connect use\n\n```bash\nssh -i ~/.ssh/id_ed25519_docker srv-d2mv4qp5pdvs739c15mg@ssh.frankfurt.render.com\n```\n\n## Setup the Stripe Sandpit WebHook for development and testing\n\nSetup the Stripe sandpit for Test\nIn Stripe remember to add /webhooks to the target endpoint.\nGet the secret key and webhook key for the app.\nAdd them to Render as env variables.\n\nSetup the Stripe Sandpit for your local Dev Env.\nGet the secret key and webhook key for the app and add them to credentials.enc\nInstall NGROK on your LOCAL system. MacOS for me, your may vary.\nAdd your NGROK secret key.\n\n```bash\nbrew install ngrok\nngrok config add-authtoken YOUR_NGROK_TOKEN\n```\n\nSetup your local to remote connection.\\\nThis must be run on your local machine.\\\nYour URL will be different..... yea honest lol\n\n```bash\nngrok http --url=loved-anchovy-on.ngrok-free.app 3000\n```\n\nAnd add the host to config/environments/development.rb\n\n```ruby\n  config.hosts \u003c\u003c \"loved-anchovy-on.ngrok-free.app\"\n```\n\nMore information can be found here.[NGROK Stripe documentation.](https://ngrok.com/docs/integrations/stripe/webhooks/)\n\nAdd foreman to the gems to run in both the Rails server monitoring the Ruby code and tailwind looking after the Javascript and assets dev mode.\n\n```bash\nbin/dev\n```\n\nInstall and configure letter_opener gem for local email testing.\\\n\u003chttps://github.com/ryanb/letter_opener\u003e\\\n\u003chttps://github.com/fgrehm/letter_opener_web\u003e\n\nAnd it can be accessed on the localhost\\\n\u003chttps://loved-anchovy-on.ngrok-free.app/letter_opener\u003e\n\nOr in the Test machine\\\n\u003chttps://e-commerce-rails7.onrender.com/letter_opener\u003e\n\n```bash\nbin/rails g mailer OrderMailer new_order_email\n```\n\nTo send an email directly from the Rails console.\n\n```ruby\nActionMailer::Base.mail(\n  from: \"test@example.co\",\n  to: \"test@anthonywrather.me.uk\",\n  subject: \"Test Subject\",\n  body: \"Test email body.\"\n).deliver_now\n```\n\nGenerate the Reports screens.\n\n```ruby\nrails generate controller admin::reports index\n```\n\nGenerate the Product Image Delete action.\n\n```ruby\nrails generate controller admin::images destroy\n```\n\n```ruby\nrails generate controller quantities index\nrails generate stimulus quantities\n```\n\n## Mat Calculation\n\n* Area = Width x Length\n* Total Area = A1 + A2....\n\nRequired Weight of Mat\n\n* Select g/m2 of cloth + Roll Width\n* Total Weight (kg) = Total Area (m2) \\* Mat Weight (g/m2) \\* Number of Layers\n\nRequired Length of Mat\n\n* Required Length (m) = (Total Area (m2) \\* Number of Layers) / Roll Width (m)\n\nAdd 10% to 15% to the Mat for wastage, overlap and feathering.\n\n* Total Length (m) = Required Length (m) \\* 1.15\n\n## Enable file sharing with the local docker pgadmin container\n\npgadmin saves it export files to\n\n```bash\n/var/lib/pgadmin/storage/admin_pgadmin.com\n```\n\nSo this needs to be mounted from the local dev system.\n\nEdit the docker-compose.yml\n\n```docker\n      - ../storage/pgadmin/backups:/var/lib/pgadmin/storage/admin_pgadmin.com/backups\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonywrather%2Fe-commerce-rails7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonywrather%2Fe-commerce-rails7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonywrather%2Fe-commerce-rails7/lists"}