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.
- Host: GitHub
- URL: https://github.com/bighnesh0007/dwcode
- Owner: bighnesh0007
- License: mit
- Created: 2026-06-20T09:24:18.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2026-07-26T15:37:32.000Z (14 days ago)
- Last Synced: 2026-07-26T16:10:13.304Z (14 days ago)
- Topics: coding-challenges, dataweave, integration, learning-platform, mule, mulesoft, nextjs, open-source, playground, typescript
- Language: TypeScript
- Homepage: https://dwcode.vercel.app
- Size: 908 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README

**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)











## π 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.** β