A space where you open a challenge and
A small workshop for engineers. A place filled with interesting problems: bugs hiding somewhere, features that need building, code that works but needs a refactoring. Come try your hand.
Get early access- feature challenges
- debugging challenges
- refactor challenges
- full cycle challenges
A Place To Poke Around
Whether you’ve just finished a tutorial, are prepping for an interview, or want a little challenge, Widebase is a space to explore, learn, practice, and have fun. Open a challenge, fix bugs, add features, refactor, and run tests. See what you can build.
What a challenge feels like
You’re dropped into a small working project - in the stack of your choice. Explore the structure, see how the pieces fit together, and get familiar with the flow.
Step into the system
You’re dropped into a small working project - in the stack of your choice. Your first goal is to understand how it behaves and how the pieces connect.
app/
├── Http/Controllers/
│ ├── OrderController.php
│ ├── ProductController.php
│ └── Api/InventoryController.php
├── Models/
│ ├── Order.php
│ └── Product.php
├── Services/
│ └── PurchaseService.php
├── database/migrations/
└── tests/Feature/
└── StockManagementTest.php
src/
├── routes/
│ ├── orders.js
│ ├── products.js
│ └── inventory.js
├── models/
│ ├── Order.js
│ └── Product.js
├── services/
│ └── purchaseService.js
├── middleware/
│ └── auth.js
└── __tests__/
└── stockManagement.test.js
inventory/
├── views/
│ ├── orders.py
│ ├── products.py
│ └── purchase.py
├── models/
│ ├── order.py
│ └── product.py
├── serializers/
│ └── inventory.py
├── migrations/
└── tests/
└── test_stock_management.py
src/main/java/com/app/
├── controller/
│ ├── OrderController.java
│ └── InventoryController.java
├── model/
│ ├── Order.java
│ └── Product.java
├── service/
│ └── PurchaseService.java
├── repository/
│ └── ProductRepository.java
└── src/test/java/
└── StockManagementTest.java
internal/
├── handlers/
│ ├── orders.go
│ ├── products.go
│ └── inventory.go
├── models/
│ ├── order.go
│ └── product.go
├── services/
│ └── purchase.go
├── middleware/
│ └── auth.go
└── tests/
└── stock_management_test.go
src/
├── app/
│ ├── api/orders/route.ts
│ ├── api/products/route.ts
│ └── api/inventory/route.ts
├── lib/
│ ├── models/order.ts
│ ├── models/product.ts
│ └── services/purchase.ts
├── prisma/
│ └── schema.prisma
└── __tests__/
└── stockManagement.test.ts
Understand the problem and come up with a solution
A bug, missing feature, or confusing logic shows up. Decide what to change, trace the behavior, and then plan and implement your fix before running the tests.
## Fix Stock Race Condition
Difficulty: Hard · 60-90 min
Skills: DB Transactions, Pessimistic
Locking, Concurrency
The purchase endpoint has a classic race
condition. Two concurrent buyers can both
pass the stock check and decrement -
leaving stock at -1.
Use transactions + locking to prevent
overselling. Don't break existing tests.
Run the tests
Apply your solution and run the tests. Some pass, some fail. Each round gives feedback on what works and what doesn’t, letting you adjust and try again.
> Validating solution...
✓ stock_never_goes_negative ........ PASS
✓ concurrent_purchases_handled ..... PASS
✓ sold_out_returns_409 ............. PASS
✓ successful_purchase_decrements ... PASS
✓ order_created_on_success ......... PASS
5 passed - Challenge complete.
Types of challenges
Four ways to practice engineering thinking inside systems.
FEATURE CHALLENGES
Add a new piece of functionality to an existing system. Maybe a new endpoint, a UI component, or a small service. You read the code, figure out where your change belongs, implement it, and make sure everything still works.
DEBUGGING CHALLENGES
Fix a problem hidden in the system. It could be a race condition, an incorrect calculation, or a failing query. You trace through controllers, services, and models to locate the source and correct it.
REFACTOR CHALLENGES
Improve the design of existing code without changing behavior. Clean up messy logic, simplify functions, reorganize components, or make the system easier to maintain, all while keeping tests green.
FULL CYCLE CHALLENGES
Combine feature addition, debugging, and refactoring in one task. A system might have a missing feature, a subtle bug, and a messy implementation. You tackle all three, simulating what it's like to work on a real engineering task from start to finish.
A few problems you might run into
Open a challenge, read through the code, and figure out how to make it behave.
Stock Race Condition
Context
The purchase endpoint checks and decrements product stock without a transaction or locking. When two users buy the last item at the same time, both requests can pass the stock check.
This can result in:
- stock dropping below zero
- partially completed purchases when one item in a multi-item order fails
Your task
- Wrap the purchase logic in a database transaction
- Use row-level locking when reading product stock
- If any item fails the stock check, roll back the entire transaction
- Return a 409 response when stock is insufficient
Modify
app/Http/Controllers/Api/InventoryController.php
Hints
- Transactions automatically roll back on exceptions
- Row-level locks prevent concurrent reads of the same row
- Throwing an exception inside the transaction triggers rollback
Concepts
People come here for different reasons
Some use it to warm up for interviews. Some are students looking for harder problems than tutorials. Some already work as engineers and want a place to experiment with exciting challenges.
All those paths lead here.
Get Early Access
Be part of the early group exploring Widebase.