This whole project started on a road trip when I realized how much fun generating SQL queries could be. I dove into it, but then put it on hold for a few months. Then a colleague showed me the Phoenix Framework, and I was hooked. It felt like a breath of fresh air, built by folks who were fed up with the usual web development headaches. I spent some time digging through the documentation and picked up a lot about Phoenix and web design best practices. It was mostly new territory for me, but it reignited my passion to create something unique with what I learned.
So, why not just stick with Phoenix?
Despite these bumps in the road, I'm still really excited about the Phoenix Framework and its innovative take on web design and problem-solving. I'm hoping to build something special that showcases everything I've picked up along the way.
This project is still very much a work in progress, with updates coming out about once a week. Right now, I'm focused on getting the app up and running, so I'm mostly exploring different ideas.
There's some interesting stuff in here - I just added pagination, which I think is pretty cool. But, as with most things, I might change how it's implemented down the line. For example, there's a lot of duplicated code for transactions, and I keep reading template files unnecessarily. I know these are things I need to tackle, just not at the moment.
Things are looking promising, especially with the recent addition of unique indexes on foreign keys. It's been a while since I tested the outputs, but it worked with the default example for the Go app.
I want to implement migrations and seed data, something I picked up while learning Phoenix, but I haven't gotten around to it yet. Migrations would help me manage changes to the database schema as the project evolves, and seeding data would streamline setting up the initial state for development and testing. I see how useful these features could be and plan to add them once I get more settled with everything else.
I've been testing outputs and things have been going well so far, but I'm constantly dealing with edge cases, so you might run into a few too.
cd cmd/mysite/ go get go vet go run .
. ├── cmd Main application │ └── mysite ├── internal Core application code │ ├── config Configuration and settings (database) │ ├── handlers HTTP request handlers (handle JSON, form data, and serve HTML) │ │ ├── product │ │ │ ├── json.go Handles JSON data requests │ │ │ ├── form.go Handles form data requests │ │ │ └── html.go Serves HTML forms │ │ └── ... │ ├── middleware Custom middleware for request handling │ └── routes ├── pkg Shared libraries and packages │ ├── models Data models │ │ ├── product.go Defines the Product model and its changesets │ │ └── ... │ ├── repositories Data access interfaces │ │ ├── product.go Data access methods for Product │ │ └── ... │ ├── services Business and other shared logic (may change...) │ └── validation Input validation and changeset definition ├── scripts Utility scripts (placeholder) ├── test Unit and integration tests (placeholder) | └── web Web-related files ├── static Static assets (CSS, JS, images) └── templates HTML templates organized by feature ├── cart │ ├── show.html Template for displaying a single cart record │ ├── index.html Template for displaying multiple cart records │ ├── edit.html Template for modifying a cart record │ └── new.html Template for creating a new cart record └── ...
The organized structure makes it easier to navigate and maintain the code. Reusing code across components definitely speeds things up when I'm adding new features. Plus, it scales well, so I can add functionality without breaking what's already in place.
On the downside, this structure can feel a bit much for smaller projects, adding unnecessary complexity. There's a learning curve to get the hang of everything, and it can lead to over engineering - sometimes simpler solutions get ignored, which can slow things down.