The Gym API is a project designed to help users manage and track their workouts. With this API, users can create, update, and view their exercise routines efficiently.
Follow these steps to set up the project on your local machine:
-
Clone the Project:
git clone git@github.com:davidspader/gym-api.git cd gym-api
-
Configure Environment Variables:
- Copy the example environment file:
cp .env-example .env
- Edit the
.env
file to configure the environment variables:POSTGRES_USER=your_user POSTGRES_PASSWORD=your_password POSTGRES_DB=your_database DB_URL=postgresql://your_user:your_password@localhost/your_database API_PORT=your_preferred_port SECRET_KEY=your_base64_encoded_string
- Copy the example environment file:
-
Install Go Modules:
go mod tidy
-
Start Docker Containers:
docker compose up -d
-
Run the SQL Script:
- Import the database schema from the SQL script located at
sql/script.sql
into your PostgreSQL database.
- Import the database schema from the SQL script located at
-
Generate Test Data (Optional):
- If you want to generate test data for the API, run the SQL script located at
sql/data.sql
. Note that the default password for the test users is123456
.
- If you want to generate test data for the API, run the SQL script located at
Your system is now configured and ready to use!
You can access the API documentation at http://localhost:3000/swagger/index.html