Monorepo Structure
Relevant source files
The following files were used as context for generating this wiki page:
The wrelik-kit repository is a centralized monorepo containing shared packages, vendor-agnostic adapters, and configuration utilities for the Wrelik ecosystem. It serves as an infrastructure layer designed to standardize integrations between application code and third-party services, ensuring that individual applications do not directly depend on vendor SDKs.
Sources: README.md:1-10, DECISIONS.md:15-20
Architecture Overview
The monorepo follows an Adapter-First Architecture. Instead of applications importing vendor SDKs directly, they consume standardized wrappers provided by @wrelik/* packages. This structure enforces a strict integration boundary, reduces vendor lock-in, and simplifies the API surface area for application developers.
Sources: README.md:13-20, DECISIONS.md:15-20
Workspace Management
The project uses pnpm for package management and Turborepo for task orchestration. Changes are managed through Changesets to automate versioning and releases.
The diagram above illustrates the logical grouping of packages within the monorepo.
Sources: README.md:23-53, package.json:7-17
Package Categories
The monorepo organizes its 10+ packages into three primary functional areas: Core, Services, and Tooling.
Core Packages
These provide fundamental infrastructure components required by most applications.
| Package | Vendor | Purpose |
|---|---|---|
@wrelik/auth | Clerk | Authentication, session handling, and RBAC. |
@wrelik/db | Neon (Prisma) | Prisma client singleton and multi-tenant access helpers. |
@wrelik/storage | Cloudflare R2 | S3-compatible storage for uploads and downloads. |
@wrelik/config | - | Typed environment variable loading using Zod. |
@wrelik/errors | Sentry | Typed application errors and centralized tracking. |
Sources: README.md:25-40, DECISIONS.md:3-13
Service Adapters
These packages wrap specific third-party service providers to standardize how applications interact with external APIs.
- @wrelik/analytics: PostHog adapter for server-side event tracking.
- @wrelik/email: Resend adapter for transactional emails and templates.
- @wrelik/jobs: Inngest wrapper for background jobs and event-driven logic.
Sources: README.md:43-53, DECISIONS.md:3-13
Tooling and Configuration
These packages provide shared developer experience (DX) settings across the monorepo and consuming applications.
- @wrelik/tsconfig: Shared TypeScript base configurations.
- @wrelik/eslint-config: Centralized ESLint rules that strictly enforce the "adapter-first" policy.
Sources: README.md:55-60, packages/eslint-config/index.js:15-45
Dependency Enforcement
The monorepo uses ESLint to enforce the architectural boundary. The @wrelik/eslint-config package contains a no-restricted-imports rule that prevents developers from bypassing the adapters.
// Example from packages/eslint-config/index.js
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{ name: '@clerk/nextjs', message: 'Please use @wrelik/auth instead.' },
{ name: '@prisma/client', message: 'Please use @wrelik/db instead.' },
{ name: 'resend', message: 'Please use @wrelik/email instead.' }
]
}
]
}
Sources: packages/eslint-config/index.js:15-45
Development Workflow
Adding a New Package
The repository follows a standardized process for adding new modules to the packages/ directory:
- Initialize
package.jsonwith the@wrelik/scope. - Add
@wrelik/tsconfigand@wrelik/eslint-configas dev dependencies. - Implement logic in
src/index.ts. - Add tests using
vitest.
Sources: CONTRIBUTING.md:3-9
Release Process
The monorepo uses a changeset-based workflow to manage versioning across multiple packages.
The sequence diagram shows the automated release cycle using Changesets.
Sources: CONTRIBUTING.md:20-33
Summary
The wrelik-kit monorepo structure is designed to be "intentionally boring" and infrastructure-focused. By centralizing all vendor integrations into a single repository of versioned adapters, the ecosystem achieves high consistency, enforces security standards (such as RBAC and multi-tenancy), and simplifies the process of swapping third-party providers without requiring changes to application-level business logic.
Sources: README.md:7-10, DECISIONS.md:15-20