Skip to content

BerkeleyTrue/conduit-go-htmx

Repository files navigation

Real World App

The mother of all demo apps

License: MIT

Go/Templ/HTMX/Sqlc codebase containing RealWorld examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec as much as possible while sticking to HATEOAS principals.

This codebase was created to demonstrate a fully fledged backend application built with golang/HTMX including CRUD operations, authentication, routing, pagination, and more.

How it works

  • Using Go to implement realworld backend server.

  • Using SQLite to store data.

  • Using Nix Flakes to build and deploy

Getting started

The app listens and serves on 0.0.0.0:3000.

Do drop into a nix shell (you will need the nix package manager installed)

nix develop

This will install the binaries needed as well as display useful information to get started developing.

Project status

In Progress...

Todo

  • User Api
    • Register should return error if user already exists
    • feed should show following author articles...
  • Update dates in templates
  • Refactor to use structured errors
    • repo's should return raw error
    • services should return user facing errors
    • controllers should format error for templates
  • Refactor to Echo
    • Fiber doesn't have a clean way to extend ctx, which is a main stay of a express like framework.
  • Sqlite issue
    • Sqlite often crashes when making multiple request in parallel. I believe this might be a go-sql issu. I create a branch with libsql to see if the issue persists.
  • Docker Build
    • a build to let non-nix users run server
  • Seed
    • add default user by cli flag

Doing

  • Get new/edit articles page
    • edit tags
    • /editor/slug - edit
      • Load article and prefill page
      • update links to patch
    • /editor - new

Done

  • test login/register
  • update header for authed user
  • Settings page
    • Get settings page
    • make errors dynamic
    • add post for form
    • add logout handler
    • Update settings
      • image
      • username
      • bio
      • email
      • password
  • Profile page
    • Get profile page
    • Make content live
    • link to settings
    • hide follow if own profile
    • show favorited articles
  • Home
    • Fix: home page should load articles
    • Load tags
  • Move to templ
    • move article edit to templ
    • Install
    • render to page
    • create render func
    • move settings to templ
    • move profile to templ
    • move article to templ
  • Articles Api
    • Filter articles
      • by author
      • Add tag
      • add favorites
    • Unfavorite
    • Insert tags
    • Get popular tags
  • Views
    • add banners
    • add error message on htmx 500
  • fix session stored alerts
  • Use fastHttp context in sql requests (this caused a lot of disk io issues with sqlite 🤷)
  • Add seed data import (use gofakeit)
    • add comments
    • add users
    • add articles
    • Add get route
    • return list of articles
    • add author details
    • Check if user is following article author
    • move createAt out of repo, into service
      • This should allow us to manipulate created at during seeding
  • Comments
    • API
      • create comment on article
      • delete comment from article
      • get articles by slug
    • Repo
      • create
      • read
        • by id
        • by author
        • by article
      • delete
    • Service
      • create
      • read
      • delete
      • mark if owner
  • Profile page
    • follow author
  • Get article page
    • delete if owner
    • Follow/Unfollow author
    • Favorite/Unfavorite article
    • comments
      • Get on load
      • mark if owner
    • delete comment if owner
    • /article/:slug

About

A real world example app using Go, Templ, Sqlc, and HTMX

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published