This is a simple e-commerce platform built using .NET, designed to manage products, categories, users, and orders. The platform includes user authentication and role-based access control (RBAC), allowing different levels of access for administrators and regular users.
- User Authentication: Register, login, and manage user sessions.
- Role-Based Access Control (RBAC): Different roles (e.g., Admin, Customer) with varying levels of access.
- Category Management: Administrators can create, update, and delete product categories.
- Product Management: Products are categorized, and both admins and users can view products. Admins can manage product listings (CRUD operations).
- Order Management: Users can place orders, and admins can manage and process them.
- .NET: The project is built with .NET, leveraging the framework's power for building a robust e-commerce platform.
- Entity Framework Core: Used for database interactions.
- ASP.NET Identity: Manages user authentication and role-based access control.
- SQL Server: Database engine for persisting data.
- Swagger: API documentation and testing.
- Prerequisites
- .NET SDK
- SQL Server or any compatible database engine
- Postman (for API testing) or Swagger.
- Steps to Run
-
Clone the repository:
git clone https://github.com/Andreaa-Dev/server-with-auth -
Navigate to the project folder:
cd server-with-auth -
Update the connection string in appsettings.json to match your SQL Server instance.
"ConnectionStrings": { "DefaultConnection": "Server=yourserver;Database=ecommerce;User Id=yourusername;Password=yourpassword;" } -
Run database migrations to set up the database schema:
dotnet ef database update -
Build and run the project:
dotnet run -
Access the project:
Web: https://localhost:5001 API: https://localhost:5001/swagger
- User Authentication
- POST /api/auth/register: Register a new user.
- POST /api/auth/login: Authenticate a user and get a token.
- Category Management (Admin Only)
- GET /api/categories: List all categories.
- POST /api/categories: Create a new category.
- PUT /api/categories/{id}: Update a category.
- DELETE /api/categories/{id}: Delete a category.
- Product Management
- GET /api/products: List all products.
- GET /api/products/{id}: View a product.
- POST /api/products: Create a new product (Admin).
- PUT /api/products/{id}: Update a product (Admin).
- DELETE /api/products/{id}: Delete a product (Admin).
- Order Management
- GET /api/orders: List all orders (Admin).
- POST /api/orders: Create a new order (Customer).
- PUT /api/orders/{id}: Update order status (Admin)
- Roles and Permissions
- Admin: Has full access to all endpoints, including management of categories, products, and orders.
- Customer: Can view products and place orders.
-
Implement search functionality for products.
-
Introduce shopping cart and payment gateway integration.
-
Testing