Modern CRUD application for managing car repairs with authentication. Backend is an ASP.NET Core 8 Web API with JWT auth and SQL Server via EF Core, frontend is a React app
- Backend: .NET 8, ASP.NET Core Web API, Entity Framework Core (SqlServer), JWT, Swagger
- Frontend: React 19 (CRA), React Router, Testing Library
- DB: SQL Server (local or remote)
Projekt/
api/ # ASP.NET Core 8 Web API
ReactProjektWarsztat/ # React application (CRA)
- .NET SDK 8.x
- SQL Server instance (LocalDB/Developer/Azure SQL)
-
Copy
api/appsettings.Example.jsontoapi/appsettings.jsonand set values:ConnectionStrings:DefaultConnection→ your SQL Server connection stringJWT:ValidAudience,JWT:ValidIssuer,JWT:Secret(a strong secret)
-
CORS is open to common local dev ports (e.g.,
http://localhost:3000,http://localhost:5173,https://localhost:7161). Update inapi/Program.csif needed.
cd api
dotnet restore
# Create database schema (first time)
dotnet tool restore 2> NUL || echo off
dotnet ef migrations add InitialCreate
dotnet ef database update
# Run API (launchSettings exposes http://localhost:5180 and https://localhost:7161)
dotnet runSwagger UI: http://localhost:5180/swagger
- Register and Login via
api/Authto receive a JWT token - Send requests to protected endpoints with header:
Authorization: Bearer <token>
- Auth
- POST
api/Auth/register– register user{ name, surname, email, password, role } - POST
api/Auth/login– returns{ token, role }
- POST
- Car Repairs (JWT required)
- GET
api/CarRepair– list all - GET
api/CarRepair/{id}– get by id - POST
api/CarRepair– create - PUT
api/CarRepair/{id}– update - DELETE
api/CarRepair/{id}– delete - GET
api/CarRepair/my– repairs for the authenticated user (by JWTsub)
- GET
Request model (example):
{
"make": "Toyota",
"model": "Corolla",
"note": "Oil + filter",
"ownerId": 1,
"plateNumber": "KR1234AB",
"startDate": "2025-03-10",
"endDate": "2025-03-11"
}- Node.js 18+ and npm
cd ReactProjektWarsztat
npm install
npm startThe app runs on http://localhost:3000 by default.
The frontend calls the API at http://localhost:5180 (see src/warsztat/src/api/apiCars.js). Ensure the backend is running on that port, or adjust the URLs there if you change ports.
- Start the API:
cd api && dotnet run(ensure DB is migrated) - Start the React app:
cd ReactProjektWarsztat && npm start - Use Swagger to explore endpoints and test auth flows
- Log in via the UI to obtain and store the JWT, then perform CRUD