repository
0.0.0-20240927190403-37a5db337547
Repository: https://github.com/kelbwah/swiftlio.git
Documentation: pkg.go.dev
# README
Swiftlio
A assignment tracking application for SMC students written in Go + HTMX + Templ and uses Canvas API for student data retrieval.
How to run locally:
Initial Steps:
- Ensure you have the latest stable version of Golang installed
- Fork the repo and clone it
git clone https://github.com/[your username]/swiftlio.git && cd swiftlio
- Create a
.env
file in the root. Copy and paste.env_example
contents into.env
and change env vars to your desired values. - (If you want to use Docker) Create a
docker-compose.yml
file in the root. You can simply copy and paste the contents fromdocker-compose-sample.yml
into thedocker-compose.yml
file or change the ports if needed.
Migrations:
- Install Goose and sqlc. These are used to initiate migrations on the postgres db and generate necessary db files for the project.
- When testing locally, you can either use the admin's db access (with permission) or create your own db for local development purposes.
- Run
sqlc generate
to generate the necessary*.go
files to theinternal/database
directory for API work. - Run
goose postgres <your Postgres DB URL> up
for up migrations. - Run
goose postgres <your Postgres DB URL> down
for down migrations. - Queries are found in
internal/sql/queries
and Schemas/Migrations are found ininternal/sql/schema
(follow the convention of001_..._.sql
,002_..._.sql
, ...) for schema files.
Using Docker Compose: (Recommended)
- Ensure you have Docker Desktop or Docker installed on your local machine (ensure that you can run the
docker-compose
command) - Running on your machine
- Run
docker-compose up
. Running this (assuming you have docker and docker-compose) will successfully load the project. The default proxy URL is set to127.0.0.1:7331
and the API endpoints start come fromlocalhost:6969
. Change the ports if needed.
- Run
Without Docker Compose:
- You must install three things to enable live hot-reloading while developing without docker-compose:
- (Individual Make Commands) Run/Build/Test your changes using the Makefile in the root of the project.
make build
This command builds the whole project into a single binary in the./bin/
folder.make air
This command starts theair
hot reloadingmake tailwind
This command uses the Tailwind CLI to generate and watch for css changes.make templ
This command helps generate and parse the templ files and outputs the proxy URL that you can use to see changesmake dev
This command runsmake tailwind
,make templ
, andair
all in paralllelmake test
Tests all directories and files with*_test.go
- However, all you will need to run is
make dev
to get all the main commands running in parallel for live development. The default proxy URL is set to127.0.0.1:7331
and the API endpoints start come fromlocalhost:6969
. Change the ports if needed
Contributing
- Refer to CONTRIBUTING.md for more.
Bugs/Feedback
- Create an issue in this repo if you have any changes you want to make or found any bugs.