summaryrefslogtreecommitdiff
path: root/src/app.lisp
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2026-07-18 23:23:35 +0200
committerMarius Peter <dev@marius-peter.com>2026-07-18 23:23:35 +0200
commit753e25e99ddf57be78ff27ad89cb7e1bbc99d041 (patch)
tree43db69ec341520f2923f2f13d0cd8846a9acac35 /src/app.lisp
Initial commit: HITO MVP
Heavy Duty I prescriptive training system encoding Mentzer's methodology. - 4-day split program (Chest & Back, Legs, Shoulders, Arms) - Prescription engine with pre-exhaust superset structure - Strict progression logic (+5kg large / +2.5kg small muscles) - Recovery gating with stall-based extension and override - Onboarding via experience level (Novice/Intermediate/Advanced) - Session logging with full progression analysis - Exercise substitution (33 alternatives for 17 canonical movements) - Objectivist aesthetic: black/gold, serif, rectilinear Stack: Hunchentoot, Mito/SQLite, Djula, SBCL
Diffstat (limited to 'src/app.lisp')
-rw-r--r--src/app.lisp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/app.lisp b/src/app.lisp
new file mode 100644
index 0000000..6c8b960
--- /dev/null
+++ b/src/app.lisp
@@ -0,0 +1,43 @@
+(in-package #:hito)
+
+;;; --- Server Configuration ---
+
+(defvar *app* nil
+ "The Hunchentoot acceptor instance.")
+
+(defvar *port* 8080
+ "Port on which HITO listens.")
+
+(defvar *static-directory*
+ (asdf:system-relative-pathname "hito" "static/")
+ "Path to static assets (CSS, images).")
+
+;;; --- Static File Serving ---
+
+(push (hunchentoot:create-folder-dispatcher-and-handler
+ "/static/" *static-directory*)
+ hunchentoot:*dispatch-table*)
+
+;;; --- Server Lifecycle ---
+
+(defun start (&key (port *port*))
+ "Start the HITO web server. Initializes the database if needed."
+ (when *app*
+ (format t "~&Server already running on port ~D. Stop it first.~%" *port*)
+ (return-from start nil))
+ ;; Ensure DB is ready
+ (init-db)
+ (setf *app* (make-instance 'hunchentoot:easy-acceptor
+ :port port
+ :document-root *static-directory*))
+ (hunchentoot:start *app*)
+ (format t "~&HITO is running on port ~D.~%" port)
+ *app*)
+
+(defun stop ()
+ "Stop the HITO web server."
+ (when *app*
+ (hunchentoot:stop *app*)
+ (setf *app* nil)
+ (format t "~&HITO stopped.~%")
+ t))
Copyright 2019--2026 Marius PETER