Welcome to DRAP: the Draft Ranking Automated Processor for the University of the Philippines Diliman - Department of Computer Science's yearly draft of research lab assignments. In a nutshell, this web application automates the mechanics of the draft:
flowchart TD
subgraph External
direction LR
User[Browser]
Google[Google OAuth]
end
subgraph Production
SvelteKit[DRAP:3000]
Drizzle[DrizzleGateway:4983]
subgraph database [database]
Postgres[(PostgreSQL:5432)]
end
subgraph durability [durability]
direction LR
Inngest[Inngest:8288]
SQLite[(SQLite)]
end
subgraph queue [queue]
Redis[(Redis:6379)]
end
subgraph telemetry [telemetry]
O2[OpenObserve:5080]
end
end
User <--> SvelteKit
Google <-->|OAuth| SvelteKit
SvelteKit <--> Postgres
SvelteKit <--> Inngest
SvelteKit -.->|OpenTelemetry| O2
Inngest <--> Redis
Inngest <--> SQLite
Drizzle <--> Postgres
At runtime, the server requires the following environment variables to be present.
| Variable | Description |
|---|---|
ORIGIN |
Server origin (e.g., https://drap.dcs.upd.edu.ph). |
PUBLIC_ORIGIN |
Public origin for meta tags (same as ORIGIN). |
GOOGLE_OAUTH_CLIENT_ID |
OAuth 2.0 credentials retrieved from the [Google Cloud Console]. |
GOOGLE_OAUTH_CLIENT_SECRET |
OAuth 2.0 credentials retrieved from the [Google Cloud Console]. |
INNGEST_EVENT_KEY |
Inngest event signing key. Required only in production. |
INNGEST_SIGNING_KEY |
Inngest webhook signing key. Required only in production. |
POSTGRES_URL |
The connection string to the PostgreSQL instance. |
DRAP_ENABLE_EMAILS |
Enable real email sending. Disabled by default. |
[!IMPORTANT] The OAuth redirect URI is computed as
${ORIGIN}/dashboard/oauth/callback.
The following variables are optional in development, but highly recommended in the production environment for OpenTelemetry integration. The standard environment variables are supported, such as (but not limited to):
| Name | Description | Recommended |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT |
The base OTLP endpoint URL for exporting logs, metrics, and traces. | http://localhost:5080/api/default |
OTEL_EXPORTER_OTLP_HEADERS |
Extra percent-encoded HTTP headers used for exporting telemetry (e.g., authentication). | Authorization=Basic%20YWRtaW5AZXhhbXBsZS5jb206cGFzc3dvcmQ%3D |
OTEL_EXPORTER_OTLP_PROTOCOL |
The underlying exporter protocol (e.g., JSON, Protobufs, gRPC, etc.). | http/protobuf |
[!NOTE] The "recommended" values are only applicable to the development environment with OpenObserve running in the background. See the
compose.yamlfor more details on the OpenObserve configuration.
# Install dependencies.
pnpm install
# Check formatting.
pnpm fmt
# Apply formatting auto-fix.
pnpm fmt:fix
# Generate Drizzle migrations.
pnpm db:generate
# Apply migrations.
pnpm db:migrate
# Open Drizzle Studio UI.
pnpm db:studio
[!IMPORTANT] You must run
pnpm db:migrateon a fresh database in order to initialize the tables.
# Check linting rules.
pnpm lint:eslint
pnpm lint:svelte
# Perform all lints in parallel.
pnpm lint
The project uses layered Docker Compose files for different environments.
flowchart TD
subgraph Base
base[compose.yaml]
end
subgraph Development
dev[compose.dev.yaml]
end
subgraph Production
ci[compose.ci.yaml]
prod[compose.prod.yaml]
app[compose.app.yaml]
end
base --> dev
base --> ci --> prod --> app
| Command | Files | Services |
|---|---|---|
pnpm docker:dev |
compose.yaml + compose.dev.yaml |
postgres (dev), inngest (dev), o2 (dev) |
pnpm docker:ci |
compose.yaml + compose.ci.yaml |
postgres (prod), inngest (prod), redis |
pnpm docker:prod |
... + compose.prod.yaml |
CI services + o2 (prod), drizzle-gateway |
pnpm docker:app |
... + compose.app.yaml |
prod services + app |
[!NOTE] Docker BuildKit is required to build the local services used during development. In most platforms, Docker Desktop bundles the core Docker Engine with Docker BuildKit. For others (e.g., Arch Linux), a separate
docker-buildx-like package must be installed.This requirement is due to the fact that the custom PostgreSQL image uses the
TARGETARCHbuild argument, which is typically automatically populated by Docker BuildKit.
# Run dev services (compose.yaml + compose.dev.yaml):
# postgres, inngest (dev mode), o2
pnpm docker:dev
# Run the Vite dev server for SvelteKit.
pnpm dev
# Build the main web application (SvelteKit).
pnpm build
# Run the Vite preview server for SvelteKit.
pnpm preview
# Alternatively, run the Node.js script directly.
node --env-file=.env build/index.js
# Or, spin up CI services (compose.yaml + compose.ci.yaml):
# postgres, inngest (prod mode), redis
pnpm docker:ci
# Or, spin up production internal services (+ compose.prod.yaml):
# CI services + o2, drizzle-gateway
pnpm docker:prod
# Or, spin up full production environment (+ compose.app.yaml):
# prod services + app
pnpm docker:app
To enable full observability in local development:
pnpm docker:dev
export OTEL_EXPORTER_OTLP_ENDPOINT='http://localhost:5080/api/default'
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=Basic%20YWRtaW5AZXhhbXBsZS5jb206cGFzc3dvcmQ%3D'
export OTEL_EXPORTER_OTLP_PROTOCOL='http/protobuf'
pnpm dev
http://localhost:5080.The Playwright configuration runs pnpm preview on port 4173 in production mode by default. A single end-to-end test features a single full draft round.
# Ensure development-only services are spun up. We _can_ use the production setup,
# but that requires a little bit more configuration. This is done in CI, but not
# necessary for local development.
pnpm docker:dev
# Build first (required by playwright.config.js webServer command).
pnpm build
# Load only .env:
source ./scripts/test-playwright.sh
source ./scripts/test-playwright.sh development
source ./scripts/test-playwright.sh production
source ./scripts/test-playwright.sh staging
# Load only .env:
nu ./scripts/test-playwright.nu
# Load .env + .env.<environment> + .env.<environment>.local:
nu ./scripts/test-playwright.nu development
nu ./scripts/test-playwright.nu production
The DRAP project, licensed under the GNU Affero General Public License v3, was originally developed by Sebastian Luis S. Ortiz, Victor Edwin E. Reyes, and Ehren A. Castillo as a service project under the UP Center for Student Innovations. The DRAP logo and banner were originally designed and created by Angelica Julianne A. Raborar.