a webserver for a corset pattern generator site using golang
Go 84.9%
templ 15.1%
45 1 0

Clone this repository

https://tangled.org/silvernskye.bsky.social/corset-webserver
git@tangled.org:silvernskye.bsky.social/corset-webserver

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Corset Webserver#

once again, making a corset pattern generateor website with golang this time this time, for sure!

Note: README checklist visibale in view by code mode

todo#

  • add user routes:

    • delete user
    • list all users
  • add basic text output (make it not json)

  • add basic auth for users:

    • login
    • logout
    • auth del user path
    • auth show single user
    • set up echo api for testing
    • debug the issues
  • add the corset routes:

    • corset storage
    • show all corset
    • save corset
    • show corsets for user
    • show single corset
    • edit corset details
    • debug errors
  • set up sql

    • check & create tables
    • insert record
    • select user by email
    • select all users/corsets
    • select users/corsets by id
    • select corset by user id
    • delete corset/user
    • update corset/user
    • add user/pattern id to struct
    • link with other code
    • debug
  • add middleware

    • logging
    • auth
    • recovery
    • update and fix golang
    • debug
  • templ with unstyled html

    • add bare bones html, no styling or formatting
    • templ hello world
    • basic html boilerplate
    • display current data
    • add links & menu
    • add redirects?
    • error pages
    • forms
    • fix login ui
    • debug login again
    • understand context
  • refactor

    • packages
      • directory stucture
    • add controlllers
    • set up db better
    • debug refactoring
  • deploy to prod

    • do a test deply with hello world app
    • test corset deploy manually
      • build golang
        • test if this works in localhost
        • (it crashed before)
      • run binary
      • deploy binary
    • automate this
      • edit the path wich is deployed
      • env secret for railway token, & db path, service action?
      • make dev branch
    • hosting
      • research best for trial
        • railway is best
        • set up
      • deploy under subdomain
      • bun set up corset.silvernskye.co.uk
    • cicd
      • make dev branch & do work there
      • make file?
      • wait for tangled cicd stuff
      • tangled cicd is here!
  • testing

  • db security?

    • encrypt db
    • file permissions
    • 3 daily back ups
    • prepared statements
  • design stuff

    • problem section
    • design docs
      • system dia
      • wireframe
      • use krita?
    • directory stucture & refactor
  • more ui stuff

  • daisy ui edit in the browser dev tools, copy to file

learning intentions#

  • basic web server
  • basic login
  • test app
  • add the corset routes
  • sql, sqlite? mysql?
  • middleware (auth, logging, x)
  • templ, basic html templates

not done yet

  • testing

  • deployment, docker, make,

  • structure

  • basecoat ui, shoelace, daisy ui? - we can use a cdn + plain html for this

  • theming, shadcdn ui design

  • pattern calculation

  • webcomponent for pattern display - use lit?

  • pdf download

  • pattern route, htmx?

  • hosting, dns & subdomains?

  • sso, bsky, google

  • CSRF notes

    • this is only for posts
    • put in as hidden html input
    • for displying info, just use session id for auth
    • dont send as cookie
  • make a 8 page zine as v1 conclusion & print it

    • a4 and a3 versions?
    • make in krita
    • 2 intro: problem
    • backend
      • 3 database tables
      • 4 golang folder
      • 4 mvc
    • frontend
      • 5 wire frame
      • 6 templ
      • 6 webcomponets
      • 6 sso
    • deployment
      • 7 docker
      • 7 dns
    • conclusion
      • 8 url
      • 8 qr code?
      • 8 tangled
      • 8 bsky account

Steps#

  • basic webserver + testing, live storage, return json
  • sql storage
  • middleware
  • ui + templ
  • pattern gen + pdf maker
  • oAuth (google + blueSky)

project stuff#

  • problem & solution; why this project
    • this patten takes too much paper to calculate compared to the finished pattern
    • few parameters
    • can be calculated
      • thus make this a program
    • needs to be easy and visual to use
      • thus make this a web site
    • need a project i can actually finish
      • dont want heavy js/react crap
      • use the simplest tech
  • Plan : todo list & this page
  • basic design docs
    • system dia
    • sequence dia
    • wireframe
  • directory stucture
    • golang package refactor
    • fol
    • BL ending for model functions
    • turn to proper MVC
  • git & proper commit messages after finished one thing
  • docuentation
    • installation guide
    • prod url
    • how to run the docker
    • troubleshooting & faq for future you
    • more READMEs if have complex stucture
  • testing
    • at least a few of each
    • proper stucture ect
  • CI & CD
    • auto test
    • auto deploy
    • trunk based dev
    • feature & main branch
  • code review
    • review after done
    • then refactor as needed

Primary actions#

  • add/remove/edit pattern
  • show all users
  • login/logout/register
  • show patterns from a user
  • show 10 latest patterns & who they are by

Data#

Users#

  • id
  • email
  • password
  • createdOn

Pattern#

  • id
  • bust
  • waist
  • inbetween
  • userId
  • createdOn
  • updatedOn
  • name

Routes#

  • /: home page, explains the api
  • /login, /logout, /register
  • /corset: get:: last top 10 patterns, post:: creates pattern if logged in
  • /corset/{id}: show that pattern, post:: if auth, can edit/delete
  • /users: last top 10 registered users & how many patterns they have (also id)
  • /users/{id} shows that users detail, if auth shows full details
  • /users/{id}/corsets: shows all patterns for that user