Skip to content

Commit b8913d7

Browse files
authored
Merge pull request #1 from Advik-Gupta/master
Initialised Repository
2 parents 3f0129c + e6f6ba4 commit b8913d7

10 files changed

Lines changed: 240 additions & 2 deletions

File tree

.air.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .air.toml
2+
3+
root = "."
4+
tmp_dir = "tmp"
5+
6+
[build]
7+
cmd = "go build -o ./tmp/main ./cmd/api"
8+
bin = "tmp/main"
9+
full_bin = "tmp/main"
10+
include_ext = ["go"]
11+
exclude_dir = ["tmp", "vendor", "node_modules"]
12+
delay = 1000
13+
stop_on_error = true
14+
15+
[log]
16+
time = true
17+
18+
[color]
19+
main = "yellow"
20+
watcher = "cyan"
21+
build = "green"
22+
runner = "magenta"
23+
24+
[misc]
25+
clean_on_exit = true

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PORT=8080
2+
JWT_SECRET=
3+
4+
POSTGRES_HOST=
5+
POSTGRES_PORT=
6+
POSTGRES_USER=
7+
POSTGRES_PASSWORD=
8+
POSTGRES_DB=
9+
10+
REDIS_HOST=
11+
REDIS_PORT=
12+
REDIS_PASSWORD=

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with "go test -c"
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
# Go workspace file
18+
go.work
19+
tmp/
20+
21+
# IDE specific files
22+
.vscode
23+
.idea
24+
*.rest
25+
dump.txt
26+
27+
# .env file
28+
.env
29+
30+
# Project build
31+
main
32+
*templ.go
33+
.DS_Store

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM golang:1.25-alpine
2+
3+
RUN apk update && apk upgrade && \
4+
apk add --no-cache git
5+
6+
WORKDIR /app
7+
8+
RUN go install github.com/air-verse/air@latest
9+
10+
COPY go.mod go.sum ./
11+
12+
RUN go mod download
13+
14+
COPY . .
15+
16+
EXPOSE 8080
17+
18+
CMD ["air", "-c", ".air.toml"]

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include .env
2+
3+
all: build
4+
5+
build:
6+
@echo "Building..."
7+
@go build -o main cmd/api/main.go
8+
9+
run:
10+
@echo "Running..."
11+
@go run cmd/api/main.go

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
# devsoc-backend-26
2-
DevSOC '26 Backend
1+
<p align="center"><a href="https://www.codechefvit.com" target="_blank"><img src="https://i.ibb.co/4J9LXxS/cclogo.png" width=160 title="CodeChef-VIT" alt="Codechef-VIT"></a>
2+
</p>
3+
4+
# Devsoc Backend '26
5+
6+
The official Backend API for DEVSOC'26 Hackathon Portal
7+
8+
<!-- ## Features -->
9+
10+
## Tech Stack
11+
12+
- [Go](https://golang.org/)
13+
- [Echo](https://echo.labstack.com/): Minimalist Go web framework
14+
- [PostgreSQL](https://www.postgresql.org/): Open-source relational database
15+
- [Docker](https://www.docker.com/): Container platform
16+
- [Redis](https://redis.io/): In-memory data store
17+
18+
<!-- ## How To Run
19+
20+
## 🚀 Contributors -->
21+
22+
# License
23+
24+
Copyright © 2026, [CodeChef-VIT](https://github.com/CodeChefVIT) and all other contributors.
25+
Released under the [MIT License](LICENSE).
26+
27+
<p align="center">
28+
Made with ❤️ by <a href="https://www.codechefvit.com" target="_blank">CodeChef-VIT</a>
29+
</p>

cmd/api/main.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package main
2+
3+
import (
4+
"log"
5+
"os"
6+
7+
"github.com/joho/godotenv"
8+
"github.com/labstack/echo/v4"
9+
)
10+
11+
func main() {
12+
err := godotenv.Load()
13+
if err != nil {
14+
log.Println("No .env file found")
15+
}
16+
17+
e := echo.New()
18+
19+
e.GET("/health", func(c echo.Context) error {
20+
return c.JSON(200, map[string]string{
21+
"status": "devsoc-backend-26 running",
22+
})
23+
})
24+
25+
port := os.Getenv("PORT")
26+
if port == "" {
27+
port = "8080"
28+
}
29+
30+
log.Println("Server running on port", port)
31+
e.Logger.Fatal(e.Start(":" + port))
32+
}

docker-compose.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
services:
2+
postgres:
3+
image: postgres:16
4+
container_name: postgres
5+
env_file:
6+
- .env
7+
ports:
8+
- "127.0.0.1:5433:5432"
9+
volumes:
10+
- postgres_data:/var/lib/postgresql/data
11+
12+
redis:
13+
image: redis:latest
14+
container_name: redis
15+
ports:
16+
- "127.0.0.1:6379:6379"
17+
env_file:
18+
- .env
19+
volumes:
20+
- redis_data:/data
21+
22+
api:
23+
build: .
24+
ports:
25+
- "127.0.0.1:8080:8080"
26+
volumes:
27+
- .:/app
28+
env_file:
29+
- .env
30+
restart: on-failure
31+
depends_on:
32+
- postgres
33+
- redis
34+
35+
volumes:
36+
postgres_data:
37+
redis_data:

go.mod

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module github.com/Advik-Gupta/devsoc-backend-26
2+
3+
go 1.24.1
4+
5+
require (
6+
github.com/joho/godotenv v1.5.1 // indirect
7+
github.com/labstack/echo/v4 v4.13.4 // indirect
8+
github.com/labstack/gommon v0.4.2 // indirect
9+
github.com/lib/pq v1.10.9 // indirect
10+
github.com/mattn/go-colorable v0.1.14 // indirect
11+
github.com/mattn/go-isatty v0.0.20 // indirect
12+
github.com/valyala/bytebufferpool v1.0.0 // indirect
13+
github.com/valyala/fasttemplate v1.2.2 // indirect
14+
golang.org/x/crypto v0.38.0 // indirect
15+
golang.org/x/net v0.40.0 // indirect
16+
golang.org/x/sys v0.33.0 // indirect
17+
golang.org/x/text v0.25.0 // indirect
18+
)

go.sum

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
2+
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
3+
github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA=
4+
github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ=
5+
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
6+
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
7+
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
8+
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
9+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
10+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
11+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
12+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
13+
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
14+
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
15+
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
16+
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
17+
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
18+
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
19+
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
20+
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
21+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
22+
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
23+
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
24+
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
25+
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=

0 commit comments

Comments
 (0)