Backend service for the Projects Portal, developed by IEEE Computer Society, VITC. This application is built using Go, the Echo framework, and PostgreSQL.
Before you begin, ensure you have the following installed on your machine:
-
Go (version 1.25 or higher) - Download Go
-
PostgreSQL - Download PostgreSQL
-
Goose (Database Migration Tool) - Installation Guide
go install github.com/pressly/goose/v3/cmd/goose@latest
Follow these steps to set up the project locally.
git clone https://github.com/ComputerSocietyVITC/projects-portal-backend.git
cd projects-portal-backendCopy the example environment file to create your local configuration:
cp .env.example .envOpen the .env file and update the database credentials and other settings as needed:
APP_ENV=development
PORT=8080
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_postgres_user
DB_PASSWORD=your_postgres_password
DB_NAME=projects_portal
DB_SSLMODE=disable-
Start your PostgreSQL service.
-
Create a new database named
projects_portal(or whatever you set inDB_NAME). -
Apply the database migrations using
goose.Run the migrations from the project root:
# Syntax: goose -dir migrations postgres "CONNECTION_STRING" up goose -dir migrations postgres "user=compsoc password=secretpassword dbname=projects_portal sslmode=disable" up
Note: Make sure to replace the connection string values with your actual database credentials.
Download the required Go modules:
go mod tidyStart the development server:
go run main.goThe server should now be running at http://localhost:8080 or any other port you set in your .env file.
├── main.go # Application entry point
├── cmd/
├── internal/
│ ├── config/ # Configuration logic (DB, env)
│ ├── handlers/ # HTTP request handlers
│ ├── logger/ # Logging setup
│ ├── middleware/ # Echo middleware
│ ├── models/ # Database models/structs
│ ├── repository/ # Data access layer
│ └── service/ # Business logic
├── migrations/ # SQL migration files
└── go.mod # Go module definition
Please follow these steps to contribute:
- Clone the repo locally.
- Create a new branch for your feature or bugfix (
git checkout -b feature/amazing-feature). - Make your changes.
- Format your code: Before committing, strictly ensure your code is formatted according to Go standards.
go fmt ./...
- Commit your changes (
git commit -m 'feat: added amazing feature'). Follow Conventional Commits - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.