E5D2 GitHub - apollo-fire/reesource-tracker
[go: up one dir, main page]

Skip to content

apollo-fire/reesource-tracker

Repository files navigation

Reesource Tracker

Reesource Tracker is a full-stack application for tracking samples, products, and locations. It uses Go for the backend, Bun (with Svelte) for the frontend, and SQLC for type-safe database access.

Development Guide

Prerequisites

  • Go (v1.18+ recommended)
  • Bun (v1+ recommended)

Backend Setup (Go)

  1. Install Go dependencies:
    go mod tidy
  2. Database setup:
    • SQLite is used by default. The database file is at database/db.sqlite.
    • To initialize or migrate the schema, use the SQL files in database/schema.sql.
  3. SQLC code generation:
    • Install SQLC directly via Go:
      go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
    • After installation, restart your terminal to ensure the Go bin directory is in your PATH.
    • Generate Go code from SQL queries:
      sqlc generate
    • This will generate type-safe Go code for database access in lib/database/query.sql.go.
  4. Run the backend:
    go run main.go
    Or build and run:
    go build -o build/reesource-tracker.exe main.go
    ./build/reesource-tracker.exe

Frontend Setup (Bun + Svelte)

  1. Install Bun:
  2. Install frontend dependencies:
    cd client
    bun install
  3. Run the frontend dev server:
    bun run --bun dev

Usage of SQLC

  • SQLC reads SQL queries from database/query.sql and generates Go code for type-safe database access.
  • Configuration is in sqlc.yaml.
  • After editing SQL files, always run sqlc generate to update Go code.

Docker (Optional)

  • Docker is not required for development. Deployment is handled by GitHub Actions.

Project Structure

  • main.go - Entry point for the Go backend
  • api/ - API routes and handlers
  • lib/database/ - Database models, query code, and wrappers
  • client/ - Frontend (Svelte + Bun)
    • src/ - Main source code for the frontend
      • lib/ - Shared frontend utilities and components
        • components/ - Reusable Svelte components (UI, forms, etc.)
    • public/ - Static assets served by the frontend
  • database/ - SQLite database and SQL files (schema, queries)
  • build/ - Compiled binaries and static build outputs

Useful Commands

  • Go: go mod tidy, go run ., go build
  • Bun: bun install, bun run --bun dev, bun run --bun build
  • SQLC: sqlc generate

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  
0