A Web API application for managing users and their addresses, implemented using Golang and the Echo framework.
- User management with CRUD operations.
- Address management associated with users.
- Environment-based configuration using
.envfiles. - Database integration with PostgreSQL.
Follow the instructions below to set up and run the project on your local machine.
- Golang (Version 1.19 or higher recommended)
- PostgreSQL
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Copy the
.env.examplefile to.env:cp .env.example .env
-
Update the
.envfile with your custom configuration (if necessary).
The application uses the following environment variables:
APP_NAME="UserSystem" # Name of the application
APP_ENV=prod # Environment (e.g., dev, test, prod)
APP_PORT=3000 # Port for the API server
DB_HOST=localhost # Database host
DB_PORT=5432 # Database port
DB_USER=postgres # Database user
DB_PASSWORD=postgres # Database password
DB_NAME=users # Database name
DB_SSL_MODE=disable # Database SSL mode
-
Install dependencies:
go mod tidy
-
Run the application:
go run main.go
-
The API will be available at:
http://localhost:3000 #3000 is example port
- Ensure that your PostgreSQL database is running.
- Use the credentials provided in your
.envfile to create the database.
- Language: Golang
- Framework: Echo
- Database: PostgreSQL
- Configuration:
.envfiles
This project is licensed under the MIT License.