Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e627752
improve folder structure
Jul 21, 2025
abb482a
add frontend initial setup
Jul 21, 2025
af7649e
use same gitignore for both rfontend and backend
Jul 21, 2025
d0f42ab
change title, use handler for using context value and add interceptor…
Jul 21, 2025
1d13c04
implemented login page
Jul 23, 2025
a381672
implement dashboard page
VishakhaSainani-Josh Jul 26, 2025
a1a8a0c
refactor code
VishakhaSainani-Josh Jul 26, 2025
00316fe
refactor code
VishakhaSainani-Josh Jul 27, 2025
de7bfe0
remove print statement
VishakhaSainani-Josh Jul 28, 2025
36a93e9
send languages array in response
VishakhaSainani-Josh Jul 28, 2025
5c769a2
refactor :- get context value in handler itself
VishakhaSainani-Josh Jul 29, 2025
a83e5fa
refactor fetch repo cotributors response json format
VishakhaSainani-Josh Jul 29, 2025
fdd5ea0
implement my-contirbutions page with repository details
VishakhaSainani-Josh Jul 29, 2025
939562c
implement admin feature and refactor goal feature
VishakhaSainani-Josh Aug 4, 2025
c9663b2
implement block or unblock user feature
VishakhaSainani-Josh Aug 4, 2025
c8e31bb
latest code
VishakhaSainani-Josh Aug 4, 2025
69a04af
refactor login with github flow
VishakhaSainani-Josh Aug 5, 2025
795a897
implement admin panel
VishakhaSainani-Josh Aug 5, 2025
c71f111
implement admin features
VishakhaSainani-Josh Aug 6, 2025
218be4c
rewire main.go into a cli app
VishakhaSainani-Josh Aug 6, 2025
82885db
fixes
VishakhaSainani-Josh Aug 19, 2025
bbc2b9d
refactor bugs
VishakhaSainani-Josh Sep 2, 2025
b4bc716
implement goal summary in backend
VishakhaSainani-Josh Sep 3, 2025
42087bf
implement graph summary in frontend
VishakhaSainani-Josh Sep 3, 2025
ba3236c
fix creating user goal progress and css
VishakhaSainani-Josh Sep 3, 2025
0929342
fix goalcompletion status
VishakhaSainani-Josh Sep 4, 2025
4e953c7
fix ui
VishakhaSainani-Josh Sep 4, 2025
a77eb79
implement admin leaderboard
VishakhaSainani-Josh Sep 4, 2025
ab84fb0
fix summary graph
VishakhaSainani-Josh Sep 4, 2025
1f7bffe
enhance ui
VishakhaSainani-Josh Sep 4, 2025
942c233
fix goal summary
VishakhaSainani-Josh Sep 5, 2025
0a95a4c
add logo
VishakhaSainani-Josh Sep 5, 2025
679b25c
implement: show targets for each goal level
VishakhaSainani-Josh Sep 30, 2025
4d8a73a
create summary even when contirbution is not updated
VishakhaSainani-Josh Sep 30, 2025
9562289
add info for user goals
VishakhaSainani-Josh Sep 30, 2025
086acac
fix graph summary
VishakhaSainani-Josh Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
local.yaml
local.yaml
.env

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

152 changes: 152 additions & 0 deletions backend/cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package main

import (
"context"
"fmt"
"log/slog"
"net/http"
"os"

"os/signal"
"syscall"
"time"

"github.com/joshsoftware/code-curiosity-2025/internal/app"
"github.com/joshsoftware/code-curiosity-2025/internal/app/cronJob"
"github.com/joshsoftware/code-curiosity-2025/internal/config"
"github.com/joshsoftware/code-curiosity-2025/internal/db"
"github.com/rs/cors"
"github.com/urfave/cli"
)

func main() {
cfg, err := config.LoadAppConfig()
if err != nil {
slog.Error("error loading app config", "error", err)
return
}

cliApp := cli.NewApp()
cliApp.Name = cfg.AppName
cliApp.Version = "1.0.0"
cliApp.Commands = []cli.Command{
{
Name: "start",
Usage: "Start HTTP server",
Action: func(c *cli.Context) error {
return startApp(cfg)
},
},
{
Name: "migrate",
Usage: "Database migrations",
Subcommands: []cli.Command{
{
Name: "up",
Usage: "Apply migrations",
Action: func(c *cli.Context) error {
m, _ := db.InitMainDBMigrations(cfg)
m.MigrationsUp(c.Args().First())
return nil
},
},
{
Name: "down",
Usage: "Rollback migrations",
Action: func(c *cli.Context) error {
m, _ := db.InitMainDBMigrations(cfg)
m.MigrationsDown(c.Args().First())
return nil
},
},
{
Name: "create",
Usage: "Create a new migration file",
Action: func(c *cli.Context) error {
m, _ := db.InitMainDBMigrations(cfg)
return m.CreateMigrationFile(c.Args().First())
},
},
},
},
}

if err := cliApp.Run(os.Args); err != nil {
panic(err)
}
}

func startApp(cfg config.AppConfig) error {
ctx := context.Background()

slog.Info("Starting CodeCuriosity Application...")

db, err := config.InitDataStore(cfg)
if err != nil {
slog.Error("error initializing database", "error", err)
return err
}
defer db.Close()

bigqueryInstance, err := config.BigqueryInit(ctx, cfg)
if err != nil {
slog.Error("error initializing bigquery", "error", err)
return err
}

httpClient := &http.Client{}

dependencies := app.InitDependencies(db, cfg, bigqueryInstance, httpClient)

router := app.NewRouter(dependencies)

newCronSchedular := cronJob.NewCronSchedular()
newCronSchedular.InitCronJobs(dependencies.ContributionService, dependencies.UserService)

c := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
AllowCredentials: true,
AllowedMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete, http.MethodOptions},
AllowedHeaders: []string{"*"},
})

server := http.Server{
Addr: fmt.Sprintf(":%s", cfg.HTTPServer.Port),
Handler: router,
}

server.Handler = c.Handler(server.Handler)

serverRunning := make(chan os.Signal, 1)

signal.Notify(
serverRunning,
syscall.SIGABRT,
syscall.SIGALRM,
syscall.SIGBUS,
syscall.SIGINT,
syscall.SIGTERM,
)

go func() {
slog.Info("server listening at", "port", cfg.HTTPServer.Port)

if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
slog.Error("server error", "error", err)
serverRunning <- syscall.SIGINT
}
}()

<-serverRunning

slog.Info("shutting down the server")
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()

if err := server.Shutdown(ctx); err != nil {
slog.Error("cannot shut HTTP server down gracefully", "error", err)
}

slog.Info("server shutdown successfully")
return nil
}
72 changes: 72 additions & 0 deletions backend/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
module github.com/joshsoftware/code-curiosity-2025

go 1.23.4

require (
cloud.google.com/go/bigquery v1.68.0
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/golang-migrate/migrate/v4 v4.18.3
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/jmoiron/sqlx v1.4.0
github.com/lib/pq v1.10.9
github.com/robfig/cron/v3 v3.0.1
golang.org/x/crypto v0.37.0
golang.org/x/oauth2 v0.29.0
google.golang.org/api v0.231.0
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/urfave/cli v1.22.17 // indirect
)

require (
cloud.google.com/go v0.121.0 // indirect
cloud.google.com/go/auth v0.16.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.5.2 // indirect
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/apache/arrow/go/v15 v15.0.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/rs/cors v1.11.1
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sync v0.14.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.11.0 // indirect
golang.org/x/tools v0.30.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/grpc v1.72.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
)
Loading