An open API service indexing awesome lists of open source software.

https://github.com/bighnesh0007/dwcode

A LeetCode-style practice platform for MuleSoft DataWeave β€” problems, a live playground, contests and AI-assisted learning.
https://github.com/bighnesh0007/dwcode

coding-challenges dataweave integration learning-platform mule mulesoft nextjs open-source playground typescript

Last synced: 6 days ago
JSON representation

A LeetCode-style practice platform for MuleSoft DataWeave β€” problems, a live playground, contests and AI-assisted learning.

Awesome Lists containing this project

README

          

DWCode banner


Typing SVG



**A LeetCode-style coding platform built exclusively for MuleSoft DataWeave developers.**

Practice data transformations, compete in timed contests, and sharpen your skills with AI-generated problems β€” all in a browser-based Monaco editor connected to a live DataWeave 2.0 compiler.

Stop practicing transformations in a scratch Anypoint project you'll never open again.
Solve real problems. Race the clock. Climb the leaderboard. Let AI throw new challenges at you until `%dw 2.0` feels like a second language.


### 🎬 [**β–Ά Watch the 2-minute Demo**](https://drive.google.com/file/d/1fK-xpvf82gxItmtEjhcHu2E9O9FS8vcX/view?usp=drive_link)


![Next.js](https://img.shields.io/badge/Next.js_16-061A3A?style=for-the-badge&logo=next.js&logoColor=white)
![React](https://img.shields.io/badge/React_19-00A0DF?style=for-the-badge&logo=react&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript_5-00A0DF?style=for-the-badge&logo=typescript&logoColor=white)
![MongoDB](https://img.shields.io/badge/MongoDB-00C9D6?style=for-the-badge&logo=mongodb&logoColor=white)
![Clerk](https://img.shields.io/badge/Clerk_Auth-8B5CF6?style=for-the-badge&logo=clerk&logoColor=white)
![Gemini](https://img.shields.io/badge/Gemini_2.5_Flash-00A0DF?style=for-the-badge&logo=google&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-00C9D6?style=for-the-badge&logo=docker&logoColor=white)

![Open Source](https://img.shields.io/badge/OPEN_SOURCE-πŸ’œ_our_gift_to_the_community-8B5CF6?style=for-the-badge)
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-00A0DF?style=for-the-badge)
![Made for Muleys](https://img.shields.io/badge/🐴_Made_for-Muleys-061A3A?style=for-the-badge)

## 🌍 Why DWCode Exists

Every MuleSoft developer knows the feeling: you can wire up an API in your sleep, but hand you a gnarly `groupBy` β†’ `pluck` β†’ `reduce` chain under interview pressure and suddenly the docs are open in three tabs.

DataWeave is a language. Languages get sharp with **reps**, not tutorials.

DWCode is the dojo. It gives you an endless supply of curated and AI-generated transformation puzzles, a real compiler to check your work against hidden test cases, and a scoreboard that turns "I should practice more" into "I'm rank #3 and I'm not stopping."

> **Built by the community, for the community.** πŸ’œ

## ✨ Features

### πŸ‹οΈ Problem Workspace β€” _your training ground_
The main event. A clean split-pane battle station:

- **Split-pane layout**: Problem description | Monaco editor | Console β€” everything in one view, zero context-switching
- **Run** code against custom JSON input, or click **Submit** to evaluate all test cases at once
- Real-time **pass/fail feedback** with per-test-case diff output β€” see exactly where your output drifted
- Built-in **countdown timer** to simulate interview pressure (or just keep you honest)
- **Bookmark** any problem for later revision
- **Reveal Solution** toggle with optional hints
- **My Notes** tab β€” auto-saved, per-problem markdown notes so future-you remembers the trick
- **Discussion** tab β€” comment thread per problem

### πŸ€– AI Problem Generator β€” _the endless boss fight_
Never run out of problems again.

- **One-click generation** via Google Gemini 2.5 Flash
- Configure **difficulty** (Easy / Medium / Hard), **category**, and an optional **topic**
- Returns a *full* problem: description, examples, constraints, starter code, test cases, hidden test cases, hints, and a reference solution
- Problems are saved immediately to the database and appear in the problem list

### πŸ† Contests β€” _prove it under pressure_
- Create time-boxed contests with any subset of problems
- **Public** or **invite-code-only** visibility
- Auto-computed status: `upcoming` β†’ `active` β†’ `ended`
- Participant scoring: **Hard Γ—5, Medium Γ—3, Easy Γ—1**

### πŸ“Š Leaderboard β€” _the wall of legends_
- Global ranking based on weighted score across all accepted submissions
- Per-user breakdown: Easy / Medium / Hard solved, acceptance rate, total submissions
- **Live aggregation** β€” no manual sync required

### πŸ› Free Playground β€” _no rules, just DataWeave_
- Standalone editor with no problem constraints β€” bring your own chaos
- Three-panel layout: **Input payload** | **DataWeave script** | **Output**
- Instant execution, copy-to-clipboard, reset, and execution time display

### ✍️ Blog β€” _the community's brain_
- Community blog with full CRUD
- Write posts using a rich text editor; published posts are publicly visible

### πŸ‘€ User Profiles β€” _your story so far_
- Progress overview: total solved, by difficulty, bookmarks
- Submission history and personal stats

### πŸͺ™ Coins System β€” _because winning should feel good_
- Gamification layer: earn coins for accepted solutions
- Transaction history visible in user profile

### πŸ” Admin Panel β€” _mission control_
- Role management and user administration via dedicated `/admin` routes
- Protected by Clerk authentication and custom role checks

## πŸ— Tech Stack

Every piece was chosen to keep the loop tight: **write DataWeave β†’ run against a real compiler β†’ get instant truth.**

| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| Language | TypeScript 5 |
| UI | Tailwind CSS v4, shadcn/ui, Lucide Icons |
| Editor | Monaco Editor (`@monaco-editor/react`) |
| Auth | Clerk (`@clerk/nextjs`) |
| Database | MongoDB via Mongoose |
| AI | Google Gemini 2.5 Flash (`@google/genai`) |
| State | Zustand |
| Compiler Backend | DataWeave runtime (Docker / external service) |
| Containerisation | Docker Compose |
| Font | Geist (via `next/font`) |

## πŸš€ Getting Started

> From `git clone` to green checkmarks in five steps.

### Prerequisites

- **Node.js** β‰₯ 18
- **Docker** (for MongoDB and optional DataWeave compiler backend)
- A **Clerk** account β€” [clerk.com](https://clerk.com)
- A **Google Gemini** API key β€” [ai.google.dev](https://ai.google.dev)

### 1. Clone & Install

The Next.js application lives in the **`client/`** directory; there is no root `package.json`.
All npm commands below run from `client/`.

```bash
git clone https://github.com/your-username/dwcode.git
cd dwcode/client
npm install
```

### 2. Environment Variables

Create `client/.env.local` and fill in your values:

```bash
# from the repo root
touch client/.env.local
```

```env
# client/.env.local

# MongoDB connection string
MONGODB_URI=mongodb://localhost:27017/dwcode

# Google Gemini API key (for AI problem generation)
GEMINI_API_KEY=your_gemini_api_key_here

# Clerk authentication keys (from your Clerk dashboard)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...

# Clerk redirect paths
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
```

### 3. Start MongoDB

From the **repo root** (`docker-compose.yml` lives there, not in `client/`):

```bash
docker-compose up -d
```

This spins up a MongoDB instance at `localhost:27017` with a persistent volume.

### 4. Start the DataWeave Compiler Backend

The code execution engine is a separate DataWeave runtime service. By default the app points to `https://dwlbackend.onrender.com`. To run it locally, start the companion Docker container and update `DATAWEAVE_BACKEND_URL` in your env file accordingly.

### 5. Run the Development Server

```bash
cd client
npm run dev
```

The app starts on **[http://localhost:8000](http://localhost:8000)** β€” open it, pick a problem, and start transforming. πŸŽ‰

## πŸ“‚ Project Structure

The repo root holds infrastructure and docs; the entire Next.js application lives in `client/`.

```
dwcode/
β”œβ”€β”€ client/ # β—€ THE NEXT.JS APP (run npm here)
β”‚ β”œβ”€β”€ app/ # App Router pages & API routes
β”‚ β”‚ β”œβ”€β”€ api/ # REST API handlers
β”‚ β”‚ β”‚ β”œβ”€β”€ execute/ # DataWeave code execution proxy
β”‚ β”‚ β”‚ β”œβ”€β”€ transform/ # Playground execution proxy (multi-input)
β”‚ β”‚ β”‚ β”œβ”€β”€ generate/ # AI problem generation (Gemini)
β”‚ β”‚ β”‚ β”œβ”€β”€ problems/ # Problem CRUD
β”‚ β”‚ β”‚ β”œβ”€β”€ submissions/ # Submission tracking
β”‚ β”‚ β”‚ β”œβ”€β”€ contests/ # Contest management
β”‚ β”‚ β”‚ β”œβ”€β”€ leaderboard/ # Score aggregation
β”‚ β”‚ β”‚ β”œβ”€β”€ bookmarks/ # Bookmark toggle
β”‚ β”‚ β”‚ β”œβ”€β”€ notes/ # Per-problem notes
β”‚ β”‚ β”‚ β”œβ”€β”€ coins/ # Gamification coins
β”‚ β”‚ β”‚ β”œβ”€β”€ blog/ # Blog posts
β”‚ β”‚ β”‚ β”œβ”€β”€ comments/ # Problem discussion threads
β”‚ β”‚ β”‚ β”œβ”€β”€ profile/ # Profile, username, follow
β”‚ β”‚ β”‚ β”œβ”€β”€ auth/github/ # GitHub OAuth flow
β”‚ β”‚ β”‚ β”œβ”€β”€ playground/ # Share, AI insights, GitHub import/push
β”‚ β”‚ β”‚ └── admin/ # Admin: users & roles
β”‚ β”‚ β”œβ”€β”€ problems/[slug]/ # Problem workspace (split-pane editor)
β”‚ β”‚ β”œβ”€β”€ playground/ # Free DataWeave playground
β”‚ β”‚ β”œβ”€β”€ contests/ # Contest list & detail
β”‚ β”‚ β”œβ”€β”€ leaderboard/ # Global leaderboard
β”‚ β”‚ β”œβ”€β”€ blog/ # Blog list, detail & editor
β”‚ β”‚ β”œβ”€β”€ profile/ # User profile page
β”‚ β”‚ β”œβ”€β”€ create/ # Manual problem creation form
β”‚ β”‚ └── admin/ # Admin dashboard
β”‚ β”œβ”€β”€ components/ # Shared UI components (Navbar, Comments, etc.)
β”‚ β”œβ”€β”€ models/ # Mongoose schemas (Problem, Submission, Contest…)
β”‚ β”œβ”€β”€ lib/ # Database connection, config, utilities
β”‚ β”œβ”€β”€ public/ # Static assets
β”‚ β”œβ”€β”€ __tests__/ # Vitest property-based tests
β”‚ β”œβ”€β”€ proxy.ts # Clerk middleware (Next.js 16 naming)
β”‚ β”œβ”€β”€ package.json # Dependencies & scripts
β”‚ β”œβ”€β”€ next.config.ts # output: "standalone"
β”‚ β”œβ”€β”€ tsconfig.json # "@/*" β†’ client root
β”‚ └── .env.local # Local secrets (gitignored)
β”œβ”€β”€ .github/workflows/ # CI (runs with working-directory: client)
β”œβ”€β”€ .agents/ Β· .kiro/ # Agent skills & feature specs
β”œβ”€β”€ docker-compose.yml # MongoDB container
β”œβ”€β”€ Dockerfile # App image (build context = repo root)
└── README.md
```

## πŸ”‘ Key API Routes

| Method | Route | Description |
|--------|-------|-------------|
| `GET/POST` | `/api/problems` | List or create problems |
| `POST` | `/api/execute` | Run DataWeave code |
| `POST` | `/api/generate` | Generate problem with AI |
| `GET/POST` | `/api/contests` | List or create contests |
| `GET` | `/api/leaderboard` | Fetch ranked leaderboard |
| `POST` | `/api/submissions` | Submit a solution |
| `GET/POST` | `/api/bookmarks` | Toggle bookmark |
| `GET/PUT` | `/api/notes` | Read/write problem notes |
| `GET` | `/api/coins` | User coin balance |
| `GET/POST` | `/api/blog` | Blog post management |
| `GET/POST` | `/api/comments` | Problem discussion |

## 🐳 Docker

Start only MongoDB (from the repo root):

```bash
docker-compose up -d
```

Build and run the full app in Docker. The build context is the **repo root** (the Dockerfile
copies from `client/`), so run this from the root, not from `client/`:

```bash
docker build -t dwcode .
docker run -p 3000:3000 --env-file client/.env.local dwcode
```

> **Note:** the image listens on port **3000** (`ENV PORT 3000` in the Dockerfile), whereas
> `npm run dev` and `npm start` use port **8000**. Map ports accordingly.

## πŸš€ Deployment

The two halves deploy independently.

| Part | Platform | Config | Why |
|---|---|---|---|
| `client/` | **Vercel** | [client/vercel.json](client/vercel.json) | Native Next.js hosting |
| `server/` | **Render** | [render.yaml](render.yaml) | Long-lived Express process |

**The backend cannot run on Vercel.** It calls `app.listen()`, holds a MongoDB
connection pool, and runs a periodic upstream heartbeat β€” none of which survive a
serverless runtime that freezes between invocations.

### Frontend β†’ Vercel

Create the project, then **set Root Directory to `client`** in Settings β†’ General.
That one setting is what makes the monorepo work; everything else is auto-detected.

Required environment variables:

```
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
CLERK_SECRET_KEY
NEXT_PUBLIC_API_URL # the deployed Render URL
NEXT_PUBLIC_APP_URL # the deployed Vercel URL
MONGODB_URI # until the API migration finishes
```

### Backend β†’ Render

Dashboard β†’ **Blueprints** β†’ New Blueprint Instance, pointed at `render.yaml`.
It declares the build/start commands, `/health` as the health check, and every
environment variable. Secrets are marked `sync: false`, so Render prompts for them
instead of reading values from git.

After the first deploy, two values must agree or the browser will be blocked by CORS:

- `CORS_ALLOWED_ORIGINS` on Render must contain the Vercel origin.
- `NEXT_PUBLIC_API_URL` on Vercel must be the Render URL.

The service also keeps the frozen legacy endpoints β€” `POST /api/transform`,
`/health`, `/healthcheck` β€” byte-compatible with the original `server.js`, so
existing callers continue to work unchanged.

## πŸ—Ί Roadmap Ideas

_Want to help shape where DWCode goes next? These are open for the taking:_

- πŸ“… Daily challenge streaks (keep the muscle warm)
- 🏒 Company-tagged problem sets for interview prep
- 🧡 DataWeave "pattern of the week" community writeups
- πŸ₯‡ Team leagues and seasonal contests

_Have an idea? Open an issue and let's talk._

## 🎁 Our Gift to the MuleSoft Community

> **DWCode is open source β€” because the best integrations are the ones we build together.** πŸ΄πŸ’œ

We didn't build DWCode to lock it away behind a paywall. We built it because we *are* the MuleSoft community β€” and every Muley deserves a place to sharpen their DataWeave without spinning up yet another throwaway Mule app.

So here it is. **Free. Open. Yours.** Fork it, self-host it, remix it, ship it. This is our contribution to the flow β€” now add yours.

**Every Muley makes the mule stronger.** Here's how you can plug in:

- 🧩 **Add a problem** β€” dreamt up a devious transformation? Drop it in and stump the leaderboard.
- πŸ› **Squash a bug** β€” see something misbehaving? A PR is worth a thousand issues.
- πŸ“– **Write a blog post** β€” teach a DataWeave pattern that took *you* three hours to crack.
- ✨ **Build a feature** β€” the roadmap above is a menu, not a limit.
- ⭐ **Star the repo** β€” the cheapest, kindest way to say "keep going."

```dataweave
%dw 2.0
output application/json
var community = payload.developers
---
{
status: "open source, forever",
gift: "DWCode",
from: "us",
to: "the MuleSoft community",
yourMove: community map (dev) -> dev ++ { contributed: true }
}
```

> _An API is only as good as the community that connects to it. Same goes for a practice platform._ πŸ”Œ

## 🀝 Contributing

DWCode gets better every time a MuleSoft dev throws in a problem, fixes a bug, or writes a blog post. Jump in:

1. Fork the repo and create a feature branch: `git checkout -b feat/your-feature`
2. Install **from the repository root** β€” this is an npm workspace: `npm install`
3. Make your changes, then verify: `npm run typecheck && npm run lint && npm test && npm run build`
4. Open a pull request with a clear description

**[CONTRIBUTING.md](CONTRIBUTING.md) has the full guide** β€” repository layout,
the rule about never hand-writing a problem's expected output, database
migration conventions, and the gotchas that bite newcomers.

Please also read our [Code of Conduct](CODE_OF_CONDUCT.md).

Every contribution β€” a single test case or a whole new feature β€” makes the whole community sharper. πŸ™Œ

## πŸ“„ License

[MIT](LICENSE) β€” feel free to use, fork, and extend. Go build something great.

Found a security issue? Please report it privately β€” see [SECURITY.md](SECURITY.md).


```dataweave
%dw 2.0
output application/json
---
{
project: "DWCode",
builtWith: "πŸ’œ",
gift: "open source, to the MuleSoft community",
from: "one Muley to every Muley",
message: "Keep weaving. Keep shipping. Keep leveling up.",
yourTurn: "fork it β†’ improve it β†’ give it back"
}
```


⭐ **If DWCode helped you level up, drop a star β€” it fuels the mission.** ⭐

DWCode footer