This application hosted on Azure App Service. Check it out here.
You can visit the frontend here.
This is a simple shopping cart microservice built with .NET 8, Entity Framework Core, and PostgreSQL, with a Next.js frontend.
- 🛒 Cart Management
- Add/Update items in cart
- Remove items from cart
- Empty entire cart
- Get cart summary with total amount
- 🏷️ Product Management
- List all products
- Get product details by ID
- 🔐 User-specific carts
- 🎯 RESTful API design
- 📚 Swagger/OpenAPI documentation
- 🌐 Next.js Frontend
- Modern, responsive UI
- Server-side rendering
- Interactive shopping experience
- .NET 8
- Entity Framework Core 9.0
- PostgreSQL
- Docker
- Swagger/OpenAPI
- Next.js
- React
- TypeScript
- .NET 8 SDK
- Node.js (version 18 or higher)
- npm or yarn
- Docker (optional)
- PostgreSQL instance or Docker container
- Clone the repository with submodules:
git clone --recursive https://github.com/szgrm/EcomCartService.git
If you've already cloned the repository without submodules:
git submodule init
git submodule update
- Change directory to the backend:
cd backend/
- Start the backend application:
dotnet run
- Navigate to the frontend directory:
cd frontend
- Install dependencies:
npm install
- Start the development server:
npm run build
npm start
The frontend will be available at http://localhost:3000
- POST /api/cart/update - Update cart item quantity
- GET /api/cart/summary/{username} - Get cart summary
- DELETE /api/cart/{username}/{productId} - Remove specific item from cart
- DELETE /api/cart/{username} - Empty cart
- GET /api/product - Get all products
- GET /api/product/{id} - Get product by ID
Id (int, primary key)
Title (string, max 100)
Description (string, max 500)
Category (string, max 100)
Brand (string, max 100)
SKU (string, max 100)
Price (double)
DiscountPercentage (double)
Rating (double)
Stock (int)
Weight (int)
MinimumOrderQuantity (int)
Images (string[])
Thumbnail (string, max 200)
Id (int, primary key)
ProductId (int, foreign key)
Quantity (int)
Username (string)
The project uses Entity Framework Core for database operations. To create new migrations:
dotnet ef migrations add MigrationName
dotnet ef database update
To build the frontend for production:
cd frontend
npm run build
npm start
-
Fork the repository
-
Create your feature branch:
git checkout -b feature/AmazingFeature
-
Commit your changes:
git commit -m 'Add some AmazingFeature'
-
Push to the branch:
git push origin feature/AmazingFeature
-
Open a Pull Request
To update the frontend to the latest version:
cd frontend
git pull origin main
cd ..
git add frontend
git commit -m "Update frontend submodule"
git push