A full-stack application that integrates with the Rebrickable API to allow users to search, manage, and customize LEGO sets by adding or modifying parts within their personal set lists.
These are the key files that handle the core logic of the application:
lego-backend/.env→ Environment configuration (API keys, database, etc.)lego-backend/app/Providers/AppServiceProvider.php→ Ensure the env values are valid in boot()lego-backend/routes/api.php→ API route definitionslego-backend/app/Http/Controllers/LegoController.php→ Main controller handling API requests
lego-frontend/src/api/legoApi.js→ API calls and request handlinglego-frontend/src/App.js→ Main React component for UI and logic
✅ Basic User Authentication (to generate user token)
✅ Fetch User's Set Lists and cache results for performance
✅ Create a New User Set List (if none exist)
✅ Fetch Sets in Selected User Lists
✅ CRUD Operations on Sets in User Lists
✅ Search & Add Global LEGO Sets
✅ Fetch & Search Parts of LEGO Sets
- CRUD for User’s Set Lists
- CRUD for Parts within User’s Sets
- Pagination for Improved Performance
- Search by LEGO Part Names
- Double Confirmation Dialogs Before Actions
- Refactor UI into Modular Components
- Serialize Backend 3rd-Party API Responses into Models
- Dockerize the Setup for Easy Deployment
-
Clone the Repository
git clone git@github.com:khaledalam/lego.git
-
Navigate to the Backend Directory
cd lego-backend -
Create & Configure .env File
cp .env.example .env
Update the following API keys inside .env:
REBRICKABLE_API_KEY=ee1aa3371d56d497ae073aa4b7aec8e0 REBRICKABLE_API_URL=https://rebrickable.com/api/v3
-
Install Dependencies
composer install
-
Generate Application Key
php artisan key:generate
-
Start the Backend Server
php artisan serve
-
Navigate to the Frontend Directory
cd lego-frontend -
Install Dependencies
npm install
-
Start the Frontend Server
npm run start
📌 Username: khaledalam
📌 Password: test123456
📌 Testing API Key:
REBRICKABLE_API_KEY=ee1aa3371d56d497ae073aa4b7aec8e0
REBRICKABLE_API_URL=https://rebrickable.com/api/v3
The backend is built with Laravel and exposes the following API endpoints:
- POST /api/users/user-token → Generate user token
- POST /api/users/user-setlists → Get all user set lists
- POST /api/users/user-setlist/create → Create a new set list
- GET /api/lego/sets → Search for LEGO sets globally
- GET /api/lego/sets/{set_num}/parts → Fetch parts of a LEGO set
- POST /api/lego/sets/add-part → Add a part to a LEGO set
- DELETE /api/lego/remove-set-from-list → Remove a set from the list
- GET /api/lego/set/{user_token}/{list_id}/{set_num} → Fetch details of a set in a user’s list
- PUT /api/lego/set/update → Update set details
- POST /api/lego/set/save → Save custom modifications
- Better Error Handling & UX Improvements
- Unit & Integration Testing
- Deploy Backend & Frontend on a Cloud Platform
- Optimize API Calls & Reduce Unnecessary Fetching
🚀 Developed by Khaled Alam
📩 Contact: khaledalam.net@gmail.com
This project is licensed under the MIT License.