This is a lightweight Go backend application for managing workouts and exercises. It allows users to create and retrieve structured workout routines, including detailed entries for each exercise, such as sets, reps, duration, and weight. The backend is built with Go's standard library and leverages PostgreSQL for data persistence.
- RESTful API structure for workout creation and retrieval
- PostgreSQL integration using database/sql and pgx
- Embedded SQL migrations via goose
- Modular codebase with clear separation between handlers, routes, and storage
- Transaction-safe creation of workouts and related entries
- Easily extensible architecture for future enhancements like user authentication or progress tracking
Ideal for fitness apps, personal workout logs, or as a base for a full-stack workout tracking solution.
Follow these steps to run the project locally:
-
Clone the repository:
git clone <your-repo-url> cd <repo-directory>
-
Install dependencies:
- Ensure you have Go, Docker, and Docker Compose installed (see Setup).
-
Start the Postgres database using Docker Compose:
docker-compose up -d
-
Run database migrations:
goose -dir migrations postgres "<your-postgres-connection-string>" up
Replace
<your-postgres-connection-string>
with your actual connection string (see yourdocker-compose.yml
). -
Run the Go server:
go run main.go # if you have Air installed Air
You can now access the API locally as described in the project documentation.
The API project is built from scratch. Before watching the course, you should install:
- Go (version 1.24.2 or higher)
- Postgres and any DB tool like psql or Sequel Ace to run SQL queries.
- Docker and Docker Compose
- In the Postgres Database Container lesson, the Docker container exposes Postgres on the default port of
5432
. If you already have Postgres or something else running on that port and you get a connection error, you can use an alternate port but updating thedocker-compose.yml
to be something like"5433:5432"
. - In the SQL Migrations with Goose lesson, if you get a "command not found" error when running
goose -version
, it's because the$HOME/go/bin
directory is not added to yourPATH
. You can fix this temporarily by runningexport PATH=$HOME/go/bin:$PATH
, but this will not persist if you close your terminal. A permanent fix would require addingexport PATH=$HOME/go/bin:$PATH
to your.zshrc
or.bashrc
.
Thank you for checking out this project! If you find it useful or have suggestions for improvement, feel free to open an issue or submit a pull request. Contributions are always welcome.
If you have any questions or want to connect, you can reach out via the repository's issues page or add your contact information here.
Happy coding and good luck with your fitness app development!