A simple REST API with frontend
- Product Listing: View all products
- Product Details: View detailed information about a specific product
- Product Creation: Add new products with name, type, colors, image URL, and description
- Responsive Design: Works on desktop and mobile devices
- .NET 8 with ASP.NET Core WebAPI
- Entity Framework Core for database
- PostgreSQL/Supabase for data storage
- Swagger/OpenAPI for API documentation
- xUnit and FluentAssertions for unit testing
- Next.js 15 with React 19
- TypeScript for type safety
- Tailwind CSS for styling
The project is organized into two main directories:
/
├── backend/
│ └── ProductAPI/ # .NET WebAPI project
│ ├── Controllers/ # API endpoints
│ ├── Data/ # Database context and migrations
│ ├── DTOs/ # Data Transfer Objects
│ ├── Middlewares/ # Custom middleware components
│ ├── Models/ # Domain entities
│ └── ProductAPI.Test/ # Unit tests
│
└── frontend/
├── app/ # Next.js app directory
│ ├── components/ # React components
│ ├── interfaces/ # TypeScript interfaces
│ ├── products/ # Product-related pages
│ ├── create-product/ # Product creation page
│ └── services/ # API service layer
└── public/ # Static assets
- .NET 8 SDK
- Node.js (v18+)
- PostgreSQL
-
Navigate to the backend directory:
cd backend/ProductAPI -
Update the connection string in
appsettings.json:"ConnectionStrings": { "DatabaseConnection": "Host=localhost;Database=productdb;Username=your_username;Password=your_password" }
-
Run the backend API:
dotnet run
The API will be available at https://localhost:7059 with Swagger documentation at https://localhost:7059/swagger.
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Create a
.env.localfile with the API URL:NEXT_PUBLIC_API_URL=https://localhost:7059/api -
Run the development server:
npm run dev
The frontend will be available at http://localhost:3000.
The system is built around these core entities:
- Product: Represents a product with name, description, image URL, and associated product type and colors
- ProductType: Categorizes products (e.g., Sofa, Chair, Table)
- Color: Available colors that can be associated with products
The API provides the following endpoints:
GET /api/products- Retrieves a paginated list of productsGET /api/products/{id}- Retrieves details for a specific productPOST /api/products- Creates a new productGET /api/product-types- Retrieves all available product typesGET /api/colors- Retrieves all available colors
To run the backend tests:
cd backend/ProductAPI.Test
dotnet test


