Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/READMEFIRST.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This directory holds the Codebloom infrastructure code. That includes workflows
├── ai-review.yml # Qodo review agent (includes custom logic to inject Notion task context to AI agent)
├── approval.yml # DEPRECATED - used to handle custom approval rules not natively supported by GitHub
├── ci-cd.yml # Main CI/CD pipeline that runs tests, builds images, triggers deployments, and more.
├── copy-db.yml # command to copy prod db to staging db
├── deploy-stg.yml # command to deploy to staging
├── copy-command.yml # command to copy prod db to staging db
├── e2e.yml # daily E2E tests
├── help-command.yml # one-time command on PR launch to show all available slash commands
├── pr-verifications.yml # validates PR & commits against Notion
└── slash.yml # helper workflow to trigger slash command invocations to the right workflow
Expand All @@ -30,7 +30,7 @@ This directory holds the Codebloom infrastructure code. That includes workflows

All PRs must be tested in our staging environment to make sure that it won't break anything (if there's a reason it cannot be tested in staging, it must be indicated in the PR description).

To trigger deployment to staging, you just have to comment `/deploy` as a comment in the PR.
`/deploy` is registered, but its target `deploy-command.yml` workflow is missing from this checkout, so it cannot currently trigger staging deployment.

> [!NOTE]
> It should be a regular comment inside of the first page of the PR; writing the command as a review on a file or line(s) will not trigger deployment.
Expand Down
18 changes: 3 additions & 15 deletions .github/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This directory contains helper scripts that are used in our CI/CD workflows. The
├── load-secrets # used to load environment variables (and automatically mask them in GitHub Actions) as a JS object.
├── notion # notion-specific logic (includes helper functions that can be shared as well as a `main()` function to directly run Notion verification checks against PR & commits)
├── patches # bun patches applied to certain packages to fulfill our need
├── redeploy # redeployment logic (db migrations, DigitalOcean, Coolify)
├── redeploy # redeployment logic (db migrations and Kubernetes manifest PRs)
├── test # includes multiple different test flows (backend, frontend, compile checks only)
├── types.ts # shared types
├── utils # shared utils
Expand All @@ -33,18 +33,6 @@ This directory contains helper scripts that are used in our CI/CD workflows. The

## Run

To run a script, simply use the following snippet below:
Run scripts from the repository root with Bun. Each script declares its required arguments in its `yargs` configuration.

```bash
bun run .github/scripts/redeploy/index.ts

# or use shorthand since it's an index.ts file

bun run .github/scripts/redeploy

# you do not need to call `dotenvx run --` before calling Bun Shell scripts. they already have a way to
# parse env files and use them as a JS object at runtime (masked in GitHub Actions).

# if you need to explicitly pass in an environment variable, do it like so
ENVIRONMENT=staging bun run .github/scripts/redeploy
```
For deployment, `redeploy/index.ts` requires `--sha` (or `GITHUB_SHA`) and GitHub App credentials in the process environment. Select the environment with `--environment staging|production`. Running the script locally does not automatically load environment files.
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ email-gen *args:

# Run the dev servers (backend & frontend)
dev *args:
cp internal/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit && npx concurrently "just backend-dev" "just frontend-dev" {{args}}
npx concurrently "just backend-dev" "just frontend-dev" {{args}}

# Run the dev servers (backend & frontend) but the backend will launch a debugger server.
devd *args:
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Codebloom is a leaderboard system that game-ifies the aspect of solving LeetCode

## Features

_Last updated: 02/14/2026_
_Last updated: 09/03/2026_

Codebloom features include

Expand Down Expand Up @@ -86,12 +86,12 @@ Please go to [`docs/setup/README.md`](./docs/local/README.md) to begin setup ins

## Authors

The current lead developer of the Codebloom development team is Arshadul Monir. If you have any inquires or questions, please direct them to him.
The current lead developers of the Codebloom development team are Tahmid Ahmed and Angela Yu. If you have any inquires or questions, please direct them to them.

<!-- TODO: Add new authors -->
<!-- The current members of the core development team are: -->
<!---->
<!-- - Arshadul Monir -->
The current members of the core development team are:

- Nancy Huang

> [!NOTE]
> Codebloom is open-source and happily accepts contributions from the community. However, all pull requests are subject to review by the development team. Please click [here](./CONTRIBUTING.md) to learn more.
Expand All @@ -100,11 +100,9 @@ The current lead developer of the Codebloom development team is Arshadul Monir.

Thank you to all the previous members of the Codebloom development team that have helped make Codebloom possible <3

- Tahmid Ahmed (Previous lead developer, founding member)
- Alfardil Alam (Previous developer, founding member)
- Alisha Zaman (Previous developer, founding member)
- Angela Yu (Previous developer)
- Nancy Huang (Previous developer)
- Arshadul Monir (Previous developer)

## Patina Network

Expand Down
1 change: 0 additions & 1 deletion docs/features/DISCORD-INTEGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ This slash command will return a refreshed leaderboard embed (similar to the aut

Current restrcitions:

- We cannot currently update the leaderboard via Discord (though we are working on that now!)
- If the club requested a leaderboard update before 5 minutes have elapsed, the command will then fail & indicate how long to wait until you can request a new update.
- **NOTE**: it will not show the fail response to every user, but only to the user who triggered the command.

Expand Down
14 changes: 5 additions & 9 deletions docs/local/DEV-COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
> [!WARNING]
> Should be used sparingly

`just copy-stg` - Will pull credentials from `infra/.env.production` and do the following:
`just migrate-stg` - Migrate staging using `.env.staging` and versioned migrations only.

1. Drop all tables from staging db
2. Copy all data from production db to staging db
3. Scrub/sanitize all records/tables that should not be allowed in staging db.
> [!WARNING]
> Should be used sparingly
`just copy-stg` currently references the missing `infra/copy-prod-db.sh` and does not work. The implemented production-to-staging copy is the `/copy` PR command, backed by [copy-command.yml](../../.github/workflows/copy-command.yml) and [copy-prod-db/index.ts](../../.github/scripts/copy-prod-db/index.ts). It replaces staging data and then sanitizes it.

# Frontend

Expand All @@ -34,7 +30,7 @@

`just frontend-dev` - Will only start the frontend Vite dev server.

`just types-gen` - Regenerate the `schema.ts` file.
`just type-gen` - Regenerate the `schema.ts` file.

> [!WARNING]
> The backend must be running
Expand All @@ -49,9 +45,9 @@

`just backend-dev-debug` - Will only start the backend Spring dev server, but will wait for a JVM debugger to attach to port 5005 first.

`just backend-test` - Run Checkstyle and then the full test suite.
`just backend-test` - Check Spotless formatting, then run Checkstyle and Maven verification with the `ci` profile, loading `.env` and `.env.shared`.

`just backend-coverage` - Runs `just backend-test` and opens up the JaCoCo test coverage page in your default browser.
After `just backend-test`, view the JaCoCo report at `target/site/jacoco/index.html`. There is currently no `backend-coverage` recipe.

`just backend-spotless` - Runs the backend formatter (currently Spotless with Palantir Java Formatter) and indicates whether or not you need to run the formatter on any files.

Expand Down
4 changes: 2 additions & 2 deletions docs/local/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The following general software needs to be installed on your local machine:
1. `dotenvx` - Used to load environment variables from the root `.env` file.
1. `node` - Javascript runtime to run our frontend TypeScript code.
1. `corepack` - A package manager for package managers (???) to help us set a consistent `pnpm` version across all devs.
1. `pnpm@9` - Package manager that works faster than the default npm package manager.
1. `pnpm@10.24.0` - Package manager that works faster than the default npm package manager.

## MacOS

Expand Down Expand Up @@ -196,7 +196,7 @@ You can feel free to use any viewer you want, but we would recommend [DataGrip](

# Secrets

You can speed up the setup process by making a copy of `.env.example` to `.env`.
You can speed up the setup process by making a copy of `example.env` to `.env`.
You will also find explanations and documentation about how to source the value for each key.

If there is a key specific to an environment (such as `CI` or `staging` environment), please consult the tech docs within the `CI` group.
25 changes: 8 additions & 17 deletions docs/observability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="./dashboard.png" alt="Grafana">

Codebloom uses Spring Boot Actuator and Prometheus to provide operational insights into the running application. We also collect logs via OpenSearch, which is setup through the DigitalOcean App Platform [(view app spec here)](../../.do/specs.ts). Both of these data sources are then fed to a Grafana instance hosted on [monitor.tahmid.io](https://monitor.tahmid.io)
Codebloom uses Spring Boot Actuator and Prometheus to provide operational insights into the running application. The application deployment now targets Kubernetes; see [infrastructure documentation](../../infra/README.md). OpenSearch and Grafana infrastructure configuration is not stored in this repository. Both of these data sources are then fed to a Grafana instance hosted on [monitor.tahmid.io](https://monitor.tahmid.io)

## Grafana

Expand All @@ -17,20 +17,13 @@ Spring Boot Actuator exposes operational information about the running applicati

### Security

All actuator endpoints are protected with HTTP Basic Authentication to prevent unauthorized access to sensitive operational data.

**Authentication Details:**

- **Authentication Type:** HTTP Basic Auth
- **Role Required:** `ACTUATOR`
- **Credentials:** Stored in environment variables
- `ACTUATOR_USERNAME` - Username for actuator endpoints
- `ACTUATOR_PASSWORD` - Password for actuator endpoints (generate with `openssl rand -base64 48 | head -c 64`)
The checked-in [SecurityConfig.java](../../src/main/java/org/patinanetwork/codebloom/api/auth/security/SecurityConfig.java) permits these requests and does not configure HTTP Basic authentication or an `ACTUATOR` role. `ACTUATOR_USERNAME` and `ACTUATOR_PASSWORD` are not wired into the application configuration. Any access restrictions applied by deployment infrastructure must be checked in that infrastructure separately.

### Available Endpoints

Currently exposed endpoints:

- **`/actuator/health`** - Application health
- **`/actuator/prometheus`** - Prometheus-formatted metrics endpoint for scraping

## Prometheus Metrics
Expand All @@ -45,7 +38,7 @@ Prometheus metrics provide detailed insights into application performance, JVM s
http://localhost:8080/actuator/prometheus
```

(Requires HTTP Basic Auth with actuator credentials)


**Staging:**

Expand All @@ -63,12 +56,10 @@ https://codebloom.patinanetwork.org/actuator/prometheus

To test the actuator endpoint locally:

1. Ensure your `.env` file has `ACTUATOR_USERNAME` and `ACTUATOR_PASSWORD` set
2. Start the application (`just dev`)
3. Access the endpoint using curl:
1. Start the application (`just dev`).
2. Request an exposed endpoint:

```bash
curl -u actuator:your_password http://localhost:8080/actuator/prometheus
curl http://localhost:8080/actuator/prometheus
curl http://localhost:8080/actuator/health
```

Or use a browser and enter the username/password when prompted.
2 changes: 1 addition & 1 deletion email/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ These templates are then built into `*.html` files which are then loaded at runt
### Run

1. Run `pnpm i` to install all dependencies
1. Run `just dev` from the root directory to run the React Email dev server with sane defaults
1. Run `just email-dev` from the root directory to run the React Email dev server with sane defaults
1. Run `pnpm build` to build all React Email files under `emails/`
1. If you would like to build & copy all template files to the backend, run `just email-gen` from the root directory

Expand Down
6 changes: 3 additions & 3 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# `infra/`

> [!NOTE]
> Our staging to production migration script is located [here](https://github.com/tahminator/codebloom/tree/main/.github/scripts/copy-prod-db/index.ts#L28).
> Our production to staging copy script is located [here](https://github.com/tahminator/codebloom/tree/main/.github/scripts/copy-prod-db/index.ts#L28).

[`clean-stg-db.SQL`](./clean-stg-db.SQL) is a SQL script used to clean and scramble staging data after copying the production database.

This directory contains the Dockerfile used to build the main Codebloom image, which is then uploaded to [hub.docker.com/r/tahminator/codebloom](https://hub.docker.com/r/tahminator/codebloom).
This directory contains the Dockerfile used to build the main Codebloom image, which is then uploaded to [hub.docker.com/r/patinanetwork/codebloom](https://hub.docker.com/r/patinanetwork/codebloom).

The image is then deployed to our Kubernetes cluster (docs WIP).
The redeploy script opens an image-tag PR in `Patina-Network/k8s-manifests` for deployment to our Kubernetes cluster.

There is a Bun Shell script which helps us manage the workflow for deployments across production and staging, which can be found at [`.github/scripts/redeploy/index.ts`](../.github/scripts/redeploy/index.ts).
6 changes: 3 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ src/main

### Security Details

- **CSRF Protection** - Automatically managed by Spring Security, so no additional configuration is required.
- **CSRF Protection** - Disabled in the main OAuth security chain.
- **Auth Validator / Session Token Cookie Setter** - Managed by the `CustomAuthenticationSuccessHandler`.
- Cookie Settings:
- Name: `session_token`
Expand Down Expand Up @@ -229,10 +229,10 @@ The [`LeetcodeClient.java`](https://github.com/tahminator/codebloom/blob/main/sr

We have a scheduled task at [`LeetcodeAuthStealer.java`](https://github.com/tahminator/codebloom/blob/main/src/main/java/org/patinanetwork/codebloom/scheduled/auth/LeetcodeAuthStealer.java) that:

- Runs every 30 minutes to refresh session cookies
- Runs hourly and reuses database session cookies less than four hours old
- Uses Playwright to automate GitHub OAuth login flow
- Stores the `LEETCODE_SESSION` cookie in our database
- Falls back to email alerts if authentication fails
- Supports asynchronous cookie reloads when authentication needs refreshing

This is necessary because leetcode.com requires authenticated requests for most API calls.

Expand Down
Loading