{"id":21873948,"url":"https://github.com/aguxez/ecom","last_synced_at":"2026-04-19T13:31:16.475Z","repository":{"id":136977225,"uuid":"120822162","full_name":"aguxez/ecom","owner":"aguxez","description":"Template to build a \"custom\" Ecommerce website using Elixir and Phoenix","archived":false,"fork":false,"pushed_at":"2018-04-25T02:13:37.000Z","size":597,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T23:17:07.984Z","etag":null,"topics":["ecom","ecommerce","elixir","phoenix"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aguxez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-02-08T21:49:12.000Z","updated_at":"2020-01-14T19:19:20.000Z","dependencies_parsed_at":"2023-04-03T19:47:55.552Z","dependency_job_id":null,"html_url":"https://github.com/aguxez/ecom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aguxez/ecom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguxez%2Fecom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguxez%2Fecom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguxez%2Fecom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguxez%2Fecom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aguxez","download_url":"https://codeload.github.com/aguxez/ecom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguxez%2Fecom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32009025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","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":["ecom","ecommerce","elixir","phoenix"],"created_at":"2024-11-28T07:10:01.874Z","updated_at":"2026-04-19T13:31:16.458Z","avatar_url":"https://github.com/aguxez.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ecom [![Build Status](https://travis-ci.org/aguxez/ecom.svg?branch=master)](https://travis-ci.org/aguxez/ecom)\n\n### Template to start building an Ecommerce on Elixir and Phoenix.\n\n#### Done\n\n1. Users context with password hashing using Argon2.\n2. Users can login and logout using Guardian.\n3. Users can register, using a simple client-side verification and one server-side.\n4. Users get recognized between admin and normal.\n5. Admin can add/delete/edit product.\n6. Spanish and English supported based on Locale.\n7. Support for Markdown.\n8. Support for adding pictures to Product. (Locally for now)\n9. Shopping cart added. Users can add, edit, remove products, when an unlogged user logs in, the items that are NOT in the user's db cart are added and the session cart is deleted.\n10. Payments\n11. Shipping (User addresses)\n12. Orders\n\n### Being worked ATM\n**Nothing at the moment**\n\n### TODO\n1. SEO tags\n2. Flexible configuration\n3. Wishlist (Optional for now)\n\n### Dev TODO\n- [x] There's a bug where `Repo.preload/2` raises an ArgumentError on tests; specifically \"cannot load `[]` as type :map for field `products` in schema Ecom.Accounts.Cart\" but it works on dev.\n\n- [x] Do proper cleanup when payment is made (Value state, Product quantity, etc...)\n\n- [x] Add amount of order and order \"receipt\" to Admin dashboard once a payment is done.\n\n- [ ] Do new incorporation of Paypal (Or any other payment gateway, honestly), right now it's being used as a client-side with a websockets solution for validation.\n\n### Running\n\n```sh\n-\u003e git clone https://github.com/aguxez/ecom.git\n-\u003e cd ecom\n-\u003e mix do deps.get, compile\n-\u003e cd apps/ecom\n-\u003e mix ecto.setup\n-\u003e cd ../ecom_web/assets\n-\u003e yarn\n```\n\nAdd something to  `seeds.exs` and then `mix run priv/repo/seeds.exs`\n\n`iex mix -S phx.server` and go to localhost:4000\n\n### Notes:\n#### Local uploads\nFor local uploads, the folder being used is `/var/www/uploads/product/image/`, if you want to remove this, edit `Ecom.Uploaders.Image.storage_dir/2` and the `Plug` serving these files on `endpoint.ex`.\n\n#### Payment solution for this [commit](https://github.com/aguxez/ecom/commit/42d5ca76f69ef705113db8b04c36e5b7b997937b)\nThere was a lot to think here. I wanted to take the approach of just using a simple \"Pay\" button from PayPal that had information on inputs on the front-end, obviously this is a security flaw and I wanted to take care of that (At this exact moment I don't have access to a 'live' PayPal token, hence I couldn't just use their API). I used WebSockets for validating the information being sent, updating the amount and redirect URL accordingly, also I put an UUID on the session to check on the redirect URI so we can validate the order and place it on the admin panel; with the session approach we don't risk getting a GET request on the payments endpoint and processing an order which wasn't paid since we validate the UUID in the parameter. To remove this, edit:\n\n1. `socket.js`\n2. `payments_channel.ex`\n3. `user_socket.ex`\n4. `payments_controller.ex`\n5. `index.html.eex` from the Payments folder in templates\n6. `worker.ex` from the `Ecom` app.\n7. `pay_id.ex` from the Plugs folder in the `EcomWeb` app.\n\n#### `current_user/2`\nIt's a helper function from `EcomWeb.Helpers` imported in the Controllers and Views\n\n#### Unable to encode value\nWhen `Poison` throws an encoding error such as `unable to encode value {nil, \"users\"}`, it's because the Struct or whatever you're trying to encode has private data such as `__meta__`.\n\nSolution: Add `@derive {Poison.Encoder, except: [:__meta__]}` or the field that has private data to the schema you're retrieving information from.\n\n#### Using spread syntax with babel\n`yarn add babel-plugin-transform-object-rest-spread --save-dev` then on `.brunch-config.js` on `plugins/babel`: `\"plugins\": [\"transform-object-rest-spread\"]`\n\n#### Foundation 6 way to initialize JS.\n\n`var Foundation = require('foundation-sites/dist/js/foundation');` then\n```js\n$(document).ready($ =\u003e {\n  $(document).foundation();\n})\n```\n\n#### Gettext\nAll configuration is given through `config :gettext, opts`, not `config :my_app, MyApp.Gettext`\n\n#### Use SimpleMDE\nAs default text editor.\n\n#### Image uploads\nAt the beginning they're handled locally, if you're planning to use a Cloud Storage Service, further configuration is required.\n\n#### Attachments\nArc_ecto provides the `cast_attachments` function. The attachment should be casted only on that function and not on `cast`\n\n#### regeneratorRuntime is not defined\nInstall `babel-plugin-transform-runtime` and add it to the plugins besides other common dependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faguxez%2Fecom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faguxez%2Fecom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faguxez%2Fecom/lists"}