My very first official Rails app !

Hello community!

I just created my very first Rails app: [www.bamsfx.com](https://www.bamsfx.com)

I made it with rails [6.0.3.3](https://6.0.3.3) and implemented a bunch of APIs and gems such as devise (user accounts), postgresql (database), stripe (payment), gibbon (Mailchimp newsletter) and so on.

It's an online shop where I sell my own sound effect packs, from my previous life, before I started coding 🙂

You can have a look at the repo if you want: [https://github.com/OGsoundFX/sfx-shop](https://github.com/OGsoundFX/sfx-shop)

I would love some feedback, but please keep in mind that I have only been coding for a year.

Cheers!

Olivier

4 thoughts on “My very first official Rails app !”

  1. Nice one! Looking through your code & I was like “This is pretty good for someone who has been coding for just a year” 😀

    > I would love some feedback

    Bear with me! I went through all your code & I’m trying to nitpick as much as I can 🙂

    – [You put inline JS into your view](https://github.com/OGsoundFX/sfx-shop/blob/7e0e3d13f4710651e9208e3fb00268fd7c4f3a16/app/views/shared/_caroussel.html.erb#L59) which can be a nightmare on big projects. Instead look into [stimulus JS](https://stimulus.hotwire.dev/) as a way to organise your JS.

    – It’s awesome how you broke your CSS into files (I do that also!), [though in places you styled using IDs](https://github.com/OGsoundFX/sfx-shop/blob/master/app/assets/stylesheets/components/_pack_description.scss#L1) and a few other approaches. I got into using [BEM](http://getbem.com/introduction/) as an approach & it helped keep my CSS organised 🙂

    – I also import [Bootstrap via Yarn](https://github.com/OGsoundFX/sfx-shop/blob/master/app/assets/stylesheets/application.scss#L1) like this 😀 Nice one!

    – [You have a few empty helpers](https://github.com/OGsoundFX/sfx-shop/blob/master/app/helpers/sfx_packs_helper.rb). I normally just [disable the generator](https://github.com/Ruby-Starter-Kits/Docker-Rails-Template/blob/master/config/initializers/opinionated_defaults/generators.rb) for them.

    – I’d totally recommend have a dive into how to test Rails (the `/test` folder is empty), especially if you’re handling money.

    – [Solidus](https://github.com/solidusio/solidus) – Have a look at this gem, it’s for making eCommerce websites. It’s a bit of a learning curve, but it’s fun to see how they do similar stuff to you.

    Reply
  2. This is awesome, I’m gonna use it to learn more myself!

    Do you mind sharing what your `.env` file’s structure looks like? I’m a newbie myself and I’m trying to `rails db:setup` your project but it gives me this error (which I assume is because I don’t have some creds set up that I need to create):

    ± % bundle exec rails db:setup
    Created database ‘sfx_shop_development’
    Created database ‘sfx_shop_test’
    destroying DB
    [WARNING] The default rounding mode will change from `ROUND_HALF_EVEN` to `ROUND_HALF_UP` in the next major release. Set it explicitly using `Money.rounding_mode=` to avoid potential problems.
    rails aborted!
    ActiveStorage::IntegrityError: Must supply api_key
    /Users/me/projects/sfx-shop/db/seeds.rb:22:in `


    /Users/me/projects/sfx-shop/bin/rails:9:in `
    /Users/me/projects/sfx-shop/bin/spring:15:in `require’
    /Users/me/projects/sfx-shop/bin/spring:15:in `

    bin/rails:3:in `load’
    bin/rails:3:in `

    Caused by:
    CloudinaryException: Must supply api_key
    /Users/me/projects/sfx-shop/db/seeds.rb:22:in `


    /Users/me/projects/sfx-shop/bin/rails:9:in `
    /Users/me/projects/sfx-shop/bin/spring:15:in `require’
    /Users/me/projects/sfx-shop/bin/spring:15:in `

    bin/rails:3:in `load’
    bin/rails:3:in `

    Tasks: TOP => db:setup => db:seed
    (See full trace by running task with –trace)

    Reply
  3. Also learning Rails and this site is pretty sick. As someone who’s done a lot more website building on my local machine than hosting, how/where did you host your website? It’s the part of webdev I’m intimidated by really

    Reply

Leave a Comment